Add Web behavior tracking to your Shopify store

Harness your customers' and prospects' activity on your website.

Gareth Burroughes avatar
Written by Gareth Burroughes
Updated over a week ago

We store data collected from the Web behavior tracking script in an Insight data collection called Webinsights. This data captures your customers' 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, powering programs, and sending abandoned cart campaigns.


Web behavior tracking installation

There are two methods you can use to install Web behavior tracking on your Shopify store:

  • Automatic installation (Recommended)

    This is done by simply mapping an abandoned cart program to your Shopify store from your Dotdigital account.

  • Manual installation

    This is done by creating a Web behavior tracking profile and adding the Web behavior tracking script to your Shopify store.


Automatic installation

Mapping a program automatically installs code on your connected Shopify store to enable Web behavior tracking, abandoned cart, and abandoned browse functionality.

Map an abandoned cart program

  1. In Dotdigital go to Connect > Shopify and find the heading Abandoned cart.

  2. Expand the Enrol abandoned carts to drop-down menu and choose an abandoned cart program from the list.

    The program does not have to be active.

  3. Select SAVE.

That’s it!


Manual installation

To manual install Web behavior tracking on your Shopify store:

1. Create a Web behavior tracking profile

To set up your Web behavior tracking profile and get your unique ID:

  1. In Dotdigital, expand the User menu and select Settings

  2. Go to Access > Web behavior tracking.

  3. Select NEW PROFILE.

  4. For Name, enter a name for your profile. This can be anything you want, but make it recognisable.

  5. For Website domains, enter each domain you want to add the tracking script to. You can add a maximum of 15 unique domains. You must exclude https://www – for https://www.example.com, just enter example.com.

  6. Select CREATE.

  7. If you want to use Abandoned cart on your store:

    1. Toggle the Track abandoned carts switch to active.

    2. If you want to enable abandoned carts for guests, toggle the Enable guest carts switch to active.

  8. Copy your Unique ID. You need this in the next step of setup.

  9. Select SAVE.

2. Add the Web behavior tracking script

To add our Web behavior tracking script to your Shopify store:

  1. In Shopify admin, go to Sales channels > Online Store > Themes.

  2. Expand the Actions drop-down menu, then select Edit code.

    shopify-edit-code.png

  3. Under Layout, select the file theme.liquid.

  4. Before the </head> tag, paste the following code and embed it between <script>...</script> tags:

    var dm_insight_id ='uniqueID';(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, '//static.trackedweb.net/js/_dmptv4.js', 'script', 'dmPt');
  5. Replace the placeholder uniqueID in the code with your Web behavior tracking profile ID. This is the ID you copied in Step 1.8. You must retain the quotation marks.

  6. 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:

  1. Send yourself an email campaign that includes a link to your store.
    To learn how, check out the Email basics section of the Help Centre. This must be a live send, test sends do not track browsing sessions.

  2. Open the link from the email, and browse a few pages of your store.

  3. Wait one hour, then, in Dotdigital, go to Audience > Contacts.

  4. Find and select the contact you sent the campaign to.

  5. On their Single customer view, select the Insight data tab, expand the collection type drop-down menu and select Webinsights. You can select an individual record from the left side to view it.

Did this answer your question?