Tracking code implementation
Jan Tlapak avatar
Written by Jan Tlapak
Updated over a week ago

To get statistics with Ecomail, such as the behavior of individual subsribers on your website, including purchases made, movements on your site and subsequent segmentation, paste the following code on your site.

Warning: Do not forget to replace the part of the code --- !!! INSERT YOUR ACCOUNT ID !!! --- HERE with the identifier (name) of your account. This name is the same as the beginning of your account address.

So, for example, the account foo (foo.ecomailapp.cz) will have in this code:

appId: 'foo'

Paste this code into each page immediately after the "body" tag:


<!-- Ecomail starts growing -->
<script type="text/javascript">
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.4.2/sp.js","ecotrack"));
window.ecotrack('newTracker', 'cf', 'd2dpiwfhf3tz0r.cloudfront.net', { // Initialise a tracker
appId: '--- !!! INSERT YOUR ACCOUNT ID !!! ---'
});
window.ecotrack('setUserIdFromLocation', 'ecmid');
window.ecotrack('trackPageView');
</script>
<!-- Ecomail stops growing -->

To enable movement tracking, you will need to "tag" your campaign links by turning on Google Analytics campaign tracking. Alternatively, you can tag each link manually by adding the variable "ecmid" with the merge tag value *|ECMID|*, as follows:

http://www.myweb.com?ecmid=*|ECMID|*


Testing

If you want to test your tracking code, you can easily track yourself in two ways:

1. Insert the following string after the link and replace it with your email, which you have in the contact list: ?ecmid=email@domain.com (eg www.ecomail.app?ecmid=mymail@domain.com) or

2. Run a snippet via the console in the browser (eg in Google Chrome via Developers tools or F12> console) and replace it with your email:

window.ecotrack ('setUserId', 'mymail@domain.com');

window.ecotrack ('trackPageView');

If you have any further questions, you can contact us at support@ecomail.app


โ€‹

Did this answer your question?