Skip to main content

How to add a GTM Tag

Learn how to add a GTM ( Google Tag Manager) in which to be able to use GTM and also GA (Google Analytics) for data and analytics.

J
Written by James bradbury
Updated over a year ago

From the main admin CMS on the left hand menu tab, navigate to 'Stores' then click on the hyperlink that is the storefront name in which to open up storefront settings.

Next click on the navigation bar marked as 'General Configuration' to open up the configuration table, below.

At the bottom of the General Configuration page you will find the GTM Tag. Click on

'+ Add New GTM Tag' to add one or more tags. Enter in the Container ID named tag and finish by clicking ' Save'

You can add more than one container ID Tag or remove others no longer required by clicking the 'Remove GTM Tag' as in the example below.

For more on acquiring your GTM tag Container Id please click on the button below

To add a GTM implementation data layer pack we have the following file for your reference, with the datalayer .json file accessible below the table in the collapsable section.

Home page / Product Listing / All pages

Sample Code

Variable

Trigger ( custom event )

{

[Store]

pageView

event: "pageView",

[event]

gtm: {uniqueEventId: 43,

start: 1670588270897},

store: "The Happy Store"

}

Product Detail Page

Sample Code

Variable

Trigger ( custom event )

{

[Store]

productView

event: "productView",

[event]

pageView

gtm: {uniqueEventId: 43,

[product_name]

start: 1670588356087},

[product_sku]

product_name: "Customise ×

Your Digital Gift Card",

product_sku: "031480",

store: "The Happy Store"

}

Add to cart

Sample Code

Variable

Trigger ( custom event )

{

[Store]

addedToCart

event: "addedToCart",

[event]

pageView

gtm: {uniqueEventId: 99,

[product_name]

start: 1670588356087},

[product_sku]

product_name: "Customise ×

[product_qty]

Your Digital Gift Card",

[product_price]

product_sku: "031480",

[product_currency]

store: "The Happy Store",

product_qty: "1",

product_price: "300.60",

product_currency: "SGD"

}

Success page

Sample Code

Variable

Trigger ( custom event )

{

event: "itemsPurchased", gtm: {uniqueEventId: 85,

start: 1670588394445},

store: "The Happy Store", line_items: "[{\"id\":\"031480\",\"name\":\" Customise × Your Digita" +

"l Gift Card\",\"brand\":\"The Happy Store\",\"price\":" +

[Store] [event] [line_items]

[shipping_total] [order_total] [order_currency] [order_promo] [order_discount] [tax] [returning_customer]

itemPurchased pageView

"\"300.60\",\"quantity\":1}]", shipping_total: "0.00",

order_total: "300.60", order_currency: "SGD", order_promo: "", order_discount: "0.00",

tax: "0.00",

returning_customer: true

}

Datalayer json file

