anilsojitra
Posts: 0
Joined: Fri Jan 20, 2012 10:51 am

google analytics code not appearing in view source

I've added the following code as Custom Javascript in the Load event.

var _gaq = _gaq || [];
gaq.push(['setAccount', 'UA-17912306-1']);
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);
})();

When I view the mobile site (http://proofing.thebigsheep.co.uk/mob...) in a desktop browser and view the source code I cannot see the code above.

Please can you help me identify why the GA tracking code is not being exported from the project.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

google analytics code not appearing in view source

Hello! Could you make your app link public and post the link here (go to Test, check Public)

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

google analytics code not appearing in view source

Hello,
We'll test.

anilsojitra
Posts: 0
Joined: Fri Jan 20, 2012 10:51 am

google analytics code not appearing in view source

Thank you, I appreciate your help.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

google analytics code not appearing in view source

The code that you entered in editor is successfully added to http://proofing.thebigsheep.co.uk/mob... as a part of JavaScript function "screen_AC16_onLoad".

anilsojitra
Posts: 0
Joined: Fri Jan 20, 2012 10:51 am

google analytics code not appearing in view source

Excellent. So please can you confirm that the GA tracking is successfully implemented in the mobile web app and GA will track page views.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

google analytics code not appearing in view source

You can't add Google Analytics this way, because JavaScript should run before page load.
You can add Panel component to page and place there the following code:

code<script>
var _gaq = _gaq || [];
gaq&#46;push(['setAccount', 'UA-17912306-1']);
gaq&#46;push(['trackPageview']);

(function() {
var ga = document&#46;createElement('script'); ga&#46;type = 'text&#47;javascript'; ga&#46;async = true;
ga&#46;src = ('https:' == document&#46;location&#46;protocol ? 'https:&#47;&#47;ssl' : 'http:&#47;&#47;www') + '&#46;google-analytics&#46;com&#47;ga&#46;js';
var s = document&#46;getElementsByTagName('script')[0]; s&#46;parentNode&#46;insertBefore(ga, s);
})();
<&#47;script>/code

Return to “Issues”