Dieses Dokuwiki verwendet ein von Anymorphic Webdesign erstelltes Thema.

Google Analytics

  • Google Analytics is an amazingly powerful tool for monitoring your website traffic - and best of all it is free!

Screen Shots

Installation

Step 1: Upload your files

  • create a new directory analytics in catalog/includes/modules/
  • copy this file catalog/includes/modules/analytics.php from this zip file into the directory.

Step 2: Edit the variables

  • If necessary, change the $transaction_string and/or the $item_string , for example

if you do not use the value customers_state or affiliation tag, replace this with dummy text (company name description), like:

	$transaction_string = '"' . $order_id . '"," ' . $analytics_affiliation . '",
	"' . $analytics_total . '","' . $analytics_tax . '","' . $analytics_shipping . '",
	"' . $orders['customers_city'] . '","DUMMYTEXT","' . $orders['customers_country'] . '"';

Step 3: Add the tracking code to your main template

  • In your main_page.tpl.php file place the following script at the end of the file, prior to the closing </body> and </html>

	<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">
		var pageTracker = _gat._getTracker("UA-xxxxxxx-x");
		pageTracker._initData();
		pageTracker._trackPageview();
	</script>

If you process your transactions on an another domain (e.g. store.yourdomain.com) it's strongly advised and recommended that you use the following code:

	<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">
		var pageTracker = _gat._getTracker("UA-xxxxxxx-x");
		pageTracker._initData();
		pageTracker._setDomainName("yourdomain.com");
		pageTracker._trackPageview();
	</script>

  • Replace yourdomain.com with your parent domain name (between the quotes). The code does not differ that much from the original except now the (parent) domain name is setted. Google Analytics now can keep track of transactions from and to other domains within your access.

Step 4: Replace your Analytics UA-code

  • Replace the xxxxxxx-x in the script above with your personal Analytics UA-code (available in your Google Analytics account)

Step 5: Put tracking code in checkout_success.php

  • open catalog/checkout_success.php
  • At the bottom of the file paste the following code:

	<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">
		var pageTracker = _gat._getTracker("UA-xxxxxxx-x");
		pageTracker._initData();
		pageTracker._trackPageview();
		
		<?php 
			include(DIR_WS_MODULES . 'analytics/analytics.php'); 
		?>
	
	</script>

Step 6: Replace your Analytics UA-code

  • Again (as in step 4), replace the xxxxxxx-x in the script above with your personal Analytics UA-code.
  • Save the checkout_success.php

Download

Setting up Google Analytics

  • Google only updates your traffic stats every 24 hours so you should not expect to see your current browsing instantly on the site.
  • To set up your site you need to go to the Website Profiles page of Analytics:
    • Click on Edit (on right hand side)
    • In the top box - Main Website Profile Information - click Edit
    • Click on Yes, an E-Commerce Site
    • Whilst you are here you might as well check the currency and timezone are set correctly.
    • You can also have Analytics track the search terms used on your site by clicking on Do Track Site Search and entering keywords in the text box provided.

  • Bookmark at
  • Bookmark "Google Analytics" at Digg
  • Bookmark "Google Analytics" at Furl
  • Bookmark "Google Analytics" at Reddit
  • Bookmark "Google Analytics" at Google
  • Bookmark "Google Analytics" at StumbleUpon
  • Bookmark "Google Analytics" at Technorati
  • Bookmark "Google Analytics" at Facebook
  • Bookmark "Google Analytics" at Twitter
  • Bookmark "Google Analytics" at Slashdot
google_analytics.txt ยท Last modified: 2010/10/01 14:01 (external edit)
You are here: startgoogle_analytics
Dieses Dokuwiki verwendet ein von Anymorphic Webdesign erstelltes Thema.
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0