Implementation without GTM
This manual describes how to implement Roivenue Measurement in your web that does not use Google Tag Manager.
Legal Notice
The following tracking script sets cookies into the users device. It tracks data which may be used for marketing optimization, content optimization or user segmentation. In some legislations the user needs to make an explicit consent before this code can be legally executed on his or her device.
As we only act as a data processor, you are responsible for obtaining consent in accordance with applicable legislation. If our tracking script gets activated and you have not complied with the applicable rules in obtaining user consent, you may be at risk of sanctions for which we are not responsible
Prerequisites
Property ID - You will need this to set up your script correctly. Contact your account manager to obtain it.
Visits tracking on all pages
Insert this entire code on every page inside
<head> </head>
element.
Adjust the
property_id
- insert the ID you have from your account manager.
Start Tracking Events
To start tracking events, call the
startMeasurement
function of the global$rm
object:
Tracking events will start only after you call the startMeasurement
function. This allows you to evaluate user consent with cookies first and start tracking events only after that.
When script above is included, and $rm.startMeasurement();
is called, it automatically tracks page views and page leave events. The script will automatically track traffic source information from HTTP referrer and UTM parameters, device type and other useful information.
After tracking script is initialized (by code snippet above), custom events can be then tracked by calling capture()
function of $rm
global object (see Conversion Tracking section for an example).
Disabling measurement
Once measurement has been started by calling $rm.startMeasurement()
it is enabled and captures all events. Measurement can then be stopped by calling $rm.stopMeasurement()
.
$rm.stopMeasurement();
Calling this method disables measurement and no further events will be captured even when calling $rm.capture()
or $rm.identify()
.
Configuration of Consent and Anonymous Tracking
The startMeasurement
function has an optional parameter which is a configuration object.
Persistence
The persistence
option allows you to specify how user data is stored in the browser. The persistence
option can have one of the two values:
persistence: "localStorage+cookie"
(default): Cookies are used in this casepersistence: "sessionStorage"
: Stores everything insessionStorage
, cookies are not used.
If you have a full consent from your website visitor, we recommend using the default settings of
persistence
.When there is a limited consent with tracking, you should set up
persistence
tosessionStorage
To completely exclude user from tracking, the
startMeasurement
function should not be called at all.
When a user changes his consent with cookies at any point, this change can be passed to Roivenue Measurement using setConfig
function. This function has a single parameter which is a configuration object with the same structure as in startMeasurement
function.
setConfig
function can be called only after startMeasurement
function has been called.
An example of calling setConfig
to set the persistence to a cookie:
As we only act as a data processor, you are responsible for setting up the Roivenue Measurement in line with applicable legislation in your country.
Additional Settings for Anonymous Tracking with Multiple domains
This section is relevant only to businesses which have a site splitted into multiple domains. It means some sort of split like: shop.example.com and then checkout.example.com and your customers are automatically redirected between those subdomains as they shop. If you are not using subdomains this way, skip this part and continue to Conversions Tracking
You need to configure a property in the
rm_config
objectwrite_cross_domain_info
- By default, it is set tofalse
,change it totrue
The session id will be inserted into the URL of the current web page and will be passed as a referrer URL to subsequent web pages.
You need to insert a following meta tag for referrer policy into the source web page:
<meta name="referrer" content="no-referrer-when-downgrade" />
This step makes it possible to pass the full URL in the referrer URL.
The destination web page automatically reads the session id from the referrer URL.
The destination web page automatically reads the session id from the referrer URL.
Conversions Tracking
Next, we need to capture all conversions created by your customers.
To do that, call capture conversion to track an e-commerce purchase event:
User Identification
This step is optional
We can use User ID to track users across devices. This ID is typically available only for users which logged in on your website.
Whenever the user logs in or makes a purchase that you are able to connect with a unique user identifier, call this:
The User ID should not be a personal sensitive information. For privacy protection reasons it is recommended to use an artificial identifier or a hash.
Additional Changes for Single Page Applications
Most e-commerce solutions use standard navigation between pages and you can skip this section. But if your website is a javascript single page application, then there need to be some changes.
Set the
rm_config.autocapture
tofalse
on all pages.To track pageviews, call capture function after every navigation (when page location changes):
Last updated