📌Quickstart guide

Follow the Quick start guide to quickly try out and implement Crownpeak's tracking system.

Why is this needed?

To benefit from all Crownpeak's platforms capabilities, it is important to collect and unify the right data from every touch point of the Shopper journey. Through Crownpeak's platforms, you will be able to learn more about the behavior of your users, how changes you make to your website affect their behavior, and how to provide the best shopping experience. To begin the process you need to start sending activities.

What activities do you need to track and when should you send them?

ActivityWhen to triggerMandatory

Click

When a user clicks on a product.

Click on Search Result

When a user clicks on a product from an SRP.

View

When a user views a PDP.

View on Search Result/Navigation

When a user views a product directly from an SRP/PLP.

Add to Cart

When a user adds a product to their cart directly from a PDP page.

Add to Cart on Search Result/Navigation

When a user adds a product to their cart directly from an SRP/PLP.

Remove from Cart

When a user removes a product from their cart.

Purchase/Buy

When a user purchases an item. (These must be sent per item within an order).

What does the general flow look like?

Once a customer triggers an action detailed above, the activity should be sent to Crownpeak, utilising one of the implementation methods available.

If you have AI Scores as part of your features, once enabled you will be able to utilise the cluster a customer is assigned to.

Sending your first activity

Before you begin you should have a tracker key provided to you by Crownpeak. Once you do, you can continue with this guide. Your tracker key is a unique UUID used by our service to identify the environment you're sending events to, so they arrive at the right place. You would usually have a tracker key for every different version of your website (for different markets).

An activity is an object which represents an action(such as a view) made by an anonymous visitor or an identified visitor on a target(such as a product).

There multiple ways you can send activities corresponding on your use case. You can read more on the different implementations below.

pageTracking Implementation Methods

Let's send your first activity. As part of this quickstart guide we will cover use of the JavaScript SDK and the REST API.

To install the SDK through NPM, add the xo-js client to your dependencies, or add the script from the CDN.

npm install --save @attraqt/xo-js

Important! The xo-js library is used for both XO and FHR. Even though the code snippets mention xo **in the variables, they work just as well for FHR.**

Our package is written in TypeScript and natively supports it.

Assuming you have your tracker key ready, if we want to register a view action on a product with the id 123, we need to execute the following JavaScript snippet using the SDK, or make the following API Call:

// First, import the library
const xo = require('@attraqt/xo-js');

// Next, you have to initialize the SDK with your tracker key
xo.init({activity: {trackerKey: '30cbb5fc-375f-4cf2-8efd-ed86d909718e'}});

const myActivity = {
  "action": "view",
  "target": {
    "product": "123"
  },
  "user": {
    "identities": {
      "sessionId": "2ee80450-28ed-11eb-adc1-0242ac120002"
    }
  }
};

// Then, use the send() method of the SDK
xo.activity.send(myActivity);

The activity

The action field represents the action the user performed, or in this case, a view on a product. The target object covers the details of the target of the action(view), or in this case a product with id 123. The user object contains the identities, or in this case, the session id.

This simplified activity contains very little information. As a general rule, the more information you can provide, the better results you'll get out of the analytics and all the features Crownpeak offers. You can read more on the activity object below.

Identities

In order to be able to perform analytics on the actions of Shoppers, you need to be able to distinguish users of all the events you send. This way, you would be able to link different actions a Shopper makes (clicks, purchases etc.) to better understand their behaviour, and improve their shopping experience. This is where identities management comes in.

At least one identity - session id - is needed to be able to send events to our tracking system. More information on managing identities available below.

pageManaging identities

Response

If your integration is correctly configured, you should receive a successful 201 response! In case there is something wrong with your tracker key or the SDK/endpoint, you will receive an error message and you should contact Crownpeak for further assistance.

Next steps

If you got the example from this quick-start guide working, you can move onto the next sections of this documentation.

Last updated