LogoLogo
Support
Front End Tracking
Front End Tracking
  • Introduction to front-end tracking
  • Setup guide
    • Prerequisites
    • FHR activities
    • XO Search activities
    • XO Recommendations activities
  • Implementation guide
    • SDK
    • Google Tag Manager
    • REST API
  • Identities
    • User object
    • Working with identities
  • Activities
    • Activity object
    • View
    • Click
    • Add to cart
    • Remove from cart
    • Purchase
    • Custom actions
  • AI Scores
    • Setup
    • Usage
  • Best practice
  • Data handling
  • Acronyms and abbreviations
Powered by GitBook

Copyright @ 2024 Crownpeak Technology, Inc. All rights reserved.

On this page
  1. Activities

Add to cart

Track add-to-cart actions to measure conversion rates. Send a new event for each distinct product added, including product, quantity, and variant details.

PreviousClickNextRemove from cart

Last updated 3 months ago

This section is relevant for both FHR and XO customers.

Add to cart actions are used to calculate add to cart (or add to basket) conversion rates. Although typically restricted to a , this action may be performed in a range of contexts.

Whenever a user adds a product to a cart (or basket) you should send an add-to-cart event.

You should send a new add-to-cart event for each distinct product, even if they are added to cart as part of the same action.

Properties

{
    "action":"add-to-cart",
    "target": {
        "product":"product-id"
    },
    "sourceId": "source-id",
    "metadata": {
        "quantity": 1,
        "variant": "variant-id"
    }
}
Property
Context
Description

action

All

Must be specified as "add-to-cart"

target.product

All

The ID of the product that was added to cart; must be identical to the product ID used in FHR/XO

metadata.quantity

All

The quantity of the product added to cart

sourceId

All

The ID that associates the FHR or XO response with the event; i.e. response ID

metadata.*

All

Additional information, such as context or locale

metadata.query

The add-to-cart event is triggered on search results

The search terms that generated the viewed search results

metadata.variant

All

The ID of the product variant that has been added to the cart; must be identical to the variant ID used in FHR/XO

You should only include a source ID if the page the event is triggered on is powered by FHR or XO.

PDP