{"_id":"560c93b07e9b9d0d00ca81a8","link_url":"","title":"Getting Started with Attribution","type":"basic","api":{"auth":"required","params":[],"results":{"codes":[]},"settings":"","url":""},"body":"NOTE: See the Alternate Setup Guides section if you are using Segment.com, Google Tag Manager, Recurly, Stripe or Shopify.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"1. Install the Snippet\"\n}\n[/block]\nPlace this tracking code on every page of your site, anywhere on the page.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script type=\\\"text/javascript\\\">\\nwindow.Attribution=window.Attribution||[];window.Attribution.methods=[\\\"trackSubmit\\\",\\\"trackClick\\\",\\\"trackLink\\\",\\\"trackForm\\\",\\\"pageview\\\",\\\"identify\\\",\\\"group\\\",\\\"track\\\",\\\"ready\\\",\\\"alias\\\",\\\"page\\\",\\\"once\\\",\\\"off\\\",\\\"on\\\"];window.Attribution.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);window.Attribution.push(t);return window.Attribution}};for(var i=0;i<window.Attribution.methods.length;i++){var key=window.Attribution.methods[i];window.Attribution[key]=window.Attribution.factory(key)}window.Attribution.load=function(e){if(document.getElementById(\\\"attribution-js\\\"))return;var t=document.createElement(\\\"script\\\");t.type=\\\"text/javascript\\\";t.id=\\\"attribution-js\\\";t.async=true;t.src=\\\"//scripts.attributionapp.com/attribution.js\\\";var n=document.getElementsByTagName(\\\"script\\\")[0];n.parentNode.insertBefore(t,n)};window.Attribution.load();\\nwindow.Attribution.projectId=\\\"[[app:key]]\\\";\\nwindow.Attribution.page();\\n</script> \",\n      \"language\": \"html\"\n    },\n    {\n      \"code\": \"window.Attribution=window.Attribution||[];window.Attribution.methods=[\\\"trackSubmit\\\",\\\"trackClick\\\",\\\"trackLink\\\",\\\"trackForm\\\",\\\"pageview\\\",\\\"identify\\\",\\\"group\\\",\\\"track\\\",\\\"ready\\\",\\\"alias\\\",\\\"page\\\",\\\"once\\\",\\\"off\\\",\\\"on\\\"];window.Attribution.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);window.Attribution.push(t);return window.Attribution}};for(var i=0;i<window.Attribution.methods.length;i++){var key=window.Attribution.methods[i];window.Attribution[key]=window.Attribution.factory(key)}window.Attribution.load=function(e){if(document.getElementById(\\\"attribution-js\\\"))return;var t=document.createElement(\\\"script\\\");t.type=\\\"text/javascript\\\";t.id=\\\"attribution-js\\\";t.async=true;t.src=\\\"//scripts.attributionapp.com/attribution.js\\\";var n=document.getElementsByTagName(\\\"script\\\")[0];n.parentNode.insertBefore(t,n)};window.Attribution.load();\\nwindow.Attribution.projectId=\\\"YOUR_PROJECT_ID\\\";\\nwindow.Attribution.page();\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nWhen you paste the snippet, you'll need to change YOUR_APP_KEY to the project id listed in the [settings](https://dashboard.attributionapp.com/#!/settings) page.\n\nAlternatively, if you are integrated with [Segment](https://segment.com/docs/integrations/attribution/), you don't need to add the snippet at all, just enable the Attribution integration on your Segment dashboard.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"2. Identify Users\"\n}\n[/block]\n`identify` is used to link a users actions and pageviews to a recognizable name or email address. You'll need to identify whenever a user signs up or logs in. We recommend using the user ID field from your database and passing the email address in as a trait, in case a user changes their email address later on. You can pass us as many customer traits as you'd like to save.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Attribution.identify('00812938', {\\n  name: 'Bob Slydell', \\n  email: 'bob:::at:::initech.co'\\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nIf your site requires registration, also include a 'createdAt' date property so that we can tell tell the difference between new and existing customers.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"3. Track Events\"\n}\n[/block]\ntrack is used to record events. You should use this method to record each step of your conversion funnel. These events should describe the action taken in a way that would be recognizable to anyone in your company. Here's some good examples of funnel events:\n\nSAAS Funnel: Created Account, Completed Account Setup, Entered Credit Card, Purchased Subscription.\n\nShopping Cart Funnel: Added Item to Cart, Viewed Cart, Entered Credit Card, Completed Purchase.\n\nAttribution recognizes the revenue property on the track event and stores it in a special way. Here's an example of an event with the revenue property:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Attribution.track('Credit Card Charged', {\\n  revenue: '79.99'\\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nMore information can be found in our track docs\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"4. Congratulate Yourself!\"\n}\n[/block]\nThat's it! We sync data to our reporting databases every hour so it won't take long to start seeing customer data on your dashboard.","excerpt":"This page will help you get started with Attribution. You'll be up and running in a jiffy!","githubsync":"","project":"560c93ad7e9b9d0d00ca81a2","version":"560c93ae7e9b9d0d00ca81a5","link_external":false,"next":{"description":"","pages":[]},"hidden":false,"isReference":false,"order":0,"parentDoc":null,"slug":"getting-started","__v":10,"category":"560c93af7e9b9d0d00ca81a6","createdAt":"2015-10-01T02:00:16.038Z","sync_unique":"","updates":[],"user":"560c92f2ac2859170013faa3","childrenPages":[]}

