عربي

Comprehensive Guide for Setting Up Google Analytics

Arabic

Comprehensive Guide for Setting Up Google Analytics

When you aren't technically-minded, setting up an anlaytics platform like Google Analytics on your site can seem scary. There's all this code to worry about. Google Analytics even asks you if you're going to send the code to your webmaster. Many a site owner has thought, "Oh, no! I don't have a webmaster!" and backed out of the process.

As you'll find by reading this beginner's guide, it's not near as difficult as it might seem. Just follow the steps provided, and I'll walk you through it.

Finding Your Important Site Files

To set up Google Analytics on your site, you'll need some of your site's files. Don't panic – it's a simple copy and paste. You just have to know where to put the codes Google provides you.

  • PHP - For PHP sites, you'll be looking for file named header.php.
  • HTML - If you have an HTML site, and all pages end in .html, you'll need to make changes to each file.
  • WordPress – If you're using WordPress, you'll need to find the header.php file in your wp-content/themes/themefolder section or install the Google Analyticator Plugin.
  • Here are some instructions for Joomla.
  • Here are instructions for Drupal as well.
  • ASP – If you have an ASP site, you'll need to make changes to each template page.

Google Account Setup

If you already have a Google account through email or another service, you can simply log on to the Google Analytics site. If you don't have an account, simply click "Sign Up Now” and complete the steps to create an account.   

If you already have an email on file, you'll receive a warning. "There's already a Google Account associated with this address. Please sign in; or, if you forgot your password, reset it now."

If there's no warning, go check your email at the address you provided Google. Once you receive the email, verify the address and log in to your new Google Analytics account.

Google Analytics Setup

Now it's time to actually set up Google Analytics to begin tracking on your site. Here, we'll cover each section and walk you through:

  • Account Name – You may decide to add more sites at a later date. The account name is for you to assign an easy to distinguish name. The most often used account name is the name of the site itself: My New Site.
  • Website's URL – If you don't know whether your site is http or https (secure sockets layer), it's most likely http. Your URL is your site address (i.e. mynewsite.com or www.mynewsite.com).  Now is a good time to decide which way you want your site to be accessed – as a www or non-www. Search engines don't care which one you use… unless you use them both.
  • Time Zone – Obviously, choose your own country and time zone.
  • Data Sharing Settings – You can choose to share, or not to share, your Google Analytics data. If you're not sure, view the examples for each. Sharing is optional, and doesn't affect how analytics tracking works. However, if you want to see how your site performs against others, you'll need to share anonymously with Google and Others.
  • User Agreement - The terms are, of course, legalese, but it's strongly recommended that you read them before agreeing. At this time, Google Analytics is free to use until you start receiving over 10 million page views per month, but this is subject to change.
  • Agree to the terms and create your account.

Success!

What are you tracking? - For the purpose of this guide, select "A single domain." If you do have subdomains, you can always go in and add them later.

Adding the Google Analytics Tracking Code to Your Files

At this point, Google provides you with the tracking code to install on your site. Go back to your files.

For those not using the Google Analyticator plugin and WordPress:

  • Open your file (s) using an HTML editor, such as NotePad ++ (for PC), Tex-Edit (for Mac) or Jedit (cross-platform compatible, for PC, Mac, Unix and others).

Your file(s) should have something like this:

 

  • Copy the script provided from Google Analytics, and paste it right before the closing tag, where you see </head>. Your file should now look like this:

 

  • Find the point in the Google code that says "_gaq.push(['_trackPageview']);" and push "Enter" on your keyboard to move the cursor to the next line. Copy the code provided below, and paste it in the new line:

_gaq.push(['_trackPageLoadTime']);

            setTimeout('_gaq.push([\'_trackEvent\', \'NoBounce\', \'Over 10 seconds\'])',10000);

Your final code should look something like this:

We add the final piece of code to make Google Analytics tracking more accurate.

  • Click "Save" on the Google Analytics page.
  • Save your files and upload back to your server.
  • Install the Google Analyticator plugin and go to the Settings page.
  • Google Analytics logging is "Enabled."
  • Authenticate with Google if you want a bird's eye view of Google Analytics from within WordPress
     
  • Choose your Google Analytics account
  • Track all logged in WordPress users – unless you want to track your own visits, choose No.
  • Do not track Administrator.
  • Click "remove" to prevent tracking.
  • Enable Site speed.
  • Enable outbound link tracking.
  • Enable event tracking.
  • Leave the rest as is until you reach "Additional tracking code (after tracker initialization):" Add the following code in the provided box:

If you are using the Google Analyticator plugin for WordPress:

setTimeout('_gaq.push([\'_trackEvent\', \'NoBounce\', \'Over 10 seconds\'])',10000);

  • If you wish to see Google Analytics from your WordPress, choose who you want to be able to view your statistics. If it's only you, choose "Administrator."
  • Enable Include widgets
  • Save Changes
  • Save Changes on the Google Analytics page

If Everything Went According to Plan…

Once you push "save" on your Google Analytics account, scroll back up to the top of the page. You should now see "Website Tracking" with the property name and website URL you entered during the account setup. Directly underneath that, you'll also see "Tracking Status." If all went according to plan, you'll see that tracking has been installed and Google is now gathering data. Otherwise, you'll see "tracking not installed."

This warning generally means that your site has not updated correctly.

Troubleshooting

If you get the warning, go to your site. Right click on your mouse and choose "View Source" in the drop down menu. What you're looking at is the live source code of your site. Scroll through the top part of your code, where you placed the Google script. Can you see it?

If not, try uploading your files again and saving them back to your server.

If so, wait a few minutes and then check Google Analytics again to see if the message has changed.

Finito!

Congratulations! You've installed Google Analytics successfully on your site. This time tomorrow, you can log in and start getting the scoop on your website traffic!

[main photo from RioDevelopment; image not of Wamda traffic].

Thank you

Please check your email to confirm your subscription.