Skip to main content

Analytics & Tags

Google Tag Manager is the single integration point for analytics and marketing tags on your storefront. Set your container ID as a store setting and the container loads, with no redeploy and no involvement from us. Google Analytics 4, ad platform tags and consent tooling are all configured inside GTM.

Connect Google Tag Manager

Set gtmId in the evolve_gtm namespace. See Store Settings for the mechanics.

Set your GTM container - Sample Request
curl -X POST 'https://api.bigcommerce.com/stores/{store_hash}/v3/channels/{channel_id}/metafields' \
-H 'X-Auth-Token: {management_api_token}' \
-H 'Content-Type: application/json' \
-d '{
"namespace": "evolve_gtm",
"key": "gtmId",
"value": "GTM-XXXXXXX",
"permission_set": "read_and_sf_access",
"description": "Google Tag Manager container"
}'

Until gtmId is set, no tag manager script is loaded at all. There is no separate setting for a GA4 measurement ID. Configure GA4 as a tag inside your container.

Settings

SettingTypeDefaultWhat it does
gtmIdtextemptyYour container ID, e.g. GTM-XXXXXXX
gtmAuthtextemptyEnvironment auth string, if you use GTM environments
gtmPreviewtextemptyEnvironment preview name, e.g. env-3
marketingParametersJSONsee belowMaps incoming URL query parameters to the attribution values captured
marketingTimeStamptextutm_timestampName the campaign timestamp is captured under

GTM environments

To point your storefront at a GTM environment rather than the live container, set gtmAuth and gtmPreview alongside gtmId. Take all three values from Admin → Environments → Get snippet in GTM.

Run your consent banner as a tag inside GTM, using whichever consent management platform you already use. GTM's own consent mode then governs when your other tags are allowed to fire. Your storefront has no separate consent setting of its own.

Marketing attribution

Campaign parameters on an incoming URL are captured, stored in the shopper's browser for the rest of their visit, and attached to every data layer event after that. The default mapping:

marketingParameters - default
{
"utm_source": "utm_source",
"utm_medium": "utm_medium",
"utm_campaign": "utm_campaign",
"utm_term": "utm_term",
"utm_content": "utm_content",
"affiliate_ref": "ref"
}

Read each pair right to left: the value is the query parameter to look for on the URL, and the key is the name it's captured and reported under. So "affiliate_ref": "ref" picks up ?ref= and reports it as affiliate_ref. To add your own parameter, set the whole object. It replaces the default rather than merging with it:

Add a custom campaign parameter - Sample Request
curl -X POST 'https://api.bigcommerce.com/stores/{store_hash}/v3/channels/{channel_id}/metafields' \
-H 'X-Auth-Token: {management_api_token}' \
-H 'Content-Type: application/json' \
-d '{
"namespace": "evolve_gtm",
"key": "marketingParameters",
"value": "{\"utm_source\":\"utm_source\",\"utm_medium\":\"utm_medium\",\"utm_campaign\":\"utm_campaign\",\"partner_id\":\"partner\"}",
"permission_set": "read_and_sf_access"
}'

Events available to your tags

Your storefront pushes these events to the data layer as shoppers move through the site. Build your GA4 or ad platform tags on top of them.

EventFires when
Product viewA shopper opens a product page
Product clickA shopper selects a product from a listing
Item list viewA category or listing page renders its products
Search results viewA search returns results
Cart viewThe cart page opens
Add to cartAn item is added
Remove from cartAn item is removed
CheckoutA shopper starts checkout
Promotion viewA promotion is displayed
Promotion clickA shopper selects a promotion
Purchase tracking lives in BigCommerce

Because checkout runs on BigCommerce, the payment, shipping and purchase steps happen on BigCommerce's pages, not yours. Those events are not emitted by your storefront. Configure purchase and revenue tracking in BigCommerce, either through its own analytics settings or with a GTM container on the BigCommerce checkout. Without that, your funnel will end at checkout start and report no revenue.

Use the same GA4 property from both sides so sessions stitch together, and test the full funnel with a real order before you trust the numbers.

Other tags and scripts

Add tags through GTM. It covers ad pixels, heatmaps, chat widgets, A/B testing and consent tooling, and it needs no changes from us.

Two cases do need us:

  • A script that must load before the page renders, ahead of GTM. Rare, but some personalization and anti-flicker snippets require it.
  • A third-party domain that the browser blocks. Your storefront sends a Content Security Policy header, so a script served from a domain we don't yet allow will be refused by the browser. If a tag installed through GTM doesn't run and your browser console shows a Content Security Policy error, tell us the domain and we'll allow it.

See also