Tutorial


Adding Google Analytics to your Dolphin 7 site is a very simple process. The following information assumes you already have a Google Analytics account setup.

Once you get the Analytics code from your Google account it will tell you to choose from a couple of different coding formats. I have been using Google Analytics for a long time and didn't have all the coding options at the time. I simply use the simple basic legacy code format. But, it's up to you which one you decide to use.

Google Analytics will then tell you to add your code before the closing body tag </body>. In order to cover all Dolphin 7 pages we want to add the code to:

/templates/base/_footer.html


This is a very small file and it is really simple to add the Google Analytics code.

Open the file with your favorite text editor and you will see:

       <bx _ injection:injection _ footer />
    </body>
</html>


You will simply add your Google Analytics code before the </body> tag like so:

       <bx _ injection:injection _ footer />
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-4XXXXXX-1";
urchinTracker();
</script>

    </body>
</html>



The newer current Google Analytics tracking code looks more 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-4XXXXXX-1");
pageTracker._trackPageview();
} catch(err) {}</script>



So after adding it to /templates/base/_footer.html it would look like:

       <bx _ injection:injection _ footer />
<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-4XXXXXX-1");
pageTracker._trackPageview();
} catch(err) {}</script>
    </body>
</html>



Then save the changes to _footer.html back to your server/hosting account.

After that, you will want to refresh your site in your web browser and view the page source to verify the Google Analytics code exists. You should see it near the bottom of the page when viewing the page source. This should also be apparent when viewing the page source of any page within your Dolphin 7 site.

If not verify your code placement and you successfully uploaded the file back to your server/hosting account.

Other things you might do if you do not see the code is clear your Dolphin Cache in your Administration Panel.

Dolphin does much more caching now then in previous versions.

Clearing the cache in your Dolphin 7 Administration Panel will remove the files in /cache_public.

You might also remove all files manually in /cache except for the .htaccess file and refresh your site / page again, if you still do not see your Google Analytics code when viewing the page source of your Dolphin 7 site.

The other thing to note about Google Analytics is once you successfully add the code to your Dolphin 7 site, and you check your Analytics account it should say receiving data.

You will not see statistics appearing or updating instantly. Once it does say receiving data you will need to wait 24 hours before stats are updated and appear in your account. For most sites Analytics only updates once per 24 hours, so be patient.


Additionally:

This is the same process for the previous version of Dolphin as well. Simply add the code to /templates/base/_footer.html before the </body> tag for Dolphin 6.1x too.

 
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
Recommend
Sponsored Links