Advertisement
jeffsteiger

Untitled

Jul 24th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2. *
  3. * This code helps to do cross domain tracking for both urls.
  4. *
  5. * The code will be in charge of detecting the right domain and
  6. * to fire the proper tracking code.
  7. *
  8. * REMEMBER TO REPLACE THE TRACKING CODE
  9. **/
  10.  
  11.  
  12. // Detecting domain
  13. var gaDomainDetect = document.domain;
  14.  
  15. // Firing the proper events
  16. if (gaDomainDetect == 'stem.discoveryeducation.com')
  17. {
  18.     ga('create', 'UA-12418696-1', 'auto', {'allowLinker': true});
  19.     ga('require', 'linker');
  20.     ga('linker:autoLink', ['siemensstemacademy.com'] ); // Note that here goes the other domain
  21. }
  22. else if(gaDomainDetect == 'siemensstemacademy.com')
  23. {
  24.     ga('create', 'UA-12418696-1', 'auto', {'allowLinker': true});
  25.     ga('require', 'linker');
  26.     ga('linker:autoLink', ['stem.discoveryeducation.com'] );
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement