The Base Tag
Overview
This code should be placed on all your website's pages, and must have <account token>
replaced by the relevant account token.
<script>
(function() {
var script = document.createElement("script");
script.type = "text/javascript";
script.async = true;
script.src = "//d2hkbi3gan6yg6.cloudfront.net/visscore.tag.min.js";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(script, s);
})();
window.vscr = window.vscr || [];
vscr.push(["setAccount", "<account token>"]);
</script>
Contact support if you don't have an account token.
The Cubed tag offers functionality out of the box to help make tagging easier.
For example if you'd like to have bettery First Party Cookie tracking we offer that ability via our setServer
functionality.
Or, if you have Cubed on 2 different domains and want to do Cross Domain Tracking - allowing you to track users going from one site to the other - you can use our built in End Points
function.
Lastly, to help categorise visit's into specific channels (ie SEO, PPC, etc..) we allow taggers to use our Forward Parameters
. This will check the landing page query string and pull any configured parameters and append to the tag fire.
Once the base tag is loaded and configured, we can start adding page specific data to the tag before it's fired to the Cubed servers.
The Cubed tag will only fire when it is told to do so, via the fire
command:
window.vscr = window.vscr || [];
vscr.push(["fire"]);
The fire
command must be triggered post the base tag, in order to send the base tag to our servers.
Set Account
This function must be called every time the page loads the Cubed tag. This is used to set the account for which this visit belongs to.
window.vscr = window.vscr || [];
vscr.push(["setAccount", "<account token>"]);
First Party Cookies
For an overview of the Cubed Cookies please review our Cookie Section.
In order to allow Cubed the ability to store cookies in a first-party manner, we may request a client setup a subdomain to point at our Data Collection Servers (data.withcubed.com). This means we can fire our tag at (for example) cubed.client.com, which will then process the data at data.withcubed.com, but be allowed to set cookies on client.com. For this to work the tag needs setServer called, and setCookiesOnServer to be true. Both functions will need to be called every time the base tag is loaded - along with Set Account.
Syntax for setting the server and cookie functionality:
vscr.push(["setServer", "cubed.client.com"]);
vscr.push(["setCookiesOnServer", true]);
Note
Do not set this unless the server name has been created.
Set Server
This allows the tag to be fired to a different URL. By default our tag fires to the server: "data.withcubed.com". It is possible to setup Data Collection Servers (DCS) at any URL. Use this function if you wish to change that.
Syntax for setting the server:
vscr.push(["setServer" , "Server Address"])
Note
Do not set this unless the server name has been created.
Cross Domain Tracking
To allow tracking across different domains, we offer the ability to append both Visitor and Visit tokens to a site's anchor links, which we call End Point(s).
For example if you have the Cubed tag on both www.mywebsite.com
and www.mysite.co.uk
, you may want to track people going across. When you add an End Point
, our tag attempts to find all matching anchor links with this URL in their href and it will append our query parameter "ydat"
and add the visitor and visit tokens.
Syntax for setting End Points:
vscr.push(["addEndPoint" , "My website URL"])
Example
If you wanted to track a visitor going from www.mywebsite.com
to www.mysite.co.uk
, in your mywebsite.com tag you would add the End Point "mysite.co.uk". See below.
Now any link that points to mysite.co.uk
will have ydat=visitorIDvisitID
as a query parameter.
/* tag loaded on www.mywebsite.com */
vscr.push(["addEndPoint" , "mysite.co.uk"])
Forward Parameters
For more information please go to our Forward Parameters Section.
In addition to capturing the standard referrer information, the CUBED Attribution product supports the capture of landing page URL parameters which can then be used to classify marketing channels. As an example, it may be a requirement to capture the my_campaign
parameter so that it can be used to further configure the referrer channels.
The syntax for using forward parameters is:
vscr.push(["addForwardParam" , "Parameter Name"])
In order to capture multiple forward parameters, you will need to repeat this step for each parameter you wish to capture, for example:
vscr.push(["addForwardParam", "custom_param"])
vscr.push(["addForwardParam", "another-param"])
Simulate
We also offer the ability to set our tag to "simulate" mode - this means that whatever data is sent up to our servers as a payload will be ignored. This can be used for testing purposes to ensure that a tagged site is capturing all of the necessary data without actively tracking hits from a site under test conditions. This can be achieved quite simply using the following code:
vscr.push(["setSimulate", true])
And to turn off testing mode:
vscr.push(["setSimulate", false])