Installing Web Behavior Tracking


Creating your Web Behavior Tracking profile
Basic implementation
Manual page tracking implementation
Custom values implementation
User identification implementation


Web Behavior Tracking has a few variations of code that you can install on your site depending on the requirements you have, or your technical ability.

Most users install our basic implementation as this is the least time consuming and simplest to get going. If you're ever in doubt or don't fully understand the other options available then it's best to use the basic implementation.


The implementation code given below must be wrapped within <script></script> tags, otherwise the code won't work.

Creating your Web Behavior Tracking profile

Once you've purchased Web Behavior Tracking as an add-on to your account, you'll be able to create your unique tracking profiles which can then be added to any website page where you'd like to gather browsing insights.

Follow these steps to create a profile:

1. Click on the person-and-cog icon in the bottom left-hand corner of the screen to produce the settings menu and select Access


2. Click on the Web behavior profiles tab and then click New profile or Create on now.


3. Enter a name for your profile, for example 'Main website', as well as up to 15 unique website domains where this code might be placed. These website domains don't need to include 'http(s)://www.' 

Subdomains belonging to a specified parent domain are automatically tracked and don't need to be specified.

However, specific subdomains, such as, can be listed without their parent domain.

Only website domains that are listed under this profile will be able to send data through to your account.

Click Create once you've finished.


4. You'll now be able to see your unique ID, which relates only to this Web Behavior Tracking profile. In order to start using it to send browsing session data to your account, you'll need to copy and paste everything from the 'Tracking code' field and insert it into the head of any website page on any of the website domains specified in this profile.

Ajax/Single page
If you have a single page website, or load content via Ajax, you can change the tracking code using this option. If you're not sure which method you need, please check with your website administrator.

Track abandoned carts (applicable for our non-Magento users)
If you have a store and want to track the contents and value of abandoned carts that don't reach your checkout, you can change the tracking code using this option. After clicking 'Yes', you'll then need to click on the 'Follow these steps to complete this script's setup' link, which will take you through to our support article about setting up our abandoned carts module.

Enable guest carts (applicable for our non-Magento users)
If any visitors to your site abandon their carts and those visitors' email address aren't contacts in Engagement Cloud, you can automatically create a new contact for each visitor using this option. Selecting 'Yes' will ensure all unknown visitors to your site who abandon a cart will become Engagement Cloud contacts, and they can then be sent abandoned cart emails.

Please note when enabling abandoned carts for guests:

  • It's your responsibility to ensure you're clearly displaying the correct consent text on your site
  • We strongly recommend leaving your 'Regulatory settings' on 'Enforce double opt-in for signups from signup forms and some API methods only (default)'. If you have to enforce double opt-in for all signups, then we don't recommend using abandoned cart emails for guests as the process won't work correctly. 

Click Save once you've finished.


Basic implementation

The following code is the most basic and popular implementation of our Web Behavior Tracking code. The implementation is as simple as placing the following code on every page of your website that you wish Web Behavior Tracking to track a user's behaviour on. This process is identical to other similar tracking tools, e.g. Google Analytics.

This code can either be manually added to your site, or it is also compatible with various tag management tools such as Google Tag Manager. 

var dm_insight_id ='DM-SAMPLE-01';
(function(w,d,u,t,o,c){w['dmtrackingobjectname']=o;c=d.createElement(t);c.async=1;c.src=u;t=d.getElementsByTagName (t)[0];t.parentNode.insertBefore(c,t);w[o]=w[o]||function(){(w[o].q=w[o].q||[]).push(arguments);};w[o]('track'); })(window, document, '//', 'script', 'dmPt'); 

Manual page tracking implementation

If your site uses Ajax or is a single page website, but you would still like to notify Web Behavior Tracking that a particular page on the site has been viewed, this is also possible. Using the example code below you simply submit the 'track' value at the time you wish to notify Web Behavior Tracking of a page view.

