Learn about abandoned browse, the variables it uses, the script to install it, and how to use it with your stores.
Overview
The product a contact last browsed is identified in Dotdigital because we extended our web behavior tracking script. Because of the extended script and its support of custom values, you can target your contacts with email campaigns that highlight what they last browsed.
To learn more about custom values, check out the article Install Web behavior tracking.
Enable abandoned browse features
Talk to your account manager or customer service manager to enable the abandoned browse features. It might require custom JavaScript and dynamic personalisation to be enabled on your account.
Using last browsed variables
When you create a segment that contains a WebInsight data block, variables appear that are related to last browsed. The variables are:
Variable * | Type | Example |
product_name (✔️) | Text | |
product_sku (✔️) | Text | |
product_price (✔️) | Text | "290.99" |
product_url (✔️) | Text | https://snowyo.co/collections/new-style/products/nitro-fate-womens-hybrid-camber-snowboard-147cm-2018 |
product_image_path (✔️) | Text | https://cdn.shopify.com/s/files/1/0054/8716/5493/products/43b79a42-216a-4dab-8307-6fdc21a5072118Fate-147-T_1024x1024@2x.jpg?v=1531924279 |
product_specialPrice | Text | "259.99" |
product_status | Text | "In stock" |
product_categories | Text | "New Styles, Sale, Snowboards" |
product_description | Text | "..." |
product_currency | Text | "GBP" |
product_brand | Text | "Nitro" |
* ✔️ - The variable is required because it's used to power the default content in the Last browsed product block.
Set up the script
The script below extends the web behavior tracking code by including the last browsed product variables described above. Here’s an example:
<script>
/* -------------------------------------------------------
IMPORTANT!
The code below requires a developer to install and setup.
Please do not simply copy/paste this onto your website.
----------------------------------------------------------- */
// Initiate Web Behaviour Tracking (this section MUST come prior any other dmPt calls)
(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');
// Replace DM-000000000-00 with your web behaviour profile's Unique ID
// Replace test.com with the domain of your store
window.dmPt('create', 'DM-000000000-00', 'test.com');
// Setup the last browsed product
var viewed_product = {
product_name: "Name of Product",
product_url: "https://test.com/productname",
product_image_path: "https://test.com/images/product.png",
product_description: "The description of the product",
product_sku: "ABC123",
product_price: "99.99",
product_status: "In stock",
product_currency: "GBP",
product_specialPrice: "89.99",
product_categories: "Category1, Category 2, Category 3",
product_brand: "Brandname"
};
// Initiate the tracking script, pass the product object
window.dmPt('track', viewed_product);
// Replace test@test.com with the email address of the identified contact
window.dmPt("identify", "test@test.com");
</script>
Script requirements
Your script requires the following edits so it works correctly:
- Set the web behavior tracking profile ID and the domain to be tracked (see blue code).
- Complete the variables in the viewed_product object (see red code) by using your ecommerce store.
- Complete the identification event (see green code) by using the ecommerce platform with the email address of the identified contact.
This is a simplified script version. The script configuration might also include abandoned cart and guest abandoned cart.
Using abandoned browse for Magento
To use abandoned browse for Magento, make sure you're using version 4.3.0 (or higher) of our Magento to Dotdigital connector.
To use abandoned browse:
Go to Stores > Configuration > Dotdigital. Under the Tracking area, you can find the Web Behavior Tracking Profile Id. From here you can turn on the abandoned browse functionalities.