Skip to content

Instantly share code, notes, and snippets.

@ju1
Last active March 16, 2021 09:28
Show Gist options
  • Save ju1/b3c80f1c18e4f02925e6196dcd17b25b to your computer and use it in GitHub Desktop.
Save ju1/b3c80f1c18e4f02925e6196dcd17b25b to your computer and use it in GitHub Desktop.
Full Facebook Recipe for Google Tag Manager: Track Likes, Comments, and when messages are sent.
{
"exportFormatVersion": 2,
"exportTime": "2018-01-03 11:28:31",
"containerVersion": {
"path": "accounts/1164259306/containers/7512550/versions/0",
"accountId": "1164259306",
"containerId": "7512550",
"containerVersionId": "0",
"container": {
"path": "accounts/1164259306/containers/7512550",
"accountId": "1164259306",
"containerId": "7512550",
"name": "Facebook Full Recipe",
"publicId": "GTM-THD2G5G",
"usageContext": [
"WEB"
],
"fingerprint": "1505132552952",
"tagManagerUrl": "https://tagmanager.google.com/#/container/accounts/1164259306/containers/7512550/workspaces?apiLink=container"
},
"tag": [
{
"accountId": "1164259306",
"containerId": "7512550",
"tagId": "1",
"name": "GA - Social - Social Interaction",
"type": "ua",
"parameter": [
{
"type": "BOOLEAN",
"key": "overrideGaSettings",
"value": "true"
},
{
"type": "BOOLEAN",
"key": "doubleClick",
"value": "false"
},
{
"type": "BOOLEAN",
"key": "setTrackerName",
"value": "false"
},
{
"type": "BOOLEAN",
"key": "useDebugVersion",
"value": "false"
},
{
"type": "TEMPLATE",
"key": "trackType",
"value": "TRACK_SOCIAL"
},
{
"type": "TEMPLATE",
"key": "socialAction",
"value": "{{dlv - socialAction}}"
},
{
"type": "BOOLEAN",
"key": "enableLinkId",
"value": "false"
},
{
"type": "TEMPLATE",
"key": "socialActionTarget",
"value": "{{dlv - socialTarget}}"
},
{
"type": "TEMPLATE",
"key": "socialNetwork",
"value": "{{dlv - socialNetwork}}"
},
{
"type": "TEMPLATE",
"key": "trackingId",
"value": "{{YOUR_GA_TRACKING_ID}}"
}
],
"fingerprint": "1505132535409",
"firingTriggerId": [
"5"
],
"tagFiringOption": "ONCE_PER_EVENT"
},
{
"accountId": "1164259306",
"containerId": "7512550",
"tagId": "2",
"name": "cHTML - Facebook Button Listener",
"type": "html",
"parameter": [
{
"type": "TEMPLATE",
"key": "html",
"value": "<script>\n \tFB.Event.subscribe('edge.create', function(targetUrl) {\n \twindow.dataLayer = window.dataLayer || [];\n\twindow.dataLayer.push({\n 'event': 'socialInteraction', \n 'socialNetwork': 'Facebook', \n 'socialAction': 'Like', \n 'socialTarget': targetUrl\n });\n});\n \n \tFB.Event.subscribe('comment.create', function(commentResponse) {\n\tvar commentUrl = commentResponse.href;\n\twindow.dataLayer = window.dataLayer || [];\n\twindow.dataLayer.push({\n\t\t'event': 'socialInteraction', \n\t\t'socialNetwork': 'Facebook', \n\t\t'socialAction': 'Comment', \n\t\t'socialTarget': commentUrl\n\t});\n});\n \n FB.Event.subscribe('message.send', function(message) {\n\twindow.dataLayer = window.dataLayer || [];\n\twindow.dataLayer.push({\n\t\t'event': 'socialInteraction', \n\t\t'socialNetwork': 'Facebook', \n\t\t'socialAction': 'Message', \n\t\t'socialTarget': message\n\t});\n});\n</script>"
},
{
"type": "BOOLEAN",
"key": "supportDocumentWrite",
"value": "false"
}
],
"fingerprint": "1505132005601",
"firingTriggerId": [
"6"
],
"tagFiringOption": "ONCE_PER_EVENT"
}
],
"trigger": [
{
"accountId": "1164259306",
"containerId": "7512550",
"triggerId": "5",
"name": "Custom - socialInteraction",
"type": "CUSTOM_EVENT",
"customEventFilter": [
{
"type": "EQUALS",
"parameter": [
{
"type": "TEMPLATE",
"key": "arg0",
"value": "{{_event}}"
},
{
"type": "TEMPLATE",
"key": "arg1",
"value": "socialInteraction"
}
]
}
],
"fingerprint": "1505131413008"
},
{
"accountId": "1164259306",
"containerId": "7512550",
"triggerId": "6",
"name": "Pageview - Window Loaded",
"type": "WINDOW_LOADED",
"fingerprint": "1505131413008"
}
],
"variable": [
{
"accountId": "1164259306",
"containerId": "7512550",
"variableId": "1",
"name": "dlv - socialAction",
"type": "v",
"parameter": [
{
"type": "INTEGER",
"key": "dataLayerVersion",
"value": "2"
},
{
"type": "BOOLEAN",
"key": "setDefaultValue",
"value": "false"
},
{
"type": "TEMPLATE",
"key": "name",
"value": "socialAction"
}
],
"fingerprint": "1505131413008"
},
{
"accountId": "1164259306",
"containerId": "7512550",
"variableId": "2",
"name": "dlv - socialNetwork",
"type": "v",
"parameter": [
{
"type": "INTEGER",
"key": "dataLayerVersion",
"value": "2"
},
{
"type": "BOOLEAN",
"key": "setDefaultValue",
"value": "false"
},
{
"type": "TEMPLATE",
"key": "name",
"value": "socialNetwork"
}
],
"fingerprint": "1505131413009"
},
{
"accountId": "1164259306",
"containerId": "7512550",
"variableId": "3",
"name": "dlv - socialTarget",
"type": "v",
"parameter": [
{
"type": "INTEGER",
"key": "dataLayerVersion",
"value": "2"
},
{
"type": "BOOLEAN",
"key": "setDefaultValue",
"value": "false"
},
{
"type": "TEMPLATE",
"key": "name",
"value": "socialTarget"
}
],
"fingerprint": "1505131413009"
}
],
"builtInVariable": [
{
"accountId": "1164259306",
"containerId": "7512550",
"type": "PAGE_URL",
"name": "Page URL"
},
{
"accountId": "1164259306",
"containerId": "7512550",
"type": "EVENT",
"name": "Event"
}
],
"fingerprint": "0",
"tagManagerUrl": "https://tagmanager.google.com/#/versions/accounts/1164259306/containers/7512550/versions/0?apiLink=version"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment