After registering, this guide will be customized for your account; please do not install the snippets below.

JS Quickstart

The quickest way to get started is to install the JavaScript client using the two snippets below. Want help? Let us know and we'll even do the install for you.

1

Send Pageviews

Place this snippet in your site template so that it is included in every page. Also add it to 3rd-party sites that may be hosting your pages, such as WordPress, Hubspot, etc.
Copy & paste this snippet exactly as it appears.

<!-- Start Attribution.io Snippet -->
<script>
!function(){var t=window._attio=window._attio||[]
t.methods=["setAccount","debug","pageview","event","identity","load","linkDomain","autoRun", "honorDNT"],t.factory=function(e){return function(){return a=Array.prototype.slice.call(arguments)[0]||{},a.command=e,t.push(a),t}};for(var e=0;e<t.methods.length;e++){var n=t.methods[e];t[n]=t.factory(n)}t.load=function(t){var e=document.createElement("script");e.type="text/javascript",e.async=1,e.src="https://cdn.attribution.io/client.js.gz";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)
}
window._attio.setAccount({public_key: 'REPLACE_THIS_VALUE'});
window._attio.load();
}();
</script>
<!-- End Attribution.io Snippet -->
2

Send Events

Run these JavaScript snippets after an event/conversion has happened, such as on a confirmation page, thank you page, or success notification. Snippets for each of your event types are listed below. You must make a few small changes, as detailed below.
The pageview tracking snippet should also appear on event pages and they can be combined by putting the event line just after load().

Events

Replace the client_id with any unique ID for this user (e.g. email, user id, hash, etc.)
Replace transaction_id value with a unique ID for this event (eg order id, email).
Remove or update the optional amount and meta placeholders.

Lead Gen Snippet lead gen

<!-- Start Attribution.io Lead Gen Event Snippet -->
<script>
_attio.event({key: 'leadgen', transaction_id: 'UNIQUE_TRANSACTION_ID', client_id: 'CLIENT_ID', meta:{any: 'value'}});
</script>
<!-- End Attribution.io Lead Gen Event Snippet -->

purchase2 Snippet purchase also

<!-- Start Attribution.io purchase2 Event Snippet -->
<script>
_attio.event({key: 'PURCHASE_EVENT_KEY', transaction_id: 'UNIQUE_TRANSACTION_ID', client_id: 'CLIENT_ID', amount: 123.45, meta:{any: 'value'}});
</script>
<!-- End Attribution.io purchase2 Event Snippet -->

Registration Snippet User registers for an account

<!-- Start Attribution.io Registration Event Snippet -->
<script>
_attio.event({key: 'aad9986718703ecf', transaction_id: 'UNIQUE_TRANSACTION_ID', client_id: 'CLIENT_ID', meta:{any: 'value'}});
</script>
<!-- End Attribution.io Registration Event Snippet -->

Purchase Snippet User completes a purchase

<!-- Start Attribution.io Purchase Event Snippet -->
<script>
_attio.event({key: 'ac73be8f555ce0a4', transaction_id: 'UNIQUE_TRANSACTION_ID', client_id: 'CLIENT_ID', amount: 123.45, meta:{any: 'value'}});
</script>
<!-- End Attribution.io Purchase Event Snippet -->

Optional Identities

You can pass more information about the users identity using a dedicated identity command.
Replace the client_id with any unique ID for this user (e.g. email, user id, hash, etc.).
Update the optional meta object with any user information you'd like to pass on, such as email, account type, etc.

Identity Snippet

<!-- Start Attribution.io Identity Snippet -->
<script>
window._attio.identity({client_id: 'CLIENT_ID', meta: {name: 'ExampleName', total_orders: 4}});
</script>
<!-- End Attribution.io Identity Snippet -->