Tracking issues from redirect


(Matt Haag) #1

Good day…

Odd thing has been happening on my site with my desired functionality.

  1. We send email from platform with urls
  2. Urls go thru redirect link that has script that will append an ID value.
  3. User redirected to landing page where Matomo Custom Dimension code installed.
  4. Here is the odd part. When I test it, I can track as expected, but when actual email recipients click thru on url in the body of the email, they aren’t being tracked. I can tell this because we have another email click tracking mechanism in place.
  5. Any thoughts/suggestions as to what’s happening and/or how/where I could go to troubleshoot would be greatly appreciated.
  6. Sample tracking link that would be included in email message:

http://www.trk-gsd.info/email/l/aHR0cDovL2Jsb2cuY2xvc2UuaW8vaWRlYWwtY3VzdG9tZXItcHJvZmlsZQ==/BiI3TJbHEl1ec8KhD9q2BiLCanhf7rWL

  1. Sample code on my landing page:
<script type="text/javascript">
function $_GET(param) {
	var vars = {};
	window.location.href.replace( location.hash, '' ).replace( 
		/[?&]+([^=&]+)=?([^&]*)?/gi, // regexp
		function( m, key, value ) { // callback
			vars[key] = value !== undefined ? value : '';
		}
	);

	if ( param ) {
		return vars[param] ? vars[param] : null;	
	}
	return vars;
}

var prospect_id = $_GET('ref_id');
if(prospect_id){
var _paq = window._paq || [];
  / tracker methods like "setCustomDimension" should be called before "trackPageView" /
  

  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//getsimpledata.com/analytics/";
    
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '1']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
  })();
_paq.push(['trackPageView', window.title, {dimension1: prospect_id}]);
}else{
    var _paq = window._paq || [];
  / tracker methods like "setCustomDimension" should be called before "trackPageView" /
  
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//getsimpledata.com/analytics/";
    
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '1']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
  })();
}
</script>