Trouble with Google analytics tracking code...

4 replies
I set up a simple .html page with a 301 redirect to the affiliate site I am promoting. I also added in the tracking code above </head> from google analytics.

Google analytic's notices the code on the page, however it hasn't gathered any data for the past few days now when they said it only takes 24 hours to start seeing the stats.

I'm not sure what I'm doing wrong.

My .html page is using this script:

<html>
<head>
<title>Loading page</title>
<meta http-equiv="refresh" content="2;url=hxxp://AFFILIATE.VENDOR.hop.clickbank.net">
<script type="text/javascript">
url='hxp://AFFILIATE.VENDOR.hop.clickbank.net';
if(document.images) { top.location.replace(url); }
else { top.location.href=url; }
</script>
</head>
<body>Loading
<a href="hxxp://AFFILIATE.VENDOR.hop.clickbank.net">page</a>
</body>
</html>

I tried putting the tracking code script right before the </head> and it still didn't work.

I then tried putting the script above the clickbank <script>, still doesn't track the page's stats.

How do I get this working? I'm guessing it's a major noob mistake.
#analytics #code #google #tracking #trouble
  • Profile picture of the author Traffic_Is_King
    Tracking code actually goes right before the </body> tag at the bottom of your code. That's why no stats where recorded. That should fix it.
    {{ DiscussionBoard.errors[2691753].message }}
    • Profile picture of the author wesker777
      Alright so I tried out your advice and it was still not working. I waited 24hrs to make sure. So I tried it every way i possibly could get the analytics to work, before the </head>, </body>, etc.

      No idea why this is not tracking...

      What's wrong with this picture?

      <html>
      <head>
      <title>Loading page</title>
      <meta http-equiv="refresh" content="2;url=http://AFFILIATE.VENDOR.hop.clickbank.net">
      <script type="text/javascript">
      url='http://AFFILIATE.VENDOR.hop.clickbank.net';
      if(document.images) { top.location.replace(url); }
      else { top.location.href=url; }
      </script>
      </head>
      <body>Loading
      <a href="http://AFFILIATE.VENDOR.hop.clickbank.net">page</a>
      <script type="text/javascript">

      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'ANALYTICS-ACCOUNT#']);
      _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>
      </body>
      </html>
      {{ DiscussionBoard.errors[2704623].message }}
  • Profile picture of the author skoh
    You should probably cloak/mask your affiliate link.


    It's for the SERPS brah.
    Signature

    {{ DiscussionBoard.errors[2704691].message }}
    • Profile picture of the author wesker777
      So I got the analytics to work on my website, however i have several pages I would like to track but google analytics is only noticing the main index page "/".

      I put the exact same tracking code in every other page the exact same way but it doesn't seem to be working.

      I have a feeling I'm making a major noob mistake.
      {{ DiscussionBoard.errors[2868693].message }}

Trending Topics