Skip to main content

Data requirements for common use cases

Guidance on the optimum configuration for specific visitor behaviors and actions.

The scenarios below map the calls you make through the Dotdigital Tag to real campaigns, so marketers and developers can work from the same reference during setup. Each scenario explains why the data matters for the campaign it powers, then lists the calls and attributes you should implement.

Further documentation

For the reasoning behind each individual call, see Dotdigital Tag API: when, where and why.
​
For the full technical reference covering every call and attribute, see the Developer Hub documentation.


First-time visitor browses products, doesn’t add to cart

Why it matters

A visitor who browses but doesn't buy is one of your best recovery opportunities: you already have their attention. To send an abandoned browse campaign, Personalization needs to know which products they viewed and who they are.

The browsing data comes from ddg.productBrowse and ddg.productList. The visitor data comes from ddg.identify: without it, the session is still stored against an anonymous record and can personalize their next visit, but there's no contact to send a campaign to.

Data to track

1. Track home page and category page views and any other pages the shopper visits

Call the relevant page-specific tracking call, or window.ddg.track(), for the pages the user has visited.

Required attributes:

Attribute

Examples

url

title

“Homepage” or “Men’s clothing”

pageType

“1” (Homepage) or “3” (product_list)

For product pages, call window.ddg.productBrowse()

Required attributes:

Attribute

Description or example

Id

Unique string ID for the product, for example, “686-foundation-jacket”

sku

“686f-jacket”

name

“686 Foundation jacket”

url

imageUrl

price

69.97

currency

Currency code, for example, “USD”

categories

Array/string, for example, ["Men's Clothing", "Jackets", "Foundation"]

If variants are selectable without page reload, fire another productBrowse with updated variantId and variants (array of variant objects).

2. Identify the visitor if they enter contact information

Call: window.ddg.identify()

Required:

  • email or

  • mobileNumber

If captured firstName, lastName or fullName can all be passed as well.

Identifying the visitor is required to trigger an abandoned browse send. However, even without identifying the visitor, any session data is stored against an anonymous record in Personalization. This data will still be usable to personalize future website visits.

  • You can also include optional product fields, for example salePrice, description, brand.

  • Any additional data you want to track outside of our defined schema can be tracked as extraData.

  • Don’t send cart updates unless a product is actually added to the cart.


Visitor receives abandoned browse/cart email, returns to site and adds to cart

Why it matters

Visitors who click through from an email are automatically identified, so the hard part of scenario 1 is already done. The job now is to capture cart activity accurately, so that if they leave again without buying you can send an abandoned cart message based on what's really in their basket.

ddg.cartUpdate is critical here: without it, abandoned cart messaging, triggers, and segmentation aren't available. Make the call every time the cart changes, and keep the same cartId throughout the session so the cart, checkout, and order stay tied together.

Data to track

1. Visitor identification

Visitors are automatically identified on email click through. If our cookies are still in place, the visitor can also be tied back to their record in Personalization.

To ensure that we attribute browsing sessions as often as possible, you should call the identify method to provide contact details for the visitor whenever you have them.

Call: window.ddg.identify()

Required:

  • email or

  • mobileNumber

2. Track the product detail view

Call: window.ddg.productBrowse()

Attribute

Description or example

Id

Unique string ID for the product, for example, “686-foundation-jacket”

sku

“686f-jacket”

name

“686 Foundation jacket”

url

imageUrl

price

69.97

currency

Currency code, for example, “USD”

categories

Array/string, for example, ["Men's Clothing", "Jackets", "Foundation"]

If variant selected:

  • variantId

  • variants

3. Track cart updates when an item is added

Call: window.ddg.cartUpdate()

Required attributes:

Attribute

Description or example

cartId

Unique string for the cart, this should be the same throughout the shopping/browsing session

currency

Currency code in ISO 4217 format. Example, USD

subtotal

Subtotal cart price before taxes, shipping, discounts, etc.

grandtotal

Grand total of cart including taxes, shipping, discounts, etc.

cartUrl

products

Array of cart product objects, this includes the following for each product:

  • Id

  • sku

  • name

  • unitPrice

  • quantity

  • imageUrl

  • productUrl

Recommended attributes:

  • cartPhase (for example, "ORDER_PENDING")
    ​This is automatically tracked by the Dotdigital Tag if not specified.

  • You can also include optional cart or product fields such as shipping or discountAmount.

  • You must update cart info every time cart contents change.

  • You can track additional custom attributes with extraData.

  • No purchaseComplete event is recorded unless checkout is finalized.


Visitor receives abandoned cart campaign and completes their purchase

Why it matters

ddg.checkout tells the platform the visitor has moved from building a cart to checking out, so you can treat someone who entered shipping details a minute ago differently from someone who added an item three days ago.

ddg.purchaseComplete finalises the purchase cycle: it updates the cart phase so the visitor drops out of abandoned cart and abandoned browse messaging, and it records the order for recommendations and segmentation. Only fire it once the order is actually confirmed.

Data to track

Visitors are automatically identified on email click through, but, wherever possible, you should send the visitor's identifying information.

1. Visitor identification

Call: window.ddg.identify()

Required:

  • email or

  • mobileNumber

2. Track cart view

Call: window.ddg.cart() for cart views, window.ddg.cartupdate for changes to a cart

Required attributes:

  • cartId, currency, products (each with Id, sku, name)

  • You can also include optional cart/product fields such as subtotal, discountAmount.

3. Track start of checkout

Call: window.ddg.checkout()

Required attributes:

"ORDER_CHECKOUT" cart phase is set automatically.

Attribute

Description or example

cartId

Unique string for the cart. If the cart is the same, then this should match the cartId used for previous cartUpdate calls.

currency

Currency code in ISO 4217 format. Example, USD

subtotal

Subtotal cart price before taxes, shipping, discounts, etc.

grandtotal

Grand total of cart including taxes, shipping, discounts, etc.

cartUrl

products

Array of cart product objects, this includes the following for each product:

  • Id

  • sku

  • name

  • unitPrice

  • quantity

  • imageUrl

  • productUrl

4. Track completed purchase

Call: window.ddg.purchaseComplete()

Required attributes:

"ORDER_COMPLETE" cart phase is set automatically.

Attribute

Description or example

cartId

Unique string for the cart. If the cart is the same, then this should match the cartId used for previous ddg.cartUpdate and ddg.checkout calls

orderId

Unique string for the order.

currency

Currency code in ISO 4217 format. Example, USD

subtotal

Subtotal cart price before taxes, shipping, discounts, etc.

grandtotal

Grand total of cart including taxes, shipping, discounts, etc.

cartUrl

products

Array of cart product objects, this includes the following for each product:

  • Id

  • sku

  • name

  • unitPrice

  • quantity

  • imageUrl

  • productUrl

  • opt

  • opt can be used to provide product-level extra data, such as customisations or inscriptions.

  • You can track additional custom attributes relating to a cart, like a coupon code, through the use of extraData.

  • You must only call purchaseComplete after order payment/confirmation.

  • You must use the same cartId throughout a user session.

Did this answer your question?