{"_id":"560dbc768e6f870d004e3e6a","project":"560c93ad7e9b9d0d00ca81a2","version":{"_id":"560c93ae7e9b9d0d00ca81a5","project":"560c93ad7e9b9d0d00ca81a2","__v":9,"createdAt":"2015-10-01T02:00:14.709Z","releaseDate":"2015-10-01T02:00:14.709Z","categories":["560c93af7e9b9d0d00ca81a6","560c9d9399bb5a0d0044f220","560d76d899bb5a0d0044f307","560d76ee1ec45619006069ed","560d86e099bb5a0d0044f32e","560dba80373c0e0d0024ff3b","57c722ecdf19130e001fba5d","57c743d1b6f94a2200659903","58995ec083f743190077bbe2"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"560dba80373c0e0d0024ff3b","pages":["560dbc6677c8940d001c3bcd","560dbc768e6f870d004e3e6a","560f171e83e4100d00a9851f","56a1574444f3d80d00a2c398"],"project":"560c93ad7e9b9d0d00ca81a2","version":"560c93ae7e9b9d0d00ca81a5","__v":4,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-10-01T22:58:08.137Z","from_sync":false,"order":2,"slug":"setup-guides","title":"Alternate Event and Revenue Tracking"},"user":"560c92f2ac2859170013faa3","__v":10,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-10-01T23:06:30.033Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"Google Tag Manager (GTM) is a tool for injecting snippets of code onto a website based on rules that you set in the [GTM app](https://tagmanager.google.com/).  The basic concept for the Attribution integration is that we want to inject the main attribution snippet on every page, one time, right when that page is loaded.  We want to inject event calls when something like a signup or a purchase happens.  We want to inject identify calls on every page where a user is logged in. That's it. \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"1. Inject the Attribution snippet on every page\"\n}\n[/block]\nThe first thing we want to do is inject the main attribution snippet on every page, one time, right when that page is loaded. To do this we will click to create a new tag, and select \"Custom HTML Tag\".  Then, paste the code from your [Attribution settings](https://dashboard.attributionapp.com/#!/settings).\n\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/fCF6O20ASwegN4uK8aV7_attribution-tag.png\",\n        \"attribution-tag.png\",\n        \"1936\",\n        \"1610\",\n        \"#380f1c\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nYou will want to make sure that the code is triggered on all pages.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Tag Firing Priority\",\n  \"body\": \"This tag has to be fired before any other Attribution tags. In order to do this, you'll need to assign it a \\\"Tag firing priority\\\" of greater than 0. Tags with higher numbers for priority will be fired first.\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"GTM uses a noscript IFrame to allow for scriptless tracking. However, this is generally only used by bots. In order to ignore these bot events, and keep your data clean, we advise wrapping all Attribution code snippets in an if statement:\\n\\n```javascript\\n<script type=\\\"text/javascript\\\">\\n  if (document.location.href.search('gtm-msr.appspot') == -1) {\\n    /* Attribution code here */\\n  }\\n</script>\\n```\\nAlthough, this is not shown in the screenshots, it should be added to all tags.\",\n  \"title\": \"Robot Proofing\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Fire an Attribution conversion event on a Thank You page\"\n}\n[/block]\nNext we will want to fire a conversion event to let Attribution know a meaningful event occurred.  We will cover a case where a specific page, like a thank you page, signifies a conversion.  We will create a tag containing the javascript for a [track call](https://attribution.readme.io/docs/track).\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/CcsFn5I3TOyJozM2xmJC_conversion_tag.png\",\n        \"conversion_tag.png\",\n        \"1922\",\n        \"1112\",\n        \"#365b5a\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nNext we want to fire that tag on the thank you page.  To do this, we create a trigger for the url of our thank you page. \n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/THwUbHc2Rr2QaKoICdfK_thank_your_trigger.png\",\n        \"thank_your_trigger.png\",\n        \"1932\",\n        \"916\",\n        \"#3c80b2\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nNow GTM will your conversion event on the thank you page.","excerpt":"","slug":"google-tag-manager","type":"basic","title":"Google Tag Manager"}

Google Tag Manager


Google Tag Manager (GTM) is a tool for injecting snippets of code onto a website based on rules that you set in the [GTM app](https://tagmanager.google.com/). The basic concept for the Attribution integration is that we want to inject the main attribution snippet on every page, one time, right when that page is loaded. We want to inject event calls when something like a signup or a purchase happens. We want to inject identify calls on every page where a user is logged in. That's it. [block:api-header] { "type": "basic", "title": "1. Inject the Attribution snippet on every page" } [/block] The first thing we want to do is inject the main attribution snippet on every page, one time, right when that page is loaded. To do this we will click to create a new tag, and select "Custom HTML Tag". Then, paste the code from your [Attribution settings](https://dashboard.attributionapp.com/#!/settings). [block:image] { "images": [ { "image": [ "https://files.readme.io/fCF6O20ASwegN4uK8aV7_attribution-tag.png", "attribution-tag.png", "1936", "1610", "#380f1c", "" ] } ] } [/block] You will want to make sure that the code is triggered on all pages. [block:callout] { "type": "info", "title": "Tag Firing Priority", "body": "This tag has to be fired before any other Attribution tags. In order to do this, you'll need to assign it a \"Tag firing priority\" of greater than 0. Tags with higher numbers for priority will be fired first." } [/block] [block:callout] { "type": "warning", "body": "GTM uses a noscript IFrame to allow for scriptless tracking. However, this is generally only used by bots. In order to ignore these bot events, and keep your data clean, we advise wrapping all Attribution code snippets in an if statement:\n\n```javascript\n<script type=\"text/javascript\">\n if (document.location.href.search('gtm-msr.appspot') == -1) {\n /* Attribution code here */\n }\n</script>\n```\nAlthough, this is not shown in the screenshots, it should be added to all tags.", "title": "Robot Proofing" } [/block] [block:api-header] { "type": "basic", "title": "Fire an Attribution conversion event on a Thank You page" } [/block] Next we will want to fire a conversion event to let Attribution know a meaningful event occurred. We will cover a case where a specific page, like a thank you page, signifies a conversion. We will create a tag containing the javascript for a [track call](https://attribution.readme.io/docs/track). [block:image] { "images": [ { "image": [ "https://files.readme.io/CcsFn5I3TOyJozM2xmJC_conversion_tag.png", "conversion_tag.png", "1922", "1112", "#365b5a", "" ] } ] } [/block] Next we want to fire that tag on the thank you page. To do this, we create a trigger for the url of our thank you page. [block:image] { "images": [ { "image": [ "https://files.readme.io/THwUbHc2Rr2QaKoICdfK_thank_your_trigger.png", "thank_your_trigger.png", "1932", "916", "#3c80b2", "" ] } ] } [/block] Now GTM will your conversion event on the thank you page.