Documentation
APICreate a Ticket
  • 📔Documentation Guide
  • 📨Data & Engagement Platform
    • Data Model
      • Customer Data
      • Product Catalogue
      • Events
        • Onsite Events
        • Outbound Events
        • Transactions
    • App User Management
      • User Roles
      • App Users
    • Data Management
      • Data Management with API
      • Data Management with Data Feeds
        • Users
          • Import Users
          • Update or Delete a User Trait via File Upload
          • List of Standard User Traits/Attributes
        • Products
        • Events
          • Import Orders
          • Import Events
          • List of Events and Properties
      • Data Export
    • Web Tracking
      • Web Tracking v1 (Legacy)
        • Setup
        • Set up business Units
        • Tracking User Behavior
          • Identify Method
          • Page Method
          • Track Method
          • Opt-Out from Tracking
        • Testing & Debugging
      • Web Tracking v2
        • Setup using Google Tag Manager
        • Setup without a Tag Manager
        • Configuration & Config Commands
        • Tracking User Behavior
          • Identify Method
          • Update Method
          • Page Method
          • Track Method
          • Opt-Out from Tracking
        • Testing & Debugging
      • Migrate Tracking SDK v1 -> v2
      • Mobile Web Tracking
    • User Segmentation
      • Creating a Segment
      • Conditions
      • Combining Segments
    • Messages
      • Frequency Capping
      • Templates
        • Template Builder
      • Integrations
        • Channels
          • SMS
            • Twilio
              • Set up a Twilio Account
              • Set up Twilio Integration
              • Create a Campaign Message
            • Link Mobility
              • Set Up Link Mobility Account
              • Set up Link Mobility Integration
              • Create a Campaign Message
          • SFTP
            • Set up SFTP Integration
            • Create a Campaign Message
          • Direct Mail
            • Optilyz
              • Set up Optilyz Integration
              • Create a Campaign Message
          • Webhooks
            • Single Webhook
              • Set up Webhook Integration
              • Create a Campaign Message
              • Response Data and Custom Events
            • Batch Webhook
              • Set up Batch Webhook Integration
              • Create a Campaign Message
            • Zenloop via CrossEngage Webhook
              • Set up Zenloop Integration (via CrossEngage Webhook)
              • Set up Zenloop Survey
              • Create a Campaign Message
              • Set up Zenloop Survey via ESP
              • Obtain Response Data
            • Google Analytics via Webhook
          • Segment Transfer
            • Facebook
              • Set up Facebook Developer Account
            • Optimizely
              • Set up Optimizely Account
            • Google Analytics
              • Set up Google Analytics Integration
              • Create a Campaign with Google Analytics
              • Using the Google Analytics Integration
            • Airship
              • Set up an Airship Account
              • Set up an Airship Integration
              • Create a Campaign Message with Airship
          • Onsite Display
            • Trbo
              • Set up Trbo Integration
              • Create a Campaign Message in CrossEngage
              • Configure Campaign Message in Trbo
              • Obtain Response Data
          • Email
            • Mailjet
              • Set up Mailjet Integration
              • Obtain Response Data via Webhook
              • Create a Campaign Message
              • Personalize Preview Texts in Mailjet
            • Mandrill (by MailChimp)
              • Set up Mandrill Integration
              • Obtain Response Data via Webhook
              • Create a Campaign Messege
            • Inxmail
              • Set up Inxmail Integration
              • Create a Campaign Message
            • Sendgrid (by Twilio)
              • Set up SendGrid Integration
              • Obtain Response Data via Webhook
              • Create a Campaign Message
            • Mailgun
              • Set up Mailgun Integration
              • Obtain Response Data via Webhooks
              • Create a Campaign Message with Mailgun
            • Episerver (Optimizely)
              • Set up Episerver Integration
              • Create a Campaign Message with Episerver
          • Push Notifications
            • Airship
              • Set up an Airship Account
              • Set up an Airship Integration
              • Create a Campaign Message with Airship
        • Attachments
        • Delete an Integration
      • Personalization
        • Import Data
          • User Profile Data
          • Campaign Data
          • Cart Data
        • Formatting Functions
          • Date Formatting
          • Number Formatting
          • String Formatting
          • Hash Functions
        • General Helper Functions
          • Conditional Functions
          • Filtering Arrays
        • Product Helper Functions
          • Fetch from Product Feed
          • Fetch from Tracking Event
          • Fetch from User Journey
        • Misc. Helper Functions
          • Voucher Helper Function
            • Vouchers: Use Case
          • Event Helper Functions
          • Opt Out Helper Functions
        • Operators
      • Vouchers
        • Creating Vouchers
        • Using Vouchers
    • Campaign Management
      • Campaigns
        • Create an Audience Campaign
        • Create a Real-Time Campaign
        • Control Group
      • Stories
        • Building a Story
        • Use Case: Welcome Story
      • Segment Transfer
        • Create a Segment Transfer Campaign
    • Consent Management
      • Subscription/Consent Management
      • System Opt-Out/Opt-In
      • System Blacklist/Whitelist
    • Prediction Models
      • Create a new Model
      • Feature Engineering
      • SQL Filter
    • System Monitoring
      • Dashboard
        • Segment Tracker
      • Events Overview
      • Activity Log
      • Slack Notifications
        • Setting up Slack Notifications
    • Help & Support
      • System Status
      • Reach out to Customer Support
      • Suggest an Improvement
      • Privacy Policy
    • Glossary - Data & Engagement
  • 📈Predictions Platform
    • Data Model
      • Customer Data
      • Transactions
      • Activities
    • Overview
      • Data Tab
        • Data Tables in the Predictions Platform
      • Insights Tab
      • Model Builder Tab
        • Feature Engineering
        • Custom SQL Filter
        • Model Report
      • Prediction Tab
      • Selections Tab
    • Tutorials
      • Prepare and Validate Data
      • Analyze RFM Customers
      • Create a new Model
      • Predict Campaign Profit
    • Glossary - Predictions
