Advertisement
Guest User

Untitled

a guest
Jul 28th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. var _gaq = _gaq || [];
  2. _gaq.push(['_setAccount', 'UA-XXXXXXXX-1']);
  3. _gaq.push(['_setDomainName', 'XXXXXXXXXXXX.com']);
  4.  
  5.  
  6. // Get Username, try from session cookie first
  7.  
  8. var savedName = $.cookie("svName");
  9. if ((savedName==null)||(savedName==""))
  10. {
  11. savedName = $().SPServices.SPGetCurrentUser({fieldName: "Name",async:false,debug: false);
  12. $.cookie("svName",savedName, { path: '/' });
  13. }
  14.  
  15. // Set Google Analytics Custom Var
  16. _gaq.push(['_deleteCustomVar', 1]);
  17. _gaq.push(['_setCustomVar',
  18. 1, // This custom var is set to slot #1. Required parameter.
  19. 'SPUser', // The top-level name for your online content categories. Required parameter.
  20. savedName,3 // Sets the value of "SPUser" Required parameter.
  21. ]);
  22.  
  23. _gaq.push(['_trackPageview']);
  24.  
  25.  
  26. (function() {
  27. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  28. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  29. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  30. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement