Skip to content

Instantly share code, notes, and snippets.

@shirokoweb
Last active May 5, 2018 17:04
Show Gist options
  • Save shirokoweb/0cf7e507ee0c7ff1cffed48d24f8efd9 to your computer and use it in GitHub Desktop.
Save shirokoweb/0cf7e507ee0c7ff1cffed48d24f8efd9 to your computer and use it in GitHub Desktop.
GTM recipe to fire Facebook Chat including SDK
{
"exportFormatVersion": 2,
"exportTime": "2018-05-05 17:03:25",
"containerVersion": {
"path": "accounts/2719250224/containers/8610498/versions/0",
"accountId": "2719250224",
"containerId": "8610498",
"containerVersionId": "0",
"container": {
"path": "accounts/2719250224/containers/8610498",
"accountId": "2719250224",
"containerId": "8610498",
"name": "elevageduchampdesmerles.fr",
"publicId": "GTM-NJW48BQ",
"usageContext": [
"WEB"
],
"fingerprint": "1525539507286",
"tagManagerUrl": "https://tagmanager.google.com/#/container/accounts/2719250224/containers/8610498/workspaces?apiLink=container"
},
"tag": [
{
"accountId": "2719250224",
"containerId": "8610498",
"tagId": "32",
"name": "FB - Chat",
"type": "html",
"parameter": [
{
"type": "TEMPLATE",
"key": "html",
"value": "<script>\n(function() {\n // Modify the variable values below\n var page_id = '{{FB - PageID}}';\n var ref = '';\n var theme_color = '{{FBChat - ThemeColor}}';\n var logged_in_greeting = 'Hello! Comment pouvons-nous vous aider ?';\n var logged_out_greeting = 'Hello! Nous répondons à vos questions :)';\n\n // Don't touch the code below\n var el = document.createElement('div');\n el.className = 'fb-customerchat';\n el.setAttribute('page_id', page_id);\n if (ref.length) {\n el.setAttribute('ref', ref);\n }\n el.setAttribute('theme_color', theme_color);\n el.setAttribute('logged_in_greeting', logged_in_greeting);\n el.setAttribute('logged_out_greeting', logged_out_greeting);\n document.body.appendChild(el);\n})();\n \n // Load SDK\n window.fbAsyncInit = function() {\n FB.init({\n appId : '{{FB - AppID}}',\n xfbml : true,\n version : 'v3.0'\n });\n FB.AppEvents.logPageView();\n };\n\n (function(d, s, id){\n var js, fjs = d.getElementsByTagName(s)[0];\n if (d.getElementById(id)) {return;}\n js = d.createElement(s); js.id = id;\n js.src = \"https://connect.facebook.net/fr_FR/sdk.js\";\n fjs.parentNode.insertBefore(js, fjs);\n }(document, 'script', 'facebook-jssdk'));\n</script>"
},
{
"type": "BOOLEAN",
"key": "supportDocumentWrite",
"value": "false"
}
],
"fingerprint": "1525535977903",
"firingTriggerId": [
"76"
],
"parentFolderId": "77",
"tagFiringOption": "ONCE_PER_EVENT"
}
],
"trigger": [
{
"accountId": "2719250224",
"containerId": "8610498",
"triggerId": "76",
"name": "DOM ready",
"type": "DOM_READY",
"fingerprint": "1525527800883"
}
],
"variable": [
{
"accountId": "2719250224",
"containerId": "8610498",
"variableId": "36",
"name": "FB - AppID",
"type": "c",
"parameter": [
{
"type": "TEMPLATE",
"key": "value",
"value": "XXXXXXXXXXXXXXXXXX"
}
],
"fingerprint": "1525539760506",
"parentFolderId": "77"
},
{
"accountId": "2719250224",
"containerId": "8610498",
"variableId": "35",
"name": "FB - PageID",
"type": "c",
"parameter": [
{
"type": "TEMPLATE",
"key": "value",
"value": "1502015976693899"
}
],
"fingerprint": "1525528937791",
"parentFolderId": "77"
},
{
"accountId": "2719250224",
"containerId": "8610498",
"variableId": "37",
"name": "FBChat - ThemeColor",
"type": "c",
"parameter": [
{
"type": "TEMPLATE",
"key": "value",
"value": "#2B913F"
}
],
"fingerprint": "1525529362050",
"parentFolderId": "77"
}
],
"folder": [
{
"accountId": "2719250224",
"containerId": "8610498",
"folderId": "77",
"name": "Facebook",
"fingerprint": "1525528935089"
},
{
"accountId": "2719250224",
"containerId": "8610498",
"folderId": "72",
"name": "cookie consent",
"fingerprint": "1525522486138"
}
],
"builtInVariable": [
{
"accountId": "2719250224",
"containerId": "8610498",
"type": "PAGE_URL",
"name": "Page URL"
},
{
"accountId": "2719250224",
"containerId": "8610498",
"type": "PAGE_HOSTNAME",
"name": "Page Hostname"
},
{
"accountId": "2719250224",
"containerId": "8610498",
"type": "PAGE_PATH",
"name": "Page Path"
},
{
"accountId": "2719250224",
"containerId": "8610498",
"type": "REFERRER",
"name": "Referrer"
},
{
"accountId": "2719250224",
"containerId": "8610498",
"type": "EVENT",
"name": "Event"
},
{
"accountId": "2719250224",
"containerId": "8610498",
"type": "CLICK_ELEMENT",
"name": "Click Element"
},
{
"accountId": "2719250224",
"containerId": "8610498",
"type": "CLICK_CLASSES",
"name": "Click Classes"
},
{
"accountId": "2719250224",
"containerId": "8610498",
"type": "CLICK_ID",
"name": "Click ID"
},
{
"accountId": "2719250224",
"containerId": "8610498",
"type": "CLICK_TARGET",
"name": "Click Target"
},
{
"accountId": "2719250224",
"containerId": "8610498",
"type": "CLICK_URL",
"name": "Click URL"
},
{
"accountId": "2719250224",
"containerId": "8610498",
"type": "CLICK_TEXT",
"name": "Click Text"
}
],
"fingerprint": "0",
"tagManagerUrl": "https://tagmanager.google.com/#/versions/accounts/2719250224/containers/8610498/versions/0?apiLink=version"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment