I’ve got a client with about 6 websites that are all the same framework in VB.NET. I’ve tried to add Google Analytics Tracker inside each of them with no success. I’ve many clients with WordPress website or with my custom CMS (in JavaServer Faces) that are working perfectly. I’m pretty sure I’m doing something wront in VB.NET which I almost never use.
Here is the code in VB.NET I’m currently using :
<head>
...
<!-- Google Analytics -->
<asp:ContentPlaceHolder ID="GoogleAnalyticsTracker" runat="server">
<script type="text/javascript">
alert('ga-start');
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '<%= m_sIDGoogle %>']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function () {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
alert('ga-stop');
}
)();
</script>
</asp:ContentPlaceHolder>
</head>
Note : I’ve tried just before the </body> too, as described in Google Analytics.
Here is the rendered result :
<script type="text/javascript">
alert('ga-start');
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA–29119317–1']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function () {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
alert('ga-stop');
}
)();
</script>
Also note that the two alert(”) are working, Firebug tell me that the ga.js is loaded too.
After all that, nothing is tracked in Google Analytics. Someone have an idea of what I’m doing wrong?
You can also visit the test website : http://mouk-mouk.amiesterre.com
Finally fixed, I don’t know why, but the codes were wrong :
UA–29119317–1 > UA-29119317-1
Visually we see nothing in Courier New…