Add tracking¶
The final step is setting up a tracking script that identifies visitors and records their interactions. You can set it up in two ways:
Tracking with built-in Raptor tracking functions¶
If your project uses the Raptor connector, use the built-in Raptor tracking functions. This recommended approach supports both client-side and server-side tracking, handles cookie consent, and sets the tracking cookie required for anonymous user segmentation.
For setup instructions, see Raptor tracking functions.
Manual setup¶
If you aren't using the Raptor connector, you can set up tracking manually.
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 manually, see 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 | |
1 2 3 4 | |
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 of logged-in users by using below script:
1 | |
For anonymous visitors, Raptor's tracking script automatically sets an rsa cookie that uniquely identifies the visitor, without calling the setRuid method.
For more information on tracking events, see the documentation.