{

"exportFormatVersion": 2,

"exportTime": "2022-12-20 12:46:21",

"containerVersion": {

"path": "accounts/6064877454/containers/98027918/versions/0",

"accountId": "6064877454",

"containerId": "98027918",

"containerVersionId": "0",

"container": {

"path": "accounts/6064877454/containers/98027918",

"accountId": "6064877454",

"containerId": "98027918",

"name": "my site",

"publicId": "GTM-5PXVPGH",

"usageContext": [

"WEB"

],

"fingerprint": "1669888485907",

"tagManagerUrl": "https://tagmanager.google.com/#/container/accounts/6064877454/containers/98027918/workspaces?apiLink=container",

"features": {

"supportUserPermissions": true,

"supportEnvironments": true,

"supportWorkspaces": true,

"supportGtagConfigs": false,

"supportBuiltInVariables": true,

"supportClients": false,

"supportFolders": true,

"supportTags": true,

"supportTemplates": true,

"supportTriggers": true,

"supportVariables": true,

"supportVersions": true,

"supportZones": true

},

"tagIds": [

"GTM-5PXVPGH"

]

},

"tag": [

{

"accountId": "6064877454",

"containerId": "98027918",

"tagId": "43",

"name": "GA4",

"type": "gaawc",

"parameter": [

{

"type": "BOOLEAN",

"key": "sendPageView",

"value": "true"

},

{

"type": "BOOLEAN",

"key": "enableSendToServerContainer",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "measurementId",

"value": "G-V15KZT4251"

}

],

"fingerprint": "1670915365031",

"firingTriggerId": [

"2147479553"

],

"tagFiringOption": "ONCE_PER_EVENT",

"monitoringMetadata": {

"type": "MAP"

},

"consentSettings": {

"consentStatus": "NOT_SET"

}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"tagId": "48",

"name": "GA4 purchase event",

"type": "gaawe",

"parameter": [

{

"type": "BOOLEAN",

"key": "sendEcommerceData",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "eventName",

"value": "purchase"

},

{

"type": "LIST",

"key": "eventParameters",

"list": [

{

"type": "MAP",

"map": [

{

"type": "TEMPLATE",

"key": "name",

"value": "value"

},

{

"type": "TEMPLATE",

"key": "value",

"value": "{{order_total}}"

}

]

},

{

"type": "MAP",

"map": [

{

"type": "TEMPLATE",

"key": "name",

"value": "transaction_id"

},

{

"type": "TEMPLATE",

"key": "value",

"value": "{{order_id}}"

}

]

},

{

"type": "MAP",

"map": [

{

"type": "TEMPLATE",

"key": "name",

"value": "currency"

},

{

"type": "TEMPLATE",

"key": "value",

"value": "{{order_currency}}"

}

]

},

{

"type": "MAP",

"map": [

{

"type": "TEMPLATE",

"key": "name",

"value": "items"

},

{

"type": "TEMPLATE",

"key": "value",

"value": "{{Purchase items}}"

}

]

}

]

},

{

"type": "TAG_REFERENCE",

"key": "measurementId",

"value": "GA4"

}

],

"fingerprint": "1671529917304",

"firingTriggerId": [

"25"

],

"tagFiringOption": "ONCE_PER_EVENT",

"monitoringMetadata": {

"type": "MAP"

},

"consentSettings": {

"consentStatus": "NOT_SET"

}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"tagId": "50",

"name": "GA4 ATC event",

"type": "gaawe",

"parameter": [

{

"type": "BOOLEAN",

"key": "sendEcommerceData",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "eventName",

"value": "add_to_cart"

},

{

"type": "LIST",

"key": "eventParameters",

"list": [

{

"type": "MAP",

"map": [

{

"type": "TEMPLATE",

"key": "name",

"value": "currency"

},

{

"type": "TEMPLATE",

"key": "value",

"value": "{{product_currency}}"

}

]

},

{

"type": "MAP",

"map": [

{

"type": "TEMPLATE",

"key": "name",

"value": "value"

},

{

"type": "TEMPLATE",

"key": "value",

"value": "{{product_price}}"

}

]

},

{

"type": "MAP",

"map": [

{

"type": "TEMPLATE",

"key": "name",

"value": "items"

},

{

"type": "TEMPLATE",

"key": "value",

"value": "{{Add to cart items}}"

}

]

}

]

},

{

"type": "TAG_REFERENCE",

"key": "measurementId",

"value": "GA4"

}

],

"fingerprint": "1671535021730",

"firingTriggerId": [

"26"

],

"tagFiringOption": "ONCE_PER_EVENT",

"monitoringMetadata": {

"type": "MAP"

},

"consentSettings": {

"consentStatus": "NOT_SET"

}

}

],

"trigger": [

{

"accountId": "6064877454",

"containerId": "98027918",

"triggerId": "13",

"name": "productView",

"type": "CUSTOM_EVENT",

"customEventFilter": [

{

"type": "EQUALS",

"parameter": [

{

"type": "TEMPLATE",

"key": "arg0",

"value": "{{_event}}"

},

{

"type": "TEMPLATE",

"key": "arg1",

"value": "productView"

}

]

}

],

"fingerprint": "1670495512716"

},

{

"accountId": "6064877454",

"containerId": "98027918",

"triggerId": "16",

"name": "pageView",

"type": "CUSTOM_EVENT",

"customEventFilter": [

{

"type": "EQUALS",

"parameter": [

{

"type": "TEMPLATE",

"key": "arg0",

"value": "{{_event}}"

},

{

"type": "TEMPLATE",

"key": "arg1",

"value": "pageView"

}

]

}

],

"fingerprint": "1670495512717"

},

{

"accountId": "6064877454",

"containerId": "98027918",

"triggerId": "25",

"name": "itemsPurchased",

"type": "CUSTOM_EVENT",

"customEventFilter": [

{

"type": "EQUALS",

"parameter": [

{

"type": "TEMPLATE",

"key": "arg0",

"value": "{{_event}}"

},

{

"type": "TEMPLATE",

"key": "arg1",

"value": "itemsPurchased"

}

]

}

],

"fingerprint": "1670495512718"

},

{

"accountId": "6064877454",

"containerId": "98027918",

"triggerId": "26",

"name": "addedToCart",

"type": "CUSTOM_EVENT",

"customEventFilter": [

{

"type": "EQUALS",

"parameter": [

{

"type": "TEMPLATE",

"key": "arg0",

"value": "{{_event}}"

},

{

"type": "TEMPLATE",

"key": "arg1",

"value": "addedToCart"

}

]

}

],

"fingerprint": "1670495512719"

}

],

"variable": [

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "6",

"name": "variant_sku",

"type": "v",

"parameter": [

{

"type": "INTEGER",

"key": "dataLayerVersion",

"value": "2"

},

{

"type": "BOOLEAN",

"key": "setDefaultValue",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "name",

"value": "variant_sku"

}

],

"fingerprint": "1670495512713",

"formatValue": {}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "7",

"name": "product_name",

"type": "v",

"parameter": [

{

"type": "INTEGER",

"key": "dataLayerVersion",

"value": "2"

},

{

"type": "BOOLEAN",

"key": "setDefaultValue",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "name",

"value": "product_name"

}

],

"fingerprint": "1670495512714",

"formatValue": {}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "8",

"name": "product_currency",

"type": "v",

"parameter": [

{

"type": "INTEGER",

"key": "dataLayerVersion",

"value": "2"

},

{

"type": "BOOLEAN",

"key": "setDefaultValue",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "name",

"value": "product_currency"

}

],

"fingerprint": "1670495512714",

"formatValue": {}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "9",

"name": "order_total",

"type": "v",

"parameter": [

{

"type": "INTEGER",

"key": "dataLayerVersion",

"value": "2"

},

{

"type": "BOOLEAN",

"key": "setDefaultValue",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "name",

"value": "order_total"

}

],

"fingerprint": "1670495512715",

"formatValue": {}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "10",

"name": "tax",

"type": "v",

"parameter": [

{

"type": "INTEGER",

"key": "dataLayerVersion",

"value": "2"

},

{

"type": "BOOLEAN",

"key": "setDefaultValue",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "name",

"value": "tax"

}

],

"fingerprint": "1670495512715",

"formatValue": {}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "11",

"name": "customer_id",

"type": "v",

"parameter": [

{

"type": "INTEGER",

"key": "dataLayerVersion",

"value": "2"

},

{

"type": "BOOLEAN",

"key": "setDefaultValue",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "name",

"value": "customer_id"

}

],

"fingerprint": "1670495512715",

"formatValue": {}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "15",

"name": "store",

"type": "v",

"parameter": [

{

"type": "INTEGER",

"key": "dataLayerVersion",

"value": "2"

},

{

"type": "BOOLEAN",

"key": "setDefaultValue",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "name",

"value": "store"

}

],

"fingerprint": "1670495512716",

"formatValue": {}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "17",

"name": "product_sku",

"type": "v",

"parameter": [

{

"type": "INTEGER",

"key": "dataLayerVersion",

"value": "2"

},

{

"type": "BOOLEAN",

"key": "setDefaultValue",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "name",

"value": "product_sku"

}

],

"fingerprint": "1670495512717",

"formatValue": {}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "18",

"name": "customer_email",

"type": "v",

"parameter": [

{

"type": "INTEGER",

"key": "dataLayerVersion",

"value": "2"

},

{

"type": "BOOLEAN",

"key": "setDefaultValue",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "name",

"value": "customer_email"

}

],

"fingerprint": "1670495512717",

"formatValue": {}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "19",

"name": "order_promo",

"type": "v",

"parameter": [

{

"type": "INTEGER",

"key": "dataLayerVersion",

"value": "2"

},

{

"type": "BOOLEAN",

"key": "setDefaultValue",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "name",

"value": "order_promo"

}

],

"fingerprint": "1670495512717",

"formatValue": {}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "20",

"name": "order_currency",

"type": "v",

"parameter": [

{

"type": "INTEGER",

"key": "dataLayerVersion",

"value": "2"

},

{

"type": "BOOLEAN",

"key": "setDefaultValue",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "name",

"value": "order_currency"

}

],

"fingerprint": "1670495512717",

"formatValue": {}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "21",

"name": "product_qty",

"type": "v",

"parameter": [

{

"type": "INTEGER",

"key": "dataLayerVersion",

"value": "2"

},

{

"type": "BOOLEAN",

"key": "setDefaultValue",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "name",

"value": "product_qty"

}

],

"fingerprint": "1670495512718",

"formatValue": {}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "22",

"name": "line_items",

"type": "v",

"parameter": [

{

"type": "INTEGER",

"key": "dataLayerVersion",

"value": "2"

},

{

"type": "BOOLEAN",

"key": "setDefaultValue",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "name",

"value": "line_items"

}

],

"fingerprint": "1670495512718",

"formatValue": {}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "24",

"name": "product_price",

"type": "v",

"parameter": [

{

"type": "INTEGER",

"key": "dataLayerVersion",

"value": "2"

},

{

"type": "BOOLEAN",

"key": "setDefaultValue",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "name",

"value": "product_price"

}

],

"fingerprint": "1670495512718",

"formatValue": {}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "27",

"name": "order_id",

"type": "v",

"parameter": [

{

"type": "INTEGER",

"key": "dataLayerVersion",

"value": "2"

},

{

"type": "BOOLEAN",

"key": "setDefaultValue",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "name",

"value": "order_id"

}

],

"fingerprint": "1670495512719",

"formatValue": {}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "28",

"name": "order_discount",

"type": "v",

"parameter": [

{

"type": "INTEGER",

"key": "dataLayerVersion",

"value": "2"

},

{

"type": "BOOLEAN",

"key": "setDefaultValue",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "name",

"value": "order_discount"

}

],

"fingerprint": "1670495512719",

"formatValue": {}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "29",

"name": "shipping_total",

"type": "v",

"parameter": [

{

"type": "INTEGER",

"key": "dataLayerVersion",

"value": "2"

},

{

"type": "BOOLEAN",

"key": "setDefaultValue",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "name",

"value": "shipping_total"

}

],

"fingerprint": "1670495512719",

"formatValue": {}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "30",

"name": "returning_customer",

"type": "v",

"parameter": [

{

"type": "INTEGER",

"key": "dataLayerVersion",

"value": "2"

},

{

"type": "BOOLEAN",

"key": "setDefaultValue",

"value": "false"

},

{

"type": "TEMPLATE",

"key": "name",

"value": "returning_customer"

}

],

"fingerprint": "1670574842766",

"formatValue": {

"convertTrueToValue": {

"type": "TEMPLATE",

"value": "Returning"

},

"convertFalseToValue": {

"type": "TEMPLATE",

"value": "New"

}

}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "46",

"name": "Purchase items",

"type": "jsm",

"parameter": [

{

"type": "TEMPLATE",

"key": "javascript",

"value": "function() {\n var line_items = JSON.parse({{line_items}})\n jsonObjectList = [] // store json object\n for(var i =0; i < line_items.length; i++)\n {\n jsonObjectList.push({\n \"item_id\" : line_items[i][\"id\"],\n \"item_name\" : line_items[i][\"name\"],\n \"item_variant\" : line_items[i][\"variant_sku\"],\n \"price\" : line_items[i][\"price\"],\n \"quantity\" : line_items[i][\"quantity\"]\n })\n }\n\n // Return the contents of the output variable\n return jsonObjectList\n}"

}

],

"fingerprint": "1671539486159",

"formatValue": {}

},

{

"accountId": "6064877454",

"containerId": "98027918",

"variableId": "55",

"name": "Add to cart items",

"type": "jsm",

"parameter": [

{

"type": "TEMPLATE",

"key": "javascript",

"value": "function() {\n // Get the values of the data layer variables\n var itemId = {{product_sku}};\n var itemName = {{product_name}};\n var itemVariant = {{variant_sku}};\n var price = {{product_price}};\n var quantity = {{product_qty}};\n \n // Return an array with an object for each item in the cart\n return [{\n item_id: itemId,\n item_name: itemName,\n item_variant: itemVariant,\n price: price,\n quantity: quantity\n }];\n}"

}

],

"fingerprint": "1671533404148",

"formatValue": {}

}

],

"fingerprint": "1671540381244",

"tagManagerUrl": "https://tagmanager.google.com/#/versions/accounts/6064877454/containers/98027918/versions/0?apiLink=version"

}

}

Did this answer your question?