One Google Tag Manager container runs on every Broadtime site.
01 Who does what
Broadtime dev
- Add the container snippet to the master template
- Push store identity to the dataLayer, server-side, per store
- Push the
purchaseevent from cart and checkout - Send a server-side purchase from the Stripe webhook
- Install the container in the Shopify Liquid theme
- Remove legacy analytics scripts after we validate
PixelCove
- Build tags, triggers, and variables in the container
- Stand up the GA4 fleet roll-up property
- Wire Consent Mode v2
- QA in GA4 DebugView, then publish
- Set the go-live date with you
02 Container snippet
Add the container to every page type: home, product, news, cart, and checkout. Put the <head> block as high in the head as possible. Put the <noscript> block right after the opening <body> tag.
<!-- In <head>, after the identity push in §03 -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-NX8WHS7T');</script>
<!-- Immediately after <body> -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NX8WHS7T"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
03 Store identity (dataLayer)
Render this block per store, before the container snippet.
<script>
window.dataLayer = window.dataLayer || [];
dataLayer.push({
store_id: "south-metro", // stable slug, one per store
store_mid: "G-XXXXXXXXXX", // the store's existing GA4 measurement ID
brand: "South Metro Music"
});
</script>
| Field | Type | Rule |
|---|---|---|
store_id | string | Lowercase slug. Set once per store, never change it. |
store_mid | string | The store's current GA4 measurement ID (G-…). Reuse what already exists. |
brand | string | Display name for reports. |
04 Purchase event
Fire this once the order confirms, from the Tuneportals cart and the Shopify thank-you page. Clear the previous ecommerce object first.
dataLayer.push({ ecommerce: null }); // clear previous
dataLayer.push({
event: "purchase",
store_id: "south-metro",
ecommerce: {
transaction_id: "TP-88231",
value: 41.98, currency: "USD", tax: 3.10, shipping: 5.00,
items: [{
item_id: "0093624912", // UPC
item_name: "Rumours (Fleetwood Mac) LP",
item_brand: "Warner", item_category: "Vinyl",
location_id: "Broadtime Alliance", // distributor: Alliance or All Media Supply
price: 36.98, quantity: 1
}]
}
});
| Field | Rule |
|---|---|
transaction_id | Unique per order. |
value / currency | Order total and ISO currency. |
item_id | UPC. |
location_id | Fulfillment source: Broadtime Alliance or All Media Supply. |
price / quantity | Per line item. |
05 Server-side purchase (Stripe)
Client-side events drop when a buyer closes the tab before the page finishes. Back every purchase with a server call from the Stripe webhook.
POST https://www.google-analytics.com/mp/collect?measurement_id={store_mid}&api_secret={secret}
{ "client_id": "<ga client_id captured at checkout>",
"events": [{ "name": "purchase", "params": { "transaction_id":"TP-88231",
"value":41.98, "currency":"USD", "store_id":"south-metro", "items":[ … ] }}]}
Send the same payload to the store measurement ID and the fleet ID (PixelCove supplies the fleet ID). Keep the api_secret in your secrets store. Never put it in page source. The Tuneportals developer and PixelCove will lock the payload shape together.
06 Shopify stores
Install the container in the Liquid theme at theme.liquid, not through a sales-channel app. Same snippet, same dataLayer contract as the Tuneportals sites.
07 Sequence
- You add the snippet and dataLayer to the pilot store, South Metro Broadtime dev
- PixelCove validates in GA4 DebugView and Realtime PixelCove
- PixelCove publishes the container and sets a go-live date PixelCove
- You roll the snippet across the master template, fleet-wide Broadtime dev
- You remove the legacy analytics scripts Broadtime dev
Two things to avoid
- Removing legacy tags before PixelCove confirms the new flow. Run both in parallel until then.
- Hardcoding measurement IDs in the container. Every ID comes from the dataLayer.