Learn how to add our Web behavior tracking script to your Shopify store.
We store data collected from the Web behavior tracking script as Webinsights. This data lets you harness your customers' and prospects' activity on your website after clicking through from one of your campaigns or browsing your store from a known Shopify customer account.
Browsing activity is captured, stored and then made available for use in creating segments, capturing visitor browsing data, and sending abandoned cart campaigns.
To learn more about Web behavior tracking, check out the article Understand Web behavior tracking.
Step 1: Create a Web behavior tracking profile
To set up your Web behavior tracking profile and get your unique ID:
- In Dotdigital, go to Settings (⋮) > Access, then select the Web behavior profiles tab.
- Select NEW PROFILE.
- For Name, enter a name for your profile.
This can be anything you want, but make it recognisable.
- For Website domains, enter each domain you want to add the tracking script to.
- Max: 15 unique domains.
https://www– for example,
- Select CREATE.
- If you want to use Abandoned cart on your store:
- On Web behavior tracking profile, switch on Track abandoned carts.
- If you want to enable guest carts, switch on Enable guest carts.
- Copy your Unique ID. You’ll need this in Step 2.
- Select SAVE.
Step 2: Add the Web behavior tracking script
To add our Web behavior tracking script to your Shopify store:
- In Shopify admin, go to Sales channels > Online Store > Themes.
- Expand the Actions drop-down menu, then select Edit code.
- Under Layout, select the file theme.liquid.
- Before the
</head>tag, paste the following code.
Make sure you embed the code between
var dm_insight_id ='uniqueID';
})(window, document, '//static.trackedweb.net/js/_dmptv4.js', 'script', 'dmPt');
- Replace the placeholder
%uniqueID%in the code with your Web behavior tracking profile ID. This is the ID you copied in Step 1.8.
- Select Save.
Check it's working
Once you've set up Web behavior tracking on your Shopify store, it can take up to one hour before you start seeing data reflected in Dotdigital.
To check you're tracking data and associating it to a contact correctly:
- Send yourself a test campaign that includes a link to your store.
To learn how, check out the article Create, test, and send an email campaign.
- Open the link from the email, and browse a few pages of your store.
- Wait one hour, then in Dotdigital, go to Email > Contacts > All contacts.
- Find and select the test contact you sent the test campaign to.
- On their contact profile, select the Insight data tab, and look for Webinsights data.