When looking to track and score email clicks, we distinguish between 2 situations:

1) A click going to a website or landing page which you own, and is tracked with our website tracking script

This can be easily achieved. Make sure that the landing page has our website tracking script installed, and that you are using UTM / campaign parameters in your email links. Based on the UTM parameters, you can then score these link clicks, and report around them using tags.

2) A click going to a third party website or page that you can not track with our website tracking script (for example: PDF's, Youtube.com, partner sites, LinkedIn, etc)

This requires the setup of landing pages, where our website tracking script can be run, which will then redirect the visitor after the click to the final web page where they are sent to.

Here are the steps to follow:

  • In Salesforce Marketing Cloud, create a new Cloud Page.

  • In the html header of the Cloud Page, place the GTM code snippet (the GTM code that contains the SalesWings tracking script).

Example:

<!-- Google Tag Manager --><script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-XXXXXX');</script><!-- End Google Tag Manager -->

  • In the html footer of the Cloud Page, please add the following Javascript code snippet:

<!-- Redirect Script -->
<script>
function getUrlParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};
var redirect_url = getUrlParameter('url')
setTimeout(function(){
window.location.href = redirect_url;
}, 500); //redirect time, in miliseconds
</script>
<!-- End Redirect Script -->

  • In the email, please place the following url in the href tag of the link that needs to be tracked:

https://subdomain.domain.com/sw-redirect?url=%%=UrlEncode(‘<insert_url_to_track_here>’)=%%

Example: https://subdomain.domain.com/sw-redirect?url=%%=UrlEncode(‘https://www.google.ca’)=%%

📍 IMPORTANT NOTES:

  • The code will not track if the user has javascript disabled in their browser

  • Every Cloud Page view counts as 1 SuperMessage towards the Salesforce Marketing Cloud SuperMessage limit (limit different for each Customer)

Did this answer your question?