Google trackign code question | Community
Skip to main content
Trish_Voskovitc
Level 5
August 18, 2014
Solved

Google trackign code question

  • August 18, 2014
  • 8 replies
  • 3293 views
Hi anyone who can help,

we already have a bunnch of landing pages with the google code in the meta tag custom head area. if i now go and add to the template will that be a problem (basically making some landing pages have the code twice)

or would i have to go through and remove all the code ffrom the individual landing pages?

also i am not a coder so still not sure where to put my code within the placeholder on my template
<!-- GOOGLE ANALYTICS.  ENTER YOUR CODE and UNCOMMENT block -->
 <!--
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "YOURCODE";
urchinTracker();
</script>

where would my code go-- all in the "YOURCODE" area?
 this is my code:
<script type="text/javascript">
 
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-3839367-1']);
  _gaq.push(['_setDomainName', 'enkata.com']);
  _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);
  })();
 
</script>
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Matt_Stone2
Like Josh said above, you basically want to delete that entire section of code that was in your template by default and then paste the code you got from Google Analytics in its place.

So remove all of this:

<!-- GOOGLE ANALYTICS.  ENTER YOUR CODE and UNCOMMENT block -->
 <!--
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "YOURCODE";
urchinTracker();
</script>


and put this in its place:

<script type="text/javascript">
 
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-3839367-1']);
  _gaq.push(['_setDomainName', 'enkata.com']);
  _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);
  })();
 
</script>

8 replies

Matt_Stone2
Level 9
August 18, 2014
Yes, you would want to delete the code from the individual landing pages so that it doesn't fire twice and double your counts.

You can delete that entire GA section in the template and drop your code over it.
Trish_Voskovitc
Level 5
August 18, 2014
Matt
Which section? everything after
<!-- GOOGLE ANALYTICS.  ENTER YOUR CODE and UNCOMMENT block -->

or all below:


<!-- GOOGLE ANALYTICS.  ENTER YOUR CODE and UNCOMMENT block -->
 <!--
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "YOURCODE";
urchinTracker();
</script>
Josh_Hill13
Level 10
August 18, 2014
The Template should place the GA code in the HEAD OR FOOTER. Pick one.

The code on your actual LP can be deleted. Choose everything from <SCRIPT> to  </SCRIPT>

But it looks like you have an unclosed Comment <!-- there, so it might not be working now anyway. Delete that too.
August 19, 2014
Question - if we are using iframes on our webstie, how does the tracking work?  is there additional code we need to use? thx!
Matt_Stone2
Level 9
August 19, 2014
If you're using iFrames, I would recommend having a separate landing page template where you leave off the GA code. Otherwise you risk double-counting.
Trish_Voskovitc
Level 5
August 19, 2014
Matt
this code is not mine, it is the code i see that is in our landing page templates put there by default by Marketo when you create a new template. it is at the bottom of the template.

i just need to know where my tracking code from google goes within it- i only cut and pasted my actual code from google above in case it was easier to just show me where to put it versus explaining:)

<!-- GOOGLE ANALYTICS.  ENTER YOUR CODE and UNCOMMENT block -->
 <!--
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "YOURCODE";
urchinTracker();
</script>
Matt_Stone2
Matt_Stone2Accepted solution
Level 9
August 19, 2014
Like Josh said above, you basically want to delete that entire section of code that was in your template by default and then paste the code you got from Google Analytics in its place.

So remove all of this:

<!-- GOOGLE ANALYTICS.  ENTER YOUR CODE and UNCOMMENT block -->
 <!--
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "YOURCODE";
urchinTracker();
</script>


and put this in its place:

<script type="text/javascript">
 
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-3839367-1']);
  _gaq.push(['_setDomainName', 'enkata.com']);
  _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);
  })();
 
</script>

Trish_Voskovitc
Level 5
August 20, 2014
thanks Matt!