var dm_insight_id ='DM-SAMPLE-01';
})(window, document, '//', 'script', 'dmPt');
// Adds to tracking queue whenever this is called, e.g. on start up, after ajax request etc window.dmPt('track');

Custom values implementation

As default, Web Behavior Tracking sends Engagement Cloud the following values:

  • Session start time
  • IP address
  • Agent
  • Website
  • Number of pages viewed
  • Duration
  • Page title
  • Page URL
  • Date and time of visit

If you require more data than this to truly make your segmentation or automation more effective using Web Behavior Tracking, we provide the ability to submit custom page values with each page request. Using the below code as an example, you can provide Web Behavior Tracking with a series of key/value pairs along with the default 'track' request. 

var dm_insight_id ='DM-SAMPLE-01';
})(window, document, '//', 'script', 'dmPt');
// tracks with custom key values (object with name/value pairs, only primitive types!) window.dmPt('track', { customVar: 'Hello', anotherKey: 'World' });

User identification implementation

Web Behavior Tracking's most common method of identifying a user is when a recipient clicks from one of your Engagement Cloud campaigns and goes through to you website. However, you may have ways that a user tells you their email address whilst visiting your site, e.g. a customer login form, checkout or newsletter subscribe box. Using the 'identify' method, you can submit the user's email address as they provide it to you.

var dm_insight_id ='DM-SAMPLE-01';
})(window, document, '//', 'script', 'dmPt');
// Track First (any time before, but must be done). window.dmPt('track'); // Simply specify email address window.dmPt('identify', '');

Please note

You must replace the example email address in the above code -'' - with the actual user's email address dynamically, as they provide it to you.

Have more questions? Submit a request


  • Avatar


    If a recipient of an email clicks through to and then as part of their user journey visits (which also has Web Tracking setup) will the platform track all of these visits or just the initial landing onto



  • Avatar

    Hi Jon. Thanks for your question. Yes, provided the domains are added under 'Website domains' in the 'Web behavior tracking profile page' and the Web Behavior Tracking code is added to the pages in question, visits will be tracked. You can add up to 15 unique website domains.

  • Avatar


    We need the web tracking to pull through email opt in as well for people not currently in our dotmailer address book. How is this possible, please?

  • Avatar

    Hi Gemma. Thanks for your question. Web Behaviour Tracking only works for contacts who are already in your account, and can't create new contacts (and thus aren't already in an address book) - so this isn't possible.

  • Avatar

    Neal, will this feature be added in the future? It is a shortcoming. I do hope Dotdigital steps up there game when it comes to web tracking, I really hope it will be more like your other popular marketing automation software:
    - Showing statics in a dashboard within Dotdigital (unknown people, known people, pages visited by contacts, events by contacts etc).
    - Ease of implementation, most parties for example have advanced out of the box scripts (either for GTM) or plugins for popular CMS'es and webshops.

    For me this would be a huge deal :)

  • Avatar

    Hi there, Wilco!

    Really great suggestions - thanks for those. As for future additions to Engagement Cloud, you can always check out what's up and coming by heading over to the Engagement Cloud roadmap, found here: You can submit these (much appreciated) ideas by clicking on the Feedback and ideas tab off to the right side of the screen. :-)

    Edited by Jamie Nickerson
  • Avatar

    Hi Jamie, I use the roadmap tool many times. The downside is that other users can't see submitted feedback and you don't really get any feedback on it from DD. I know the roadmap tool has a option to show submitted feedback (Ideas), I think it would be nice to have a look at what other users think...

    Sometimes I also forget which feedback I have submitted, is there someway to see all your submitted feedback!

    Edited by Wilco Wietsma
  • Avatar

    Hey Wilco,

    According to upper management, we used to have these feedback features, but due to lack of engagement, they were removed. As of right now, we don't have a spot to review what has been submitted, but if I could suggest something it would be to copy and paste your ideas into a word processing document so you can save/review all the ideas there and at any time. :-) This seems like the best solution at the present moment, until something comes along later.

    Thanks again for reaching out.