Tutorial

Many people use the popular Google Analytics as their primary means of tracking website traffic. Google Analytics provides some really detailed statistics and is pretty decent.

There are a number of customizations you can do to your Analytics code to provide additional details and stats in your account. Some people are not aware of this, but one of the simple ones you can add is Track Page Load Times.

I am placing this in the Dolphin 7 Tutorials section because further down you will see a couple of Dolphin 7 code references.

It can obviously be used with any type of website though.







For the newer Asynchronous Code you would add:
_gaq.push(['_trackPageLoadTime']);

And the full code would look something like:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);
_gaq.push(['_trackPageLoadTime']);

(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>


For the older Traditional Code you would add:
pageTracker._trackPageLoadTime();

And the full code would look something like:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>

<script type="text/javascript">
try{
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
pageTracker._trackPageview();
pageTracker._trackPageLoadTime();
} catch(err) {}
</script> 


After verifying you have correctly added or updated your code, you will need to wait a few hours, and preferably at least 24 hours before you start seeing data in your Google Analytics account.

Google suggests adding Analytics code to the header between <head>Google Analytics Code</head> tag. In Dolphin 7's case this would be:
/templates/base/_header.html

<script type="text/javascript">
var oBxUserStatus = new BxUserStatus();
oBxUserStatus.userStatusInit('<bx_url_root />', false);
</script>
Google Analytics Code Here
</head>


But, you can still add it to the bottom of your page before the </body> tag. In Dolphin 7's case this would be:
/templates/base/_footer.html

<bx_injection:injection_footer />
Google Analytics Code Here
</body>
</html>



Note:
With Dolphin 7 after making any changes to your Google Analytics code you will want to clear the cache in your Dolphin 7 Administration for the changes to fully update.

Once you have some visitors and 24 hours has gone by you will start seeing data in the Content section of your Google Analytics account.

You should see something like Avg. Page Load Time (sec) next to the number of Pageviews.

This will give you an idea if some of your pages seem to be taking longer to load than others. You might use the data to optimize your pages that seem to be taking longer to load.


If you do not see Page Load Time in your Google Analytics account:

You need to make sure you are using the New Version of Google Analytics. If you are still using the older version you will not see the page load time in your account.

Simply click on the New Version link near the top right in your account.

Google Analytics New Version



Once the new version loads up find:
Content
-Site Speed

Google Analytics Site Speed



Other:
Be sure you are using the new version of Google Analytics and make sure you successfully applied the code.
Make sure you allow enough time to pass and have a few visitors to track page load times.
With Dolphin 7 make sure you clear the cache in admin so the Analytics tracking code is updated.


For more information and details you can refer to this Google support page:
How to Set Up Site Speed


And for additional and more complex Google Analytics code customizations you can refer to this Google page:
Typical Tracking Customizations



If you are one of those people that like analyzing statistics, then this might be for you.

 
Written By
Tutorial by: Jeremy LeSarge (AKA Ray)

I am the owner and administrator of DialMe.com. I write Tutorials for Boonex Dolphin as well as tips and resources surrounding website programming and development. I enjoy working with WordPress, SEO, and Web Hosting / Servers. I also maintain a WordPress Blog here on this site where you will find a variety of technology and webmaster resources.

Actions
Sponsored Links
Recommend