The tracking script records visits to your website and their campaign tags, then links the visitor to a contact when they send a form or place an order. The result is a customer journey on each contact and visitor figures in campaign reports. This page explains what the script does in the browser and what it sends, for the developer who adds it to a site. Setting up sites on the screen is covered in Tracking.
Before you start
- Tracking is available when your plan includes Tracking and customer journey. Your plan may limit how many sites you can track.
- An owner or administrator adds the site: open Tracking in the sidebar and add the site's name and domain. Visits are accepted from that domain and its subdomains.
- Each site has a key of 32 hexadecimal characters, written here as
SITE_KEY.
Add the script
The Tracking screen shows the exact line to paste under Add this line to your site header. It is one script tag that loads this address asynchronously:
https://rutbacrm.com/t/SITE_KEY.js
Put it in the head of every page. On WordPress, use your theme's header settings or a plugin that adds code to the header. The file is cached by browsers for an hour, so a change of consent setting can take up to an hour to reach returning visitors.
Consent
By default a site requires consent: the script loads but does nothing until your consent banner calls crmConsent(). An owner or administrator can turn this off for a site with Stop requiring consent, which should only be done after legal advice.
| Function | What it does |
|---|---|
crmConsent() |
Records consent in a first-party cookie, crm_consent, and starts tracking on this page |
crmWithdraw() |
Deletes the crm_consent and crm_vid cookies from the browser. On a site that requires consent, nothing is sent from the next page on. On a site that does not, the next page starts again with a new visitor ID |
Call crmConsent() from the accept button of your banner, and crmWithdraw() from the place where visitors change their mind. When the visitor's browser sends Do Not Track or Global Privacy Control, the script does nothing at all, and both functions do nothing either.
What the script does
Once allowed, on every page load the script:
- Reads or creates a random visitor ID and keeps it in the first-party cookie
crm_vidfor 180 days. - Sends a
pageviewevent. - Sends a
purchaseevent when the page address containsorder-received/followed by an order number, which is the WooCommerce thank-you page. - Adds a hidden
crm_vidfield to any form on the page that posts to a website form address, so the new contact is linked to the visits. See Form submissions.
What is sent and stored
Events are sent to https://rutbacrm.com/t/SITE_KEY as a small JSON body:
| Key | Meaning | What is kept |
|---|---|---|
v |
The visitor ID, a random UUID | As is |
e |
pageview or purchase |
As is |
u |
The page address | The path only, up to 300 characters. The query string is dropped |
r |
The referring page | The host name only, and only when it is another site |
s, m, c |
utm_source, utm_medium and utm_campaign from the page address |
Up to 120 characters each. The medium is kept only from the visitor's first event |
o |
The order number, for purchase |
Up to 60 characters |
k |
Ad click identifiers, sent only when the page address has gclid, gbraid, wbraid or fbclid, or the browser has Meta's _fbc cookie |
See below |
Ad click identifiers
k is an object with these keys, each null when absent:
| Key | Source | What is kept |
|---|---|---|
g, gb, wb |
gclid, gbraid and wbraid from the page address |
One Google click, the first valid of the three in that order, with its type |
f |
fbclid from the page address |
A Meta click |
fbc |
Meta's _fbc cookie |
With the Meta click. Without the cookie, a value is built from fbclid the way Meta documents |
fbp |
Meta's _fbp cookie |
With the Meta click, when there is one |
An identifier must be 6 to 255 letters, digits, _, - or ., and a cookie must look like fb., a digit, a timestamp and a value, such as fb.1.1700000000000.AbCd; anything else is ignored. Each click is kept once, however many pages of the visit carry it, and joins the visitor's contact when the visitor is linked. The cookies are read only when they already exist: the script never sets Meta's cookies. How the clicks are used is in Advertising.
The visitor's IP address, page text, form contents and other address parameters are never stored. The source, medium, campaign and outside referrer of a visitor's first event are kept as where they first came from, even when that event had none. Later events keep only their own source and campaign.
Send a purchase event yourself
If your store is not WooCommerce, its thank-you page has another address and the script will not see the purchase. You can send the event from that page yourself, after consent, with the visitor ID the script stored:
(function () {
var match = document.cookie.match('(?:^|; )crm_vid=([^;]*)');
if (!match) { return; }
var body = JSON.stringify({
v: decodeURIComponent(match[1]),
e: 'purchase',
u: location.origin + location.pathname,
o: 'ORDER_NUMBER'
});
navigator.sendBeacon('https://rutbacrm.com/t/SITE_KEY', body);
})();
Replace ORDER_NUMBER with the same order ID or number your store sends in its store events. The visitor is linked to the order's contact only when:
- exactly one store order in your company has that ID or number,
- the order was placed within the 24 hours around the purchase event, in either order of arrival, and
- the order's contact has not been erased.
A visitor that is already linked to a contact stays linked to it.
Rules for the collection address
| Rule | Detail |
|---|---|
| Origin | The request's Origin header must be the site's domain or one of its subdomains. Requests without it, such as from a server, are ignored |
| Size | The body must be at most 4096 bytes |
| Visitor ID | Must be a lower-case UUID |
| Events | Only pageview and purchase |
| Per address | 240 events a minute for each site. IPv6 addresses are counted together by their first 64 bits |
| New visitors | 600 new visitors a minute for each site |
| Answer | 204 with no body, whether the event was kept or ignored. Only more than 1200 requests a minute from one address to the collection address answer 429 |
Because the answer does not change with the event, you cannot tell from it whether an event was kept. Check the Tracking screen instead. Events for a site that is turned off, or a plan without the feature, are not stored.
Good to know
- The script needs no other library and does not slow the page: it loads asynchronously and sends with the browser's beacon.
- The visitor ID is random and cannot identify a person on its own. It only becomes useful when the same browser sends a form or makes a purchase.
- Visitors are not merged across devices or browsers.
- Heat maps, session recordings and email open tracking are not part of tracking.
Troubleshooting
| Problem | What to check |
|---|---|
| No visits appear | Consent is required and your banner never calls crmConsent(). Or the site's domain on the Tracking screen does not match the address visitors use |
| Visits appear, but no customer is linked | Purchases are only seen on WooCommerce thank-you pages. Send the purchase event yourself, or use a website form, which links through crm_vid |
| Your own visits never appear | Your browser sends Do Not Track or Global Privacy Control |
Last updated 2026-11-08