Documentation
Documentation (JA)
Documentation (JA)
  • Documentation
  • Products
    • Fanplayr Targeting Portal
    • Fanplayr 360
    • PrivacyID
    • SiteSpeed
  • Features
    • Merchandising
    • Security
    • SMS
    • Web Push Notifications
      • Direct Integration Guide
      • Popup Integration Guide
      • Imaging Sizing Guide
    • Data Residency
  • Fanplayr Targeting
    • E-Commerce Integrations
      • BigCommerce
      • CommerceV3
      • Magento 1
        • Getting Started
        • Configuration
      • Magento 2
      • Miva Merchant
      • PrestaShop
      • Salesforce Commerce Cloud
      • Shopify
      • Volusion
      • VTEX
      • VTEX IO
    • Custom Integration
      • Page tracking
        • Apply to cart
        • Session offers
      • Order tracking
      • Data types
        • CartAction
        • Product
      • Data Layer API
      • Enhanced user identification
        • Manual Integration
      • Segmentation as a service
      • Lazy loading
      • Page caching
      • Tag managers
      • Single page apps
      • Custom data for verticals
        • Travel
    • Pixel Integration
    • ESP Integrations
    • Link Decoration
    • User Management
      • User Identity
      • User Properties
  • Other
    • CSP & Domains
Powered by GitBook
On this page

Was this helpful?

  1. Fanplayr Targeting
  2. Custom Integration
  3. Data types

CartAction

This is a special variable that determines how Fanplayr will treat cart-related data for the current user or order tracking call. It can be used to carry forward cart details (total value in cart, products in cart etc) from the previous page view if they are unavailable for the current tracking call.

If you do not have access to the contents of the cart, or getting the contents of the cart at each page view is expensive on server resources, then you can use cart actions to have our server handle this information for you. Simply add a cartAction as follows:

{
  accountKey: 'your_account_key',
  data: {
    // ...
    cartAction: '' <or> 'repeat' <or> 'add' <or> 'subtract' <or> 'set'
  }
}

For “add”, “subtract” and “set” the following will happen:

  • Start with the last tracked cart details.

  • Ignore all current cart details, except for products.

  • Do the specified action

  • Recalculate the totals of the cart based on the merged details.

Action

Description

Undefined or "override"

Default behavior. The server will override cart details with any data set on this request.

"repeat"

The server will use the previous pages cart details.

"add"

Add the current cart products to the last tracked products. Any products with the same id will have their quantities added together.

"subtract"

Subtract the current cart products from the last tracked products. Any products with the same id will have their quantities subtracted from each other and any products with resulting quantities that are zero or below will be removed.

"set"

For each previously tracked product, replace all details of any product with a matching id of current products being tracked. Products that do not already exist will be added.

PreviousData typesNextProduct

Was this helpful?