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
  • Send all relevant activities
  • Include as much information as possible
  • Always include the source ID if available
  • Store and keep sending the session ID
  • Send and update users identities on log in/log out

Best practice

Details to be aware of when using the Crownpeak front-end tracker for optimal usage.

PreviousUsageNextData handling

Last updated 3 months ago

Send all relevant activities

Whenever a user performs an action on your platform that falls within the list of supported actions, you should send an activity. While in theory you may choose to send only some actions, failing to track all actions can lead to incomplete or inaccurate analytics.

Include as much information as possible

The metadata of the activity object can contain valuable contextual information that enhances analytics.

For example:

  • Adding a metadata.orderId property with the order ID allows you to -into specific orders.

  • Adding the segments property to the activity object allows for analytics based on different tags such mobile vs desktop, or Chrome vs Safari.

  • through the user.traits and user.segments properties allows for analytics based on user groups.

Always include the source ID if available

The contains the sourceId field. The field is not mandatory as it's not necessary for every type of action. However, this doesn't mean that you should omit it. You should always add the source ID to the activity object if it is available.

Store and keep sending the session ID

As soon as a user lands on your platform, a session ID is generated for the user. This can be done automatically via the library, or by you. The next time the user connects, the allows us to identify them.

If you handle it yourself, you need to store the session ID in a cookie or equivalent storage.

If you use the library, the session ID will be stored in local storage on the user's browser.

Send and update users identities on log in/log out

When the user logs in you should add their logged in ID that you have in your system (such as an ecommerce ID) to the information sent in the activity object. While you can also only keep using the anonymous session ID, we recommend that you also send over the known logged in ID. This allows for the user behavior tp be tracked across multiple devices.

When the user logs out, you should clear the logged in ID and no longer send it. You should also generate a new session ID. This is done automatically when using the SDK.

activity object
session ID
Adding information around the user
group purchased items