Introduction
Vuture’s Web Tracking module allows you to add a tracking code to your non-Vuture websites that connects the journey of a contact who clicks a Vuture email link, with their journey on those sites.
Previously we could only record visits to pages that contained the tracking code but an enhancement now allows you to also track links clicked to external websites and downloads of attachments like PDFs.
To implement this update there are two requirements:
- Ensure your instance has the latest version of Vuture’s web tracking. Check this with your CSM.
- Update the tracking code used by adding the following JavaScript to every page and calling triggerVutureTracking on initial page load. We recommend using Google Tag Manager for this.
Note: PDF and external links (links beginning with https) are being tracked by the code below, but you could add other file types yourself if you wish.
Important: In the code below, replace {TrackingUrl} with your back-end Vuture URL.
This is usually in the format company.vuture.net or company.vuturevx.com
You can check this by looking at the URL when logging into your Vuture instance.
/**
* Replace link.vutu.re below with your back-end Vuture URL
* This is usually in the format company.vuture.net or company.vuturevx.com
* It is the domain you see when on the Vuture login screen
*/
function triggerVutureTracking(url, referrer) {
var tracking_image = document.createElement('img');
tracking_image.setAttribute('src', "https://{TrackingUrl}/security/tracker.gif?url=" + encodeURIComponent(url) + "&referer=" + encodeURIComponent(referrer));
}
/**
* On the initial 'init' page load, please call this function
*/
triggerVutureTracking(document.location.href, document.referrer);
/**
* Event bubbling: Find all clicks on links and process
*/
document.addEventListener('click', function (event) {
if (event.target.tagName === 'A') {
var href = event.target.getAttribute('href');
if (href.endsWith('.pdf'))
triggerVutureTracking(href, document.location.href);
if (href.startsWith('https://';))
triggerVutureTracking(href, document.location.href);
}
});
/**
* A meta tag should be implemented that allows the full
* document.referrer to be sent on the initial page 'init'
* otherwise we will just receive the domain name
*
* <meta name="referrer" content="no-referrer-when-downgrade" />
*
*/
Note: There is one instance of the word referrer in the code above with a single r, spelled referer. This is for historic reasons and should be left as it is; it is not a mistake.