SOLVED

Google trackign code question

Go to solution
Trish_Voskovitc
Level 5

Google trackign code question

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>
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Matt_Stone2
Level 9

Re: Google trackign code question

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>

View solution in original post

8 REPLIES 8
Matt_Stone2
Level 9

Re: Google trackign code question

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

Re: Google trackign code question

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 - Champion Alumni

Re: Google trackign code question

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.
Anonymous
Not applicable

Re: Google trackign code question

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

Re: Google trackign code question

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

Re: Google trackign code question

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
Level 9

Re: Google trackign code question

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

Re: Google trackign code question

thanks Matt!