Getting Started with Attribution

This page will help you get started with Attribution. You'll be up and running in a jiffy!

NOTE: See the Alternate Setup Guides section if you are using Segment.com, Google Tag Manager, Recurly, Stripe or Shopify. [block:api-header] { "type": "basic", "title": "1. Install the Snippet" } [/block] Place this tracking code on every page of your site, anywhere on the page. [block:code] { "codes": [ { "code": "<script type=\"text/javascript\">\nwindow.Attribution=window.Attribution||[];window.Attribution.methods=[\"trackSubmit\",\"trackClick\",\"trackLink\",\"trackForm\",\"pageview\",\"identify\",\"group\",\"track\",\"ready\",\"alias\",\"page\",\"once\",\"off\",\"on\"];window.Attribution.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);window.Attribution.push(t);return window.Attribution}};for(var i=0;i<window.Attribution.methods.length;i++){var key=window.Attribution.methods[i];window.Attribution[key]=window.Attribution.factory(key)}window.Attribution.load=function(e){if(document.getElementById(\"attribution-js\"))return;var t=document.createElement(\"script\");t.type=\"text/javascript\";t.id=\"attribution-js\";t.async=true;t.src=\"//scripts.attributionapp.com/attribution.js\";var n=document.getElementsByTagName(\"script\")[0];n.parentNode.insertBefore(t,n)};window.Attribution.load();\nwindow.Attribution.projectId=\"[[app:key]]\";\nwindow.Attribution.page();\n</script> ", "language": "html" }, { "code": "window.Attribution=window.Attribution||[];window.Attribution.methods=[\"trackSubmit\",\"trackClick\",\"trackLink\",\"trackForm\",\"pageview\",\"identify\",\"group\",\"track\",\"ready\",\"alias\",\"page\",\"once\",\"off\",\"on\"];window.Attribution.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);window.Attribution.push(t);return window.Attribution}};for(var i=0;i<window.Attribution.methods.length;i++){var key=window.Attribution.methods[i];window.Attribution[key]=window.Attribution.factory(key)}window.Attribution.load=function(e){if(document.getElementById(\"attribution-js\"))return;var t=document.createElement(\"script\");t.type=\"text/javascript\";t.id=\"attribution-js\";t.async=true;t.src=\"//scripts.attributionapp.com/attribution.js\";var n=document.getElementsByTagName(\"script\")[0];n.parentNode.insertBefore(t,n)};window.Attribution.load();\nwindow.Attribution.projectId=\"YOUR_PROJECT_ID\";\nwindow.Attribution.page();", "language": "javascript" } ] } [/block] When you paste the snippet, you'll need to change YOUR_APP_KEY to the project id listed in the [settings](https://dashboard.attributionapp.com/#!/settings) page. Alternatively, if you are integrated with [Segment](https://segment.com/docs/integrations/attribution/), you don't need to add the snippet at all, just enable the Attribution integration on your Segment dashboard. [block:api-header] { "type": "basic", "title": "2. Identify Users" } [/block] `identify` is used to link a users actions and pageviews to a recognizable name or email address. You'll need to identify whenever a user signs up or logs in. We recommend using the user ID field from your database and passing the email address in as a trait, in case a user changes their email address later on. You can pass us as many customer traits as you'd like to save. [block:code] { "codes": [ { "code": "Attribution.identify('00812938', {\n name: 'Bob Slydell', \n email: 'bob@initech.co'\n});", "language": "javascript" } ] } [/block] If your site requires registration, also include a 'createdAt' date property so that we can tell tell the difference between new and existing customers. [block:api-header] { "type": "basic", "title": "3. Track Events" } [/block] track is used to record events. You should use this method to record each step of your conversion funnel. These events should describe the action taken in a way that would be recognizable to anyone in your company. Here's some good examples of funnel events: SAAS Funnel: Created Account, Completed Account Setup, Entered Credit Card, Purchased Subscription. Shopping Cart Funnel: Added Item to Cart, Viewed Cart, Entered Credit Card, Completed Purchase. Attribution recognizes the revenue property on the track event and stores it in a special way. Here's an example of an event with the revenue property: [block:code] { "codes": [ { "code": "Attribution.track('Credit Card Charged', {\n revenue: '79.99'\n});", "language": "javascript" } ] } [/block] More information can be found in our track docs [block:api-header] { "type": "basic", "title": "4. Congratulate Yourself!" } [/block] That's it! We sync data to our reporting databases every hour so it won't take long to start seeing customer data on your dashboard.