Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Chris Beardsley
Added: Jun 7, 2018 8:00 AM
Modified: Jun 8, 2018 6:29 AM
Views: 30
Tags: no tags
  1. function(){
  2.   var topLevelDomain = window.location.hostname.split('myDomain.')[1];
  3.   var countryParameter = window.location.pathname.split('/')[1];
  4.   if(topLevelDomain == 'com'){
  5.     if(countryParameter == 'us'){
  6.       return 'UA-2332505-10';
  7.     }
  8.     else if(countryParameter == 'eu'){
  9.       return 'UA-2332505-16';
  10.     }
  11.     else if(countryParameter == 'au'){
  12.       return 'UA-2332505-13';
  13.     }
  14.   }
  15.   else if(topLevelDomain == 'se'){
  16.     return 'UA-2332505-5';
  17.   }
  18.   else if(topLevelDomain == 'no'){
  19.     return 'UA-2332505-11';
  20.   }
  21.   else if(topLevelDomain == 'dk'){
  22.     return 'UA-2332505-6';
  23.   }
  24.   else if(topLevelDomain == 'de'){
  25.     return 'UA-2332505-12';
  26.   }
  27.   else if(topLevelDomain == 'fi'){
  28.     return 'UA-2332505-18';
  29.   }
  30.   else if(topLevelDomain == 'co.uk'){
  31.     return 'UA-2332505-8';
  32.   }
  33. }