-
-
Save measureschool/8ffa4e45da745b1a9b0db1ac1cbe854e to your computer and use it in GitHub Desktop.
SamCart GTM implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"exportFormatVersion": 2, | |
"exportTime": "2019-07-10 11:57:52", | |
"containerVersion": { | |
"path": "accounts/144483319/containers/12164900/versions/0", | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"containerVersionId": "0", | |
"container": { | |
"path": "accounts/144483319/containers/12164900", | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"name": "266SamCart", | |
"publicId": "GTM-W65JLWM", | |
"usageContext": [ | |
"WEB" | |
], | |
"fingerprint": "1562759860914", | |
"tagManagerUrl": "https://tagmanager.google.com/#/container/accounts/144483319/containers/12164900/workspaces?apiLink=container" | |
}, | |
"tag": [ | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"tagId": "10", | |
"name": "Fb - Base and Pageview - All Pages", | |
"type": "html", | |
"priority": { | |
"type": "INTEGER", | |
"value": "100" | |
}, | |
"parameter": [ | |
{ | |
"type": "TEMPLATE", | |
"key": "html", | |
"value": "<!-- Facebook Pixel Code -->\n<script>\n !function(f,b,e,v,n,t,s)\n {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n n.queue=[];t=b.createElement(e);t.async=!0;\n t.src=v;s=b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t,s)}(window, document,'script',\n 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', 'XXXXXXXXXXXXX');\n fbq('track', 'PageView');\n</script>\n<!-- End Facebook Pixel Code -->" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "supportDocumentWrite", | |
"value": "false" | |
} | |
], | |
"fingerprint": "1562759748823", | |
"firingTriggerId": [ | |
"2147479553" | |
], | |
"tagFiringOption": "ONCE_PER_EVENT" | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"tagId": "11", | |
"name": "Fb - Event - Product View", | |
"type": "html", | |
"parameter": [ | |
{ | |
"type": "TEMPLATE", | |
"key": "html", | |
"value": "<script>\n fbq('track', 'ViewContent',{\ncontent_ids: {{cjs - product Ids}},\n content_type: 'product'\n});\n</script>\n" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "supportDocumentWrite", | |
"value": "false" | |
} | |
], | |
"fingerprint": "1561711057023", | |
"firingTriggerId": [ | |
"11" | |
], | |
"tagFiringOption": "ONCE_PER_EVENT" | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"tagId": "12", | |
"name": "Fb - Event - Transaction", | |
"type": "html", | |
"parameter": [ | |
{ | |
"type": "TEMPLATE", | |
"key": "html", | |
"value": "<script>\n \n var products = [];\n window.order_summary.items.forEach(function(e,i){\n var prod = { \n 'id': e.product_id,\n 'item_price': e.amount,\n 'quantity': e.quantity \n }\n products.push(prod);\n });\nfbq('track', 'Purchase',\n {\n value: {{js - total amount}},\n currency: 'USD',\n contents: products,\n content_type: 'product'\n }\n);\n</script>\n" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "supportDocumentWrite", | |
"value": "false" | |
} | |
], | |
"fingerprint": "1561711057024", | |
"firingTriggerId": [ | |
"12" | |
], | |
"tagFiringOption": "ONCE_PER_EVENT" | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"tagId": "13", | |
"name": "GA - Event - EE Transaction", | |
"type": "ua", | |
"parameter": [ | |
{ | |
"type": "BOOLEAN", | |
"key": "nonInteraction", | |
"value": "true" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "overrideGaSettings", | |
"value": "true" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "useEcommerceDataLayer", | |
"value": "false" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "ecommerceMacroData", | |
"value": "{{cjs - EE Transaction Samcart}}" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "eventCategory", | |
"value": "Enhanced Ecommerce" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "trackType", | |
"value": "TRACK_EVENT" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "gaSettings", | |
"value": "{{UA-123456-7}}" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "eventAction", | |
"value": "Transaction" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "enableEcommerce", | |
"value": "true" | |
} | |
], | |
"fingerprint": "1561711057025", | |
"firingTriggerId": [ | |
"12" | |
], | |
"tagFiringOption": "ONCE_PER_EVENT" | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"tagId": "14", | |
"name": "GA - Event - EE View", | |
"type": "ua", | |
"parameter": [ | |
{ | |
"type": "BOOLEAN", | |
"key": "nonInteraction", | |
"value": "true" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "overrideGaSettings", | |
"value": "true" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "useEcommerceDataLayer", | |
"value": "false" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "ecommerceMacroData", | |
"value": "{{cjs - Ecomm Product View}}" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "eventCategory", | |
"value": "Enhanced Ecommerce" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "trackType", | |
"value": "TRACK_EVENT" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "gaSettings", | |
"value": "{{UA-123456-7}}" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "eventAction", | |
"value": "Product View" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "enableEcommerce", | |
"value": "true" | |
} | |
], | |
"fingerprint": "1561711057026", | |
"firingTriggerId": [ | |
"11" | |
], | |
"tagFiringOption": "ONCE_PER_EVENT" | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"tagId": "15", | |
"name": "GA - Pageview - All Pages", | |
"type": "ua", | |
"parameter": [ | |
{ | |
"type": "BOOLEAN", | |
"key": "overrideGaSettings", | |
"value": "false" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "trackType", | |
"value": "TRACK_PAGEVIEW" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "gaSettings", | |
"value": "{{UA-123456-7}}" | |
} | |
], | |
"fingerprint": "1561711057027", | |
"firingTriggerId": [ | |
"2147479553" | |
], | |
"tagFiringOption": "ONCE_PER_EVENT" | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"tagId": "16", | |
"name": "GAds - Conversion - Transaction", | |
"type": "awct", | |
"parameter": [ | |
{ | |
"type": "BOOLEAN", | |
"key": "enableConversionLinker", | |
"value": "true" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "orderId", | |
"value": "{{js - order id}}" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "conversionValue", | |
"value": "{{js - total amount}}" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "conversionCookiePrefix", | |
"value": "_gcl" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "conversionId", | |
"value": "1234567" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "conversionLabel", | |
"value": "xyxyxyxyxyxyxyxyx" | |
} | |
], | |
"fingerprint": "1562759834511", | |
"firingTriggerId": [ | |
"12" | |
], | |
"tagFiringOption": "ONCE_PER_EVENT" | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"tagId": "17", | |
"name": "GAds - Conversion Linker", | |
"type": "gclidw", | |
"parameter": [ | |
{ | |
"type": "BOOLEAN", | |
"key": "enableCrossDomain", | |
"value": "false" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "enableCookieOverrides", | |
"value": "false" | |
} | |
], | |
"fingerprint": "1561711057027", | |
"firingTriggerId": [ | |
"2147479553" | |
], | |
"tagFiringOption": "ONCE_PER_EVENT" | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"tagId": "18", | |
"name": "GAds - Product Remarketing - Product View", | |
"type": "sp", | |
"parameter": [ | |
{ | |
"type": "BOOLEAN", | |
"key": "enableDynamicRemarketing", | |
"value": "false" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "dataLayerVariable", | |
"value": "{{cjs - google_tag_params}}" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "conversionId", | |
"value": "1234567" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "customParamsFormat", | |
"value": "DATA_LAYER" | |
} | |
], | |
"fingerprint": "1562759851337", | |
"firingTriggerId": [ | |
"11" | |
], | |
"tagFiringOption": "ONCE_PER_EVENT" | |
} | |
], | |
"trigger": [ | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"triggerId": "11", | |
"name": "dom - product view", | |
"type": "DOM_READY", | |
"filter": [ | |
{ | |
"type": "EQUALS", | |
"parameter": [ | |
{ | |
"type": "TEMPLATE", | |
"key": "arg0", | |
"value": "{{cjs - Ecomm Product View}}" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "arg1", | |
"value": "undefined" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "negate", | |
"value": "true" | |
} | |
] | |
} | |
], | |
"fingerprint": "1561711057019" | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"triggerId": "12", | |
"name": "pv - transaction", | |
"type": "PAGEVIEW", | |
"filter": [ | |
{ | |
"type": "EQUALS", | |
"parameter": [ | |
{ | |
"type": "TEMPLATE", | |
"key": "arg0", | |
"value": "{{cjs - EE Transaction Samcart}}" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "arg1", | |
"value": "undefined" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "negate", | |
"value": "true" | |
} | |
] | |
} | |
], | |
"fingerprint": "1561711057020" | |
} | |
], | |
"variable": [ | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"variableId": "12", | |
"name": "UA-123456-7", | |
"type": "gas", | |
"parameter": [ | |
{ | |
"type": "TEMPLATE", | |
"key": "cookieDomain", | |
"value": "auto" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "doubleClick", | |
"value": "false" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "setTrackerName", | |
"value": "false" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "useDebugVersion", | |
"value": "false" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "useHashAutoLink", | |
"value": "false" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "decorateFormsAutoLink", | |
"value": "false" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "enableLinkId", | |
"value": "false" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "enableEcommerce", | |
"value": "false" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "trackingId", | |
"value": "UA-123456-7" | |
} | |
], | |
"fingerprint": "1562759778659" | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"variableId": "11", | |
"name": "cjs - EE Transaction Samcart", | |
"type": "jsm", | |
"parameter": [ | |
{ | |
"type": "TEMPLATE", | |
"key": "javascript", | |
"value": "function(){\n var products = [];\n window.order_summary.items.forEach(function(e,i){\n var prod = { \n 'name': e.product_name, \n 'id': e.product_id,\n 'price': e.amount,\n 'brand': e.source,\n 'quantity': e.quantity \n }\n products.push(prod);\n });\n\n return {\n 'ecommerce': {\n 'purchase': {\n 'actionField': {\n 'id': order_summary.id,\n 'revenue': order_summary.total_amount, \n 'tax': order_summary.total_tax,\n 'shipping': order_summary.total_shipping\n },\n 'products': products\n }\n }\n };\n}" | |
} | |
], | |
"fingerprint": "1561711057020", | |
"formatValue": {} | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"variableId": "10", | |
"name": "cjs - Ecomm Product View", | |
"type": "jsm", | |
"parameter": [ | |
{ | |
"type": "TEMPLATE", | |
"key": "javascript", | |
"value": "function(){\n var fromDL= google_tag_manager[{{Container ID}}].dataLayer.get('ecommerce')\n var ecommObj = {'ecommerce': {\n 'impressions': [],\n 'detail': {\n 'actionField': {'list': 'Main'},\n 'products': []\n } \n }}\ntry{\n var mainProduct = {\n 'name': product.name,\n 'id': product.id,\n 'category': 'primary',\n 'price': product.price/100,\n 'list': 'Main'\n };\n ecommObj.ecommerce.detail.products.push(mainProduct);\n ecommObj.ecommerce.impressions.push(mainProduct);\n if(bump){\n var bumpProduct = {\n 'name': bump.name,\n 'id': bump.id,\n 'category': 'bump',\n 'price': bump.price/100,\n 'list': 'Main'\n };\n ecommObj.ecommerce.detail.products.push(bumpProduct);\n ecommObj.ecommerce.impressions.push(bumpProduct);\n }\n return ecommObj;\n}catch(e){\n if(fromDL){\necommObj['ecommerce'] = fromDL;\nreturn ecommObj;\n }else{\n return undefined;\n }\n}\n\n}" | |
} | |
], | |
"fingerprint": "1561711057019", | |
"formatValue": {} | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"variableId": "14", | |
"name": "cjs - google_tag_params", | |
"type": "jsm", | |
"parameter": [ | |
{ | |
"type": "TEMPLATE", | |
"key": "javascript", | |
"value": "function(){\n var totalprice = 0\n var priceFromDL= google_tag_manager[\"GTM-W65JLWM\"].dataLayer.get('ecommerce.impressions.0.price') \n totalprice += window.product ? window.product.price/100 : 0;\n totalprice += window.bump ? window.bump.price/100 : 0;\n totalprice += priceFromDL ? parseFloat(priceFromDL) : 0;\n var google_tag_params = {\n 'ecomm_prodid': {{cjs - product Ids}},\n 'ecomm_pagetype': 'cart',\n 'ecomm_totalvalue': totalprice\n }\nreturn google_tag_params\n}" | |
} | |
], | |
"fingerprint": "1561711057022", | |
"formatValue": {} | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"variableId": "13", | |
"name": "cjs - product Ids", | |
"type": "jsm", | |
"parameter": [ | |
{ | |
"type": "TEMPLATE", | |
"key": "javascript", | |
"value": "function(){\n var product_ids = [];\n if(window.order_summary){\n window.order_summary.items.forEach(function(e){\n product_ids.push(e.product_id);\n });\n return product_ids;\n }\n if(window.product){\n \tproduct_ids.push(window.product.id);\n if(bump){\n product_ids.push(window.bump.id);\n return product_ids;\n }\n }\n if(google_tag_manager[\"GTM-W65JLWM\"].dataLayer.get('ecommerce.impressions.0')){\n product_ids.push(google_tag_manager[\"GTM-W65JLWM\"].dataLayer.get('ecommerce.impressions.0.id'));\n return product_ids;\n }\n}" | |
} | |
], | |
"fingerprint": "1561711057021", | |
"formatValue": {} | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"variableId": "15", | |
"name": "js - order id", | |
"type": "j", | |
"parameter": [ | |
{ | |
"type": "TEMPLATE", | |
"key": "name", | |
"value": "order_summary.id" | |
} | |
], | |
"fingerprint": "1561711057022", | |
"formatValue": {} | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"variableId": "16", | |
"name": "js - total amount", | |
"type": "j", | |
"parameter": [ | |
{ | |
"type": "TEMPLATE", | |
"key": "name", | |
"value": "total" | |
} | |
], | |
"fingerprint": "1561711057022", | |
"formatValue": {} | |
} | |
], | |
"builtInVariable": [ | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"type": "PAGE_URL", | |
"name": "Page URL" | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"type": "PAGE_HOSTNAME", | |
"name": "Page Hostname" | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"type": "PAGE_PATH", | |
"name": "Page Path" | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"type": "REFERRER", | |
"name": "Referrer" | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"type": "EVENT", | |
"name": "Event" | |
}, | |
{ | |
"accountId": "144483319", | |
"containerId": "12164900", | |
"type": "CONTAINER_ID", | |
"name": "Container ID" | |
} | |
], | |
"fingerprint": "0", | |
"tagManagerUrl": "https://tagmanager.google.com/#/versions/accounts/144483319/containers/12164900/versions/0?apiLink=version" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var samcart_product = { | |
'name': '**PRODUCTNAME**', | |
'id': '**PRODUCTID**', | |
'price': '**PRODUCTPRICE**', | |
'category': 'Upsell', | |
'list': 'Upsell' | |
} | |
var dataLayer = window.dataLayer || []; | |
dataLayer.push({ | |
'event': 'upsell', | |
'ecommerce': { | |
'impressions': [samcart_product], | |
'detail': { | |
'actionField': {'list': 'Upsell'}, | |
'products': [samcart_product] | |
} | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment