Using the new ga.js code, I receive the following output when I do a source view:
<script type="text/javascript" src="/sites/all/modules/adsense/adsense_click.js"></script>
<script type="text/javascript">document.write(unescape("%3Cscript src='http://www.google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));</script>
<script type="text/javascript">var pageTracker = _gat._getTracker("UA-1231234-1");pageTracker._initData();pageTracker._trackPageview();</script>
<script type="text/javascript" src="/sites/all/modules/google_analytics/downloadtracker.js"></script>
notice the "%3C" in place of "<" etc. specifically in the line:
document.write(unescape("%3Cscript src='http://www.google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
Current Code Version: 5x-1.4x-dev-[2008-02-23]
Upgraded from Code Version: 5x-1.3x-dev-[2008-02-14]
Comments
Comment #1
hass commented"%3C" is a "<" and this code is correct.
Comment #2
philsward commentedWhy is it showing up when doing a source view on the page though? (i'm no programmer, so bear with me...)
I realize that in the php code, %3C should translate to <, but it shouldn't be doing it in the "view source" output should it?
Is it working properly or is it something that is going to be fixed?
Usually when I setup a new account with analytics, it is 'ready for data' within oh, 12 hrs or so of setting up the account. I realize they give 24 hrs, but even after 24 hrs of setting up a new account, it was hanging on the initial receiving data. This is what prompted me to look at the "view source" of the code which is when I noticed the character substitution. When I switch over to the legacy, all of the output looks correct. Just the problem when using the ga.js.
The output on previous dev modules were outputting correctly on the ga.js.
Sorry, Just wanting some clarification on this one.
Othewise, I absolutely love the module! :)
Comment #3
njbhatt commentedhi
i change following code in 4.7 module.
return '
_uacct = "'.$id."\";{$segmentation}{$codesnippet}var pageTracker = _gat._getTracker(\"".$id."\");pageTracker._initData();pageTracker._trackPageview();"; //changes made by ddssl. new features
its working fine for me.
thanks
niraj
Comment #4
Kuldip Gohil commentedThanks Njbhatt
it's now not working....
Comment #5
hass commented#3 is wrong code and will not work correctly.
Comment #6
alimc29 commentedAs hass said, I think this is fine. For more of an explanation, I believe this is just because it's part of JavaScript. JavaScript always shows in source like this; it does not output html to the source the way php or similar web-based programming languages do.
I do not believe this is an error with the module at all.
If you go to your own Google Analytics account > Edit, and click the link for "Check Status" and choose "New Tracking Code (ga.js)", you get this as well (directly from Google itself) - ex:
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); var pageTracker = _gat._getTracker("UA-######-#"); pageTracker._initData(); pageTracker._trackPageview();The only thing this module does that should change any of this is the actual src of the ga.js script to a locally cached copy, if you have that option enabled.
You'll notice that even this uses the %3C instead of <