InnerTrends Client Side Tracking
To enable the tracking of your marketing website and web application add the InnerTrends JavaScript SDK, as close as possible to the </body> tag of each page.
The library will enable by default the marketing channel attribution of the visitors that discover your marketing website.
<script type="text/javascript"> (function(w,o,d,s) { w['_itlk']="YOUR_INNERTRENDS_TOKEN"; w['_itlt']=[]; w['_itlq']=[];w['_itld']=s;w[o]=w[o]||{log:function(t,v,p){w['_itlt'].push([t,v,p])},stream:function(q){w['_itlq'].push([q])}}; var pa = d.createElement('script'), ae = d.getElementsByTagName('script')[0], protocol = (('https:' == d.location.protocol) ? 'https://' : 'http://');pa.async = 1; pa.src = protocol + 'io.innertrends.com/itl.js'; pa.type = 'text/javascript'; ae.parentNode.insertBefore(pa, ae); })(window,'_itl',document,""); </script>
Make sure to change ‘YOUR_INNERTRENDS_TOKEN’ with your unique InnerTrends token which you can find inside your Tracking Plan.
Identify logged in users and accounts
InnerTrends does not rely on cookies to track users and accounts of web applications. UX events refer to screen views and clicks that users can perform in your product web interface.
To identify your users and attribute activity correctly to them add the following code on top of your InnerTrends JavaScript SDK:
<script type="text/javascript"> var dataLayer = dataLayer || []; dataLayer.push( { "identity": { "account": { "id": "xx" }, "user": { "id": "xx" } }, "context": { "staging": "xx", "impersonating": "xx" }, "accountProperties": { "created_at": "xx" } } ); </script>
Set the following values:
- identity:
- account.id: the id of the account where the user is logged in. It can be the id of the company, team, organization or any level based on which your product accounts are organized.
- user.id: the id of the user that is logged in. It is ok to be the same as the account.id if that is the case (eg. single user per account applications)
- context:
- staging: set "true" for the staging environment. Do not set in production.
- impersonating: set "true" when your staff impersonates into user accounts. Do not set for regular user logins.
- accountProperties:
- created_at: EPOCH timestamp in UTC timezone for when the account was created
The above details will allow InnerTrends to attribute activity at both user and account level and enable cohort reporting based on account creation date.
Will InnerTrends impact your page loading speed?
The InnerTrends code loads asynchronously and is designed to have no impact on your app loading speed. In fact, you’ll see that the Google Page Speed tool reports the maximum score for a page that has our tracking code on.
How do I know if it has been installed?
Simply by checking your Network console in your browser. If the itl.js file appears loaded, it means that the job was done: