Skip to content

Add Client-side Tracking

The final step is setting up a tracking script. It requires a head tracking script between the <head></head> tags on your website, a main script after the head script, and cookie consent.

For more information about setting up a tracking script, see a tutorial in Raptor documentation.

Now, you need to add a tracker to specific places in your website where you want to track users. For example, add this tracker to the landing page template to track user entrances.

1
raptor.trackEvent('visit', ..., ...);
or purchases:

1
2
3
4
  //Parameters for Product 1
raptor.trackEvent('buy', ..., ...);
  //Parameters for Product 2
raptor.trackEvent('buy', ..., ...);

For tracking to be effective, you also need to send ID of a logged-in user in the same way. Add the user ID information by using below script:

1
raptor.push("setRuid","USER_ID_HERE")

For more information on tracking events, see the documentation.