Powered by GitBook
On this page
  • Overview
  • Implementation
  • Sending custom events
  • Use cases
  1. Data & Engagement Platform
  2. Web Tracking
  3. Web Tracking v2
  4. Tracking User Behavior

Track Method

Overview

The track method is used to track any user behaviour as event. You may track any behaviour that you would like to use to segment users in CrossEngage to use for campaigns. These can be anything from page views, completing purchases, viewing the cart, adjusting delivery preferences to changing a products' colors in an onsite configurator.

The track method has the following structure:

ce('track', 'Added Product', { 'sku':'E12371'});

Method Parameters

Value

Type

Description

eventName

string

The name of the event your are sending to CrossEngage.

attributes

object

Object that contains information about the event, see examples below.

Implementation

Standard CrossEngage events

CrossEngage offers a range of predefined events which you can call without requiring any further event definition.

Viewed Product

A user views a specific product on your website:

var attributes = {     
    'sku': '46493-32',     
    'name': 'Uno Card Games',     
    'price': 300.00,     
    'currency': 'USD',     
    'category': 'Games' }; 

ce('track','Viewed Product', attributes);

Added Product / Removed product

A user adds a product or removes a product from their cart:

var attributes = {   
  'sku': '16493-37',     
  'name': 'Uno Card Games',    
  'price': 300.00,     
  'currency': 'USD',     
  'category': 'Games' ,    
  'cart': {        
    'products': [            
      {                
      'sku': '45790-32',                 
      'price': 200,                 
      'name': 'Monopoly 3rd Edition',                 
      'category': 'Games',                 
      'currency': 'USD'            
      },             
      {              
      'sku': '65112-30',                 
      'price': 149.99,                
       'name': 'Catan',                
      'category': 'Games',                 
      'currency': 'USD'            
      }        
    ]    
  }};
  
ce('track','Added Product', attributes);
ce('track','Removed Product', attributes);

For all product-related events containing the cart object, the full current state of the cart should be passed, as the information in CrossEngage will be overwritten with each such event. The cart object itself is not customisable, meaning no custom attributes (like cart.cartId) can be added. Custom attributes can be added on the event's root level.

In addition, thesku of the respective product should be provided on the top (root) level of the event data for all product-related events. This allows using this data with Product Feed events (Product Back/Low In Stock, Product Price Increased/Reduced) in real-time campaigns.

Searched Products

A user uses a search bar to look for products on your shop:

var attributes = {  
    'searchTerm': 'board games',  
    'productsDisplayed': 10
    };

ce('track','Searched Products', attributes);

Completed Order

A user completes a purchase.

For each product in the products array, CrossEngage will trigger an additional event namedOrdered Item. This event can be used to easily segment users that have purchased a particular item.

Note that sku is mandatory for each product in the products array.

var attributes = {  
    'orderId': '50314b8e9bcf000000000000',  
    'total': 47.68,  
    'shipping': 4.5,  
    'tax': 19,  
    'discount': 5,  
    'coupon': 'hasbros',  
    'currency': 'USD',  
    'cart': {    
        'total': 40.49,    
        'currency': 'EUR',    
        'products': [        
            {          
            'sku': '45790-32',          
            'name': 'Monopoly: 3rd Edition',          
            'price': 29.50,          
            'quantity': 1,          
            'category': 'Games'        
            },{          
            'sku': '46493-32',          
            'name': 'Uno Card Game',          
            'price': 10.99,          
            'quantity': 2,          
            'category': 'Games'        
            }]  
        }};

ce('track','Completed Order', attributes);

Sending Completed Order via Feed is recommended for historical event. Once your historical orders have been added to our system, Completed Order event is mostly done via API.

Viewed Cart

A user views their cart anywhere on your site. You can trigger this either on loading the full cart page or even a cart overlay that is triggered from the navigation bar.

var attributes = {  
    'cart': {    
        'total': 40,    
        'currency': 'EUR',    
        'products': [			
            {			  
            'sku': '12351920', 			  
            'name': 'Stiletto Shoes', 			 
            'price': 20, 			  
            'quantity': 2			
            }]  
        }};
ce('track','Viewed Cart', attributes);

Sending custom events

The CrossEngage web tracking library allows you to also send custom events through the track method. To send custom events, please contact your dedicated Customer Success manager so that they can define these events and their properties for use within the CrossEngage platform.

To make it easier for us to prepare the events for you, please send your Customer Success manager the structure of the event in the following format:

{
'Custom Event Name': 
    {        
    'property 1 name': string,        
    'property 2 name': boolean
    }
}

The formats supported by CrossEngage are the following:

  • string

  • integer

  • float

  • datetime

  • array

  • object

Use cases

A user makes a purchase

Using the Completed Order predefined CrossEngage event structure, call the track method with the entire cart object, including all products in the cart at the time of purchase.

When a Completed Order event is sent to CrossEngage, it will automatically trigger an Ordered Item event for each of the products in the cart to allow you to easily segment users ordering particular products of a specific category or a within a specific price range.

To segment all users that have completed orders, create a segment condition filtering Completed Order events. You may also use the event property cart.total with the operator greater than to additionally segment users that have completed an order over a given value.

A user views a cart overlay from the navbar of your site.

Using the Viewed Cart predefined CrossEngage event structure, call the track method with the entire cart object.

It is recommended that you send all products in the cart and all available product information to ensure that you gather all relevant data for segmentation purposes.

To segment all users that have viewed their cart, create a segment condition filtering Viewed Cart events. You may also use the event property cart.total with the operator greater than to additionally segment only users viewing carts over a given amount.

A user changes the color of a shoe in an onsite configurator.

Contact your dedicated Customer Success manager and define a custom event called, for example, Colour Changed with a structure as per below:

{    
'Colour Changed': 
    {        
    'colour': string,        
    'category': string,        
    'shoeSize': integer,        
    'imageUrl': string    
    }
}

Once receiving confirmation that the event is ready for use, you may now call the track method with a payload similar to the one below:

var attributes = {  
    'colour': 'red',  
    'category': 'shoes',  
    'shoeSize': 36,  
    'imageUrl': 'https://www.crossengage.io/images/catalog/product/stiletto.jpg'
    };
ce('track','Colour Changed', attributes);

To segment all users that have changed their shoe color in an online configurator, create a segment condition filtering Colour Changed events with the property category using the equals operator with the value shoes.

Consider sending all the information that is relevant as this may be used for message personalization.

PreviousPage MethodNextOpt-Out from Tracking

Last updated 2 years ago

📨