Skip to main content

Migrate from legacy tracking scripts to the Dotdigital Tag

Ensure you continue to track all the data you need when upgrading to the Dotdigital Tag.

Laura Russell avatar
Written by Laura Russell
Updated yesterday

The Dotdigital Tag offers a more streamlined and future-proof way to track activity and events from your website.

If you’re currently using our legacy tracking scripts, you can migrate to the Dotdigital Tag to enable you to access the improved range of features that the Tag supports.

Use the Dotdigital Tag to power:

  • Web behavior tracking.

  • Abandoned cart and browse functionality.

  • Purchase complete tracking, with optional order Insight data creation.

  • Dotdigital Chat.

  • Extended functionality for survey and form popovers.

  • Custom events.

The Tag uses our updated methods for tracking website interactions and browsing behaviour.


1. Identify your current scripts

The first step is to check which of our legacy scripts you’re currently using on your site.

These could be:

  • Web behavior tracking

    • Extended to include abandoned browse

    • Recording custom values

  • Abandoned cart

  • Dotdigital Chat

  • Site and ROI tracking


2. Replace legacy methods

Before you start

You must configure your Dotdigital Tag for the website domains you want to track.

Web behavior tracking

The legacy web behavior tracking script can be replaced in it’s entirety by the Dotdigital Tag.

The legacy WBT script looks something like this:

(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);
};
})(window, document, '//static.trackedweb.net/js/_dmptv4.js', 'script', 'dmPt');
// Initialize Dotdigital tracking
window.dmPt('create', 'DM-SAMPLE-01');
// Track page view or default event
window.dmPt('track');

This can be removed and replaced with the Dotdigital Tag:

<script src="https://r1.ddlnk.net/DM-1111111111-01/ddgtag

This Tag is an example only. You must use the Tag as generated in your Dotdigital account.

Abandoned cart and browse

To implement abandoned cart and browse with the Tag, you need to remove the legacy scripts, and add the new scripts using our updated tracking methods to all the relevant pages of your site. The additional scripts must be added after the Dotdigital Tag.

Custom values

The legacy method to track custom data allowed you to pass key-value pairs in a customised version of the WBT script.

With the Dotdigital Tag, you can instead implement custom event tracking for your site.

Chat

If you’re using, or want to use, Dotdigital Chat, you can choose to include the Chat script when you configure the Dotdigital Tag.

Once the Tag is ready to be published on your site, you can remove the separate Chat script, if you’re using it already.

The Chat script looks something like this:

<script>
window._ddgChatConfig = {
apiSpace: '1a2abc34-ab12-1a2b-ad2a-1234ab56c789',
urlBase: 'https://webchat.dotdigital.com'
};
(function(d, s, id){
var js, cjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = 'https://webchat.dotdigital.com/widget/bootstrap.js';
cjs.parentNode.insertBefore(js, cjs);
}(document, 'script', 'ddg-chat-widget'));
</script>

Site and ROI

The Dotdigital Tag doesn’t directly include the site and ROI tracking scripts and features, as these have been superseded by web behavior tracking and Advanced revenue attribution, which allow for more detailed data to be passed into Dotdigital to be used in reporting, automation, segmentation, personalisation and more.

If you want to make use of these more up-to-date features, then you can remove the site and ROI scripts and deploy the Tag. If you aren’t already passing order data into Dotdigital in any other way, you can configure the Tag to create order Insight data from tracked purchaseComplete events.

Otherwise, you can retain the site and ROI tracking scripts alongside the Dotdigital Tag.

Learn more about Direct and Advanced revenue attribution models in Revenue attribution.

Did this answer your question?