Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 Google Universal Analytics
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Webbo
Average Member

United Kingdom
982 Posts

Posted - 01 February 2014 :  18:19:51  Show Profile  Visit Webbo's Homepage  Reply with Quote
Does anyone fancy rewriting the previous Google Analytics code mod to use the new Google Analytics code ?

The previous code was:


Response.write "<script type=""text/javascript"">" & vbNewLine & _
"var gaJsHost = ((""https:"" == document.location.protocol) ? ""https://ssl."" : ""http://www."");" & vbNewLine & _
"document.write(unescape(""%3Cscript src='"" + gaJsHost + ""google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E""));" & vbNewLine & _
"</script>" & vbNewLine & _
"<script type=""text/javascript"">" & vbNewLine & _
"var pageTracker = _gat._getTracker(""UA-usernumber"");" & vbNewLine & _
"pageTracker._initData();" & vbNewLine & _
"pageTracker._trackPageview();" & vbNewLine & _
"</script>" & vbNewLine



The new tracking code for Google Universal Analytics is...


<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-usenumber', 'site name');
ga('send', 'pageview');

</script>


It needs writing into vbscript

Edited by - Webbo on 01 February 2014 18:21:01

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 01 February 2014 :  19:19:17  Show Profile  Reply with Quote
Not really, you can escape into HTML and leave it alone.

<%
' vbscript here
%>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-usenumber', 'site name');
ga('send', 'pageview');

</script>
<%
' back to vbscript here....
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 03 February 2014 :  02:16:18  Show Profile  Visit Webbo's Homepage  Reply with Quote
I never thought of that
Worked but didn't need the <% at the beginning
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000 Version 3.4.07