View unanswered posts | View active topics It is currently September 6th, 2010, 11:00 am



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
How can I track non-WordPress pages on my website? 
Author Message
Plugin Developer
User avatar

Joined: March 13th, 2009, 3:17 pm
Posts: 518
Location: Allentown, PA
Post How can I track non-WordPress pages on my website?
Thanks to the Javascript-based external link tracking method, Google Analyticator easily allows tracking on non-WordPress managed pages, should you have them. The following guide will work for the latest version of Google Analyticator, 6.0 and above. The principal is similar for older versions.

Step 1: Include the required Javascript

For link tracking to work, two Javascript files need to be included. If you don't care about link tracking (downloads, external links), then you can skip this step.

The first Javascript file is jQuery. You may already have jQuery included on your website. If not, open up your homepage, view the source, and look for a script tag that looks like this:

Code:
<script type='text/javascript' src='http://ronaldheft.com/wp-includes/js/jquery/jquery.js?ver=1.3.2'></script>


Copy that code (with your domain replaced instead of ronaldheft.com) and place it somewhere above the </head> tag on your non-WordPress page. Next, look for the actual tracking Javascript. It will look similar to this:

Code:
<script type='text/javascript' src='http://ronaldheft.com/wp-content/plugins/google-analyticator/external-tracking.min.js?ver=6.0'></script>


Again, replace the domain, and insert this script tag directly below the jQuery script you just added.

Step 2: Add the tracking code.

After configuring Google Analyticator to how you like it, view the source on your homepage, and look the tracking code section, which looks like this:

Code:
<!-- Google Analytics Tracking by Google Analyticator 6.0: http://ronaldheft.com/code/analyticator/ -->
<script type="text/javascript">window.google_analytics_uacct = "123";</script>
<script type="text/javascript">
   var analyticsFileTypes = ['pdf','test','xml'];
   var analyticsEventTracking = 'enabled';
</script>
<script type="text/javascript">
   var _gaq = _gaq || [];
   _gaq.push(['_setAccount', 'UA-XXX']);
   _gaq.push(['_trackPageview']);

   (function() {
      var ga = document.createElement('script');
      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
      ga.setAttribute('async', 'true');
      document.documentElement.firstChild.appendChild(ga);
   })();
</script>


Copy that code (not the above code, but the one from your website), and insert it as the last line of code before </head>. This is important as Google's async tracking method won't work is placed with other Javascript after it. Finally, verify that your tracking code does not contain the following line before _gaq.push(['_trackPageview']);

Code:
_gaq.push(['_setVar', 'admin]);


If that line exists, delete it.

Step 3: Enjoy!

Your non-WordPress pages should be tracking fine after following those steps. Enjoy!

_________________
Ronald Heft
Plugin Developer


December 5th, 2009, 5:23 pm
Profile WWW
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.
Localized by MaĆ«l Soucaze © 2010 phpBB.fr