PHPmotion Wiki : GoogleAnalytics

HomePage :: Contents :: PageIndex :: Login/Register

Website Logo


Featured PHPmotion Sponsor: Cirtex- Unlimited PHPmotion Web Hosting $2.95/month [50% discount with coupon code "phpmotion"]


Back to Tips & Tricks (HOW TO)


Question


How to add Google Analytics Code to my website

Answer



Google

Follow all the steps at Google's website. you will then be given code that you must add to your website


Adding the Analytics Code

If you are using the Default PHPmotion theme, the file you will need to edit is /themes/default/templates/main-1.htm

If you are using a Custom Theme, the file you will need to edit is /themes/YOUTHEME-NAME/templates/main-1.htm


1) Download the template file from your website's FTP folder

2) Open the file using a text editor like Notepad

3) Find the closing </head> tag ... an example an shown below...and past the code provided by google

</head>
<body>
  <!--Begin Wrapper.  This is the main container of the template.  It sets the overall width of the tempalate as well as centers it-->
  <div id="wrapper">
	<!--Begin Header-->
	<div id="header">
	  <!--Begin Left Header.  This is where the logo is contained-->
	  <div id="header-left">
		<!--Begin Greeting. (Welcome message, Login/out links etc...)-->
		<div id="greeting">
		
		........



Now with the analytics coded pasted


<!--google analytics code -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-435713791-2']);
_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>

</head>
<body>
  <!--Begin Wrapper.  This is the main container of the template.  It sets the overall width of the tempalate as well as centers it-->
  <div id="wrapper">
	<!--Begin Header-->
	<div id="header">
	  <!--Begin Left Header.  This is where the logo is contained-->
	  <div id="header-left">
		<!--Begin Greeting. (Welcome message, Login/out links etc...)-->
		<div id="greeting">
		
		......



4) Save the file and upload it back into your FTP





Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki
Page was generated in 0.0368 seconds