There are a number of helpful functions included in our Javascript that automatically make tracking more reliable.
Below we'll explain these. To turn any of these helper functions off you can embed different fluxOptions
on your page, as described here.
URL Rewriting
When your page loads and a view is tracked, our JS will resolve a visitor ID and current node ID for the visitor.
This information is vital to tracking as it says who the visitor is and exactly what node they are on.
One of our helper functions then rewrites your current URL to add ...&vid=VISITOR_ID&n=CURRENT_NODE_ID
Now, if you reload the page, your existing session is made clear to the JS.
If you click on links to go to a new page, the referrer sent in that request now includes the visitor ID and the node that the user came from.
If you find the URL rewriting bothersome, or it causes issues/conflicts, you can set urlRewrite: false
in fluxOptions
.
Link Rewriting
Much like our URL rewriting, we also scan the page for links - <a>
elements - and update their href
attribute.
This search goes through all <a>
elements and it will update those that:
- Have
/action/
in thehref
attribute - Have the attribute
data-lum="action"
added to the<a>
element
This rewriting is the most critical for tracking as it directly tells the tracker the visitor ID and referring node ID when you click, removing all reliance on cookies/referrer.
Without it, the tracker needs to fall back on less reliable methods to keep track of the current session.
Like with other functions, you can disable this in fluxOptions
by setting actionLinkRewrite: false
.
Meta Tag Updating
Lastly, on loading the page we scan and check for the existence of the <meta name="referrer">
tag.
If present we update its content to no-referrer-when-downgrade.
If absent, we add <meta name="referrer" content="no-referrer-when-downgrade">
.
This tag tells the browser what policy to use for passing referrer to outgoing requests. We want to pass full referrer to the tracker to help with understanding where clicks come from.
By default, Chrome and most browsers now truncate referrer, making repeat clicks troublesome to track.
Additionally, in our link rewriter above, we also add a referrerpolicy
attribute to the links directly, giving multiple places where we try to ensure full referrer passing to the tracker action links.
This helper function is not very disruptive and at the moment it is not able to be disabled in fluxOptions
.