Tracking Events

Hazel -

You can track different events on the website by changing the parameter "EventType" with specific keywords. Each time you want to add a different event for Raptor to track on a given web page, it is important that you place the script on the page with the “EventType” parameter changed.

There are several options available for you to include. Descriptions of these are included in the table below. We have also added a very general example of how it should look when you have set up multiple items.


Event Types

This is a list of keyword events that must be used when implementing the tracking scripts. The keywords below go into the "EventType" parameter in the tracking script. 



This event will track every visit to a web page and product on the website. It will then place a call to raptor.trackEvent on the product page alerting us to the webpage traffic. This is the only “Eventtype” that should be placed onto the front page and category pages of your website.



The buy event is placed on the final page of a payment process when the items are finally sold. Multiple items must have separate and individual calls to our Event Tracker. Otherwise, it will only register the item or items that have a call.

In order to track multiple items, you need to add a call to raptor.trackEvent for every item on the final page of the payment flow.




Basket Events 


To track general basket events, your personal script must be included on every item or product page with the event parameter in the script registered as a "Visit" event.


The image below shows a general example of the script that should always be added:


<html>                                                            EXAMPLE
 <!-- Place the tracking script at the bottom of the body tag on all pages-->
<script type="text/javascript" language="javascript">

var rsa; //A global object for use outside the raptorLoaded function
      var raptorLoaded = function (raptor) {

raptor.initialize({ customerID: "customerID",productIdParamIndex: 2, eventTypeParamIndex: 1});
//the raptor.TrackEvent should be fired on all pages.
//On the frontpage and category pages, just use the eventtype "visit", and leave all other parameters blank

        (function (d, t) {
            var g = d.createElement(t),
                s = d.getElementsByTagName(t)[0];
            g.src = '//';
            s.parentNode.insertBefore(g, s);
        }(document, 'script'));
</body> </html>


Along with this script, there is an additional function that can be added by your developer to handle basket events. This is particularly important if you have Abandoned Basket set up on your account. To make sure that we gather all the information about what is contained in a user's basket, it is important to add this second part to the script. 


Each time a customer on your website puts an item into their basket it is usually initiated by doing an ajax call. In the portion of your script for Click-Event handlers, you can track basket events by adding a call to raptor.trackEvent. A very general example of what such an ajax add-to-basket method would look like on your webpage is available below:



//The button where you put items into the basket                    EXAMPLE
<button onclick="yourAddToBasketClickHandler(productId)">Add To Basket</button>

function yourAddToBasketClickHandler(productId) {
//Just track the event, and the productId



This addition to the script allows us to gather information about what is put into a user's basket regardless of whether or not the user chooses to click on the basket page.


If you are still having problems with Add to Basket after trying to set up these scripts and cannot add the above function, then an alternative step you can take is to use the original script for Raptor and change the "EventType" from a visit event to a basket event. Place that changed script on the actual basket page, and only on the basket page. 


Add User ID (Ruid)


Another important addition to the scripts that you should consider entering is our Ruid function. Included within the personal script that we provide for you on our website, there is a global parameter that allows you to add the Ruid function wherever you want on your script page and have it work properly.


The Ruid function is important for our personalization methods and Mailmerge product. For these to work at optimum levels, and so that Raptor can provide targeted recommendations, you must identify the users on your website whenever possible. 


You need to track the unique user ID, whether this is a user ID or email, that your email system has available when it sends emails to users. This user ID is the one that we will use to track each user’s behavior on the website. From the information we gather while tracking their movements, our methods will build up personal recommendations to send via email to the users. 


The user ID should be tracked whenever possible. When the user logs in, when the user buys, when the user clicks on a link in a newsletter, all this information will help us to better tailor the recommendations they receive. This includes implementing the Ruid function when users are signing off and checking out.


In fact, if you append the user ID to all links in the email, you can catch the user on the website, and we can track the user’s behavior all the way from the email to checkout on the website. Some websites perform a soft-login when the user clicks a newsletter. This will create much better personal recommendations for the user.


We use different methods for tracking users on your website, but when you have a user's email, you can add the user ID information by using a special method in our script featured below:




Our system will then be able to use this information as a user ID when you  perform look ups in our API or when you send mails to the user.


Please, check carefully to make sure that the scripts are put in the correct order and place when setting them up on your website.


Have more questions? Submit a request


Powered by Zendesk