Google Tag Manager
Installing relaybell with Google Tag Manager: the relaybell tag template, or a Custom HTML tag.
Google Tag Manager can add relaybell's script to every page. It can't add the service worker: put sw.js at the root of your own domain first (https://your-site.com/sw.js, download it from the dashboard's Install page), because browsers only accept it from your domain.
The relaybell tag template
The relaybell Web Push tag template loads relaybell for you, with three fields:
| Field | What it does |
|---|---|
| Project ID (required) | Your website's Project ID, from relaybell's Settings → Install. It is public, so it is fine in Tag Manager. |
| Read GA4 e-commerce events | Ticked: relaybell reads the GA4 shop events your site already pushes (view_item, add_to_cart, begin_checkout, purchase, select_item). Unticked: relaybell follows the Tracking switch in your dashboard. See Google Analytics events. |
| Require consent | relaybell does nothing — no subscribe prompt, no events — until Google Consent Mode grants analytics_storage, or until your site calls RelayBell.grantConsent(). If your site doesn't use Consent Mode, Tag Manager treats it as granted. |
- In Tag Manager, open Templates → Tag Templates → Search Gallery and add relaybell Web Push.
- Tags → New, choose the relaybell tag, paste your Project ID, and set the trigger to All Pages (or Initialization – All Pages).
- Preview, then Submit. Your subscribe prompt appears as set up in the dashboard.
Note
The template isn't in the Community Template Gallery yet; it will be listed once Google has reviewed it. Until then, use the Custom HTML tag below. It does the same.
Custom HTML tag
Add a Custom HTML tag, set to fire on All Pages:
<script>
window.relaybellInit = { projectId: "YOUR_PROJECT_ID", apiBase: "https://relaybell.com" };
</script>
<script src="https://relaybell.com/relaybell-sdk.js" async></script>relaybell starts itself from window.relaybellInit once the script has loaded, whichever trigger fires the tag. The same options as RelayBell.init() go in that object, for example:
dataLayer: true— read your GA4 shop events whatever the dashboard switch says (see Google Analytics events).requireConsent: true— wait until your consent banner callsRelayBell.grantConsent().
Your own dataLayer events
GA4 shop events are covered by Google Analytics events, and other GA4 events can be added there by name. For anything else you track in Tag Manager, see Auto-capture & Google Tag Manager.