A Kingdom-minded follower of Jesus, embracing the prophetic-apostolic, with a missional-postmodern expression. huh?

Installing & Configuring the Google Analytics Module for Drupal 6.x

Posted Date: 
Thu, 03/26/2009

The Google Analytics module for Drupal 6.x integrates Drupal's powerful site administration tools so you can harness the fullest potential of your Google Analytics account.  The module offers user-specific, role-specific, and page-specific tracking.  It can send role or profile information to Google Analytics so you can run user segmentation reports.  You can easily extend your Google Analytics with custom JavaScript code.  The possibilities are endless!

What is Google Analytics? It is the next-generation web analytics tool that show you how people find your site, how people navigate through it, and how they become customers. Google Analytics is both easy to use and offers an enterprise-class reporting interface.  Google Analytics is also free!

Note: It's a high resolution video, so it plays well in full screen mode.

Primary Screencast: 
Syndications

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

google analytics module

thank you very much for the video, it very helpfull :)

keep on sharing, brian,,..

cheers,

PS: I started explore drupal at 2 weeks ago, and found your website, makes me more easier to modify drupal.

thanks for info

very useful one tnx for helping installing google analytics module and configuring it correctly

Google Analytics Header not showing up in Site Config Area

Hi Brian-

What if you're not able to see the Google Analytics header in the Site configuration area of Drupal? I installed the module in sites/all/modules like I do with my other modules and I also verified that it was installed in the administration by module page.

I've tried re-installing the module and clearing the Drupal cache.

Any tips you can offer? Thanks in advance.

Elana

it's probably a permissions issue

 Try checking your permissions for googleanalytics on this page: admin/user/permissions

Installing the module

why the module doesnt connect to the google analytic

Thanks but I made sure to

Thanks but I made sure to check that out before and I enabled all permissions for admins. Still not sure what's up.

So frustrating - anything else you can think of? Thanks so much for your help.

tracking still showing as not turned on

Great video Brian, thank you. I have followed the steps in the video. Cleared cache. Pasted <?php print $closure; ?> into my page.tpl.php file of my custom theme. cleared cache again. Still getting the tracking no installed.

When I created my Google Analytics account it gave me a code to paste into each page, I am taking for granted that this is being done through the Drupal module and do not need to paste this code anywhere. Is that correct?

Thank you so much for your help!

Error on Drupal 6.16

Good Evening,
First thank you for the module. Unfortunately i have just tried to install it on the fresh version on drupal 6.16 and i am having the following error :
---------------------------------/
warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'googleanalytics_admin_settings_form' was given in /nfs/c01/h12/mnt/9167/domains/drupal.laurentdevos.com/html/includes/form.inc on line 372.\
--------------------------------/
I would like to mention i am just a beginner and it could be an stupid question but your help in understanding would be nice...

Thanks

Hello, this error (to my

Hello,
this error (to my knowledge) normally turns up if you change something in the menu or rename some functions in a module.

It can easily be fixed by a) clearning the cache b) rebuilding the menu tree

Try out a) above.

regards
Urs

Perfect!

Thanks, it worked all well!

user config

Hi!

First of all thank you the great video! It's awesome!

Bit i have a question! I've tried to setting google analytics in my page and it went well except one thing. I can't see the tracking option in the edit user menu. It would be important for me because there are three user who i don't want to track!

Thank you the help!

try looking here

Thanks dumi!  See if this works for you:

/admin/settings/googleanalytics
 under > "User specific tracking settings"
   select > "Track users by default, but let individual users to opt out."

 under > "Role specific tracking settings"
   Make sure that none are checked (everyone tracked) or you check the roles that matter to you.

/user/###/edit
  under > "Google Analytics configuration"
    check > "Enable user tracking"
 

Thank you the help! I think i

Thank you the help!

I think i misunderstood the meaning of the "Track users by default, but let individual users to opt out." Thanks for my not excellent english!

Thank you again!

What am I missing?

Ok, I would like to first make it clear that I am not allergic to awesomeness but I apparently am missing something here.

I performed the walkthrough just as the video explained it. Google Analytics however tells me that tracking code is not installed on my pages. Did I miss this part in the setup? My reading indicates that this module is supposed to take care of this after I entered the GA number.

Thanks for great video

Thanks for great video

it might be a cache issue

Go into this page:
YOURSITE.com/admin/settings/performance

There is a button near the bottom that reads, "Clear cached data".  Click it.
Have Google scan your site again and let me know the results.
Peace,
Brian

Problem with Tracking not installed

I am new to Drupal and Analytics but have been tasked with sorting it out. I followed your excellent video and installed the google_analytics module. I left it wide open to grab all data. No segmentation or permissions monkey business for now. I just want a baseline. So following install, I checked back with Analytics and it was reporting that the tracker was not installed. I flushed cache under performance and still no change in status. Any ideas would be appreciated. Thanks in advance, Brian. Keep up the good work.

Danny

I think I know what's going on

Danny,
I did a quick survey of your site (http://www.tmjassociation.org/) and I think I know what going on.  The Google Analytics appears to be partially working.  First, I can see google analytics showing up in your jquery (around line 41 in your rendered html when doing view source).  The issue appears to be with your Drupal template.  If you could, check out your page.tpl.php file.  Near the very end of your php source code, there should be this ending:
    <?php print $closure; ?>
  </body>
</html>
That "print $closure" is where the Google Analytics module puts the javascript.  If it's missing from your template, just put it in there, and clear your Drupal cache.  It should work just fine after that!
 
Peace,
Brian
 

Tracking Not Installed

I have this issue also.

If I view my page source it states that the code is there, I have checked my page.tpl.php file of my theme and the <?php print $closure; ?> is there but Google still says that the tracking code is not installed.

I have done a cahce clean also but still no go..

Strange thing is that in my GA account it is showing hits etc.. just don't know about this tracking code business.

Regards..,

K

strange

That's very strange.  From my experience, GA doesn't show any hits unless it first detects the tracking code is installed.  How long have you been experiencing this issue?

GA Not Installed

I suppose from when I installed the module, about a week or more.

Regards..,

K

js - use google's copy instead of your local copy

I'm assuming this issue is affecting http://madtogger.co.uk/
This domain is using a local copy of the google javascript file.  Go into the GA module and tell it to not use a local copy, clear your theme cache, and have Google scan your site again.

Done that.

Hi,

I have done as you suggested but still the same story.

I don't know whether I am reading too much into this as in my GA account overview I have the green tick, see here:-

http://www.madtogger.co.uk/screenshot/overview.png

but when I click on the edit profile button in account overview it shows:-

http://www.madtogger.co.uk/screenshot/profile.png

and then if I click on the check status link it shows:-

http://www.madtogger.co.uk/screenshot/tracking.png

even though GA is showing me hits and various reports etc.. it is like it is not recognizing that the script is there, maybe this is a Google thing?

Regards..,

K

yep, it's a google thing

Yeah, get in touch with Google.  Usually if you click the Help link in the top right of Analytics, you go through a maze of troubleshooting prompts before you get to a form that lets you submit a ticket to Google.

Will Do.

Thanks Brian,

I will get in touch with Google about it and post back the outcome.

Cheers..,

K

Same problem with Analytics as guy above

I really like your video and set everything up according to plan, I even checked the "closer" tag in the PHP file. Not sure why but still getting an error in GA saying its not tracking. Did we find out what the problem was?

This is the correct fix for my issue

Thanks man. I have created my own template and i for got to mention the closure statement..

It works

Thanks a million, Bryan. Client says thanks as well.

Danny

Awesome video. Walked me

Awesome video. Walked me through the steps that I needed and was very simply to follow. Thanks for the help.

excellent

wow this was great. thank you so much for your time.

Nice work.

Thanks for the screencast. Very helpful. And I love your disclaimer! LOL. Made my day.

Cheers Chris.

you're welcome Chris!

I'm glad you enjoyed the video.  Looking for more videos?  Check out my latest project: http://yadadrop.com/drupal-video

Nice

Hey, thanks for the google analytics tutorial. Really helpful. You talked about specific page tracking - pretty cool, but I exclude my domain via analytics itself - any advantage?

Btw, I'm migrating from a static site to drupal - the difference is really night and day. Not a whole lot different for the user I don't think, but admin-wise definitely worth it.

When you say that you

When you say that you excluded your domain via analytics itself, how did you configure that?  That must have been a feature outside of the drupal module.

The page-specific tracking is really helpful when you don't want to clutter up your total, unflitered google analytics report.  For instance, pages that are hit excessively by admin users or content creators would be perfect examples of how an inflated pageview would distort your overall, unfiltered, unsegmented report.

Since you're converting from a static site, you might benefit from my drupal videos project found here: http://yadadrop.com/drupal-video

analytics

Analytics itself has a setting where you can exclude hits from your domain. Pretty nice for a "static" site. Thx for the reference to the other video.

Btw, do you have a video that explains how to put an icon right next to the "http://www.yoursite"?

favicon

favicon settings are theme-specific.  many drupal themes let you assign a path to your favicon.ico file here:
domain.tld/admin/build/themes/settings/[theme_name]
OR, follow this path in the admin menu: Home › Administer › Site building › Themes

A buddy of mine put together this video which shows you how to configure several things related to themes (including the favicon).  His demo uses the Zen theme.
http://www.youtube.com/watch?v=AaCoTiZPh9s 

Peace,
Brian
 

Thx

Thanks man, didn't watch the video, but your instructions were right on.

thank you

for the effort!It was very helpful!!!

Very Helpful

Thanks - I am pretty new to Drupal and as many others have already said your video was very well done. Very helpful.

you're welcome

thank you! 

Awesome module and awesome

Awesome module and awesome video! :-)

Thanks!

Thanks a lot

Thanks a lot

thank you

 thank you!

Thanks!

I just wanted to say thank you, Brian! Nicely done module and nicely done video. Clear for virtually anyone, I'd think. Well done!

thank you david

I appreciate it.  thank you for leaving me a note. :-)

Great Video

A very helpful video. I was using a block of javascript for google analytics so far, but your video has convinced me to use the module.

But do tell me, what is the difference between extracting the module in the /module directory and the /sites/all/module directory, if there is only one site running on the installation?

great question shaunak

I was wondering the same thing sometime ago.  In a nutshell, it's a "best practice" to copy user contributed modules to /sites/all/modules directory.  When it comes time to upgrade Drupal, one needs to overwrite the Drupal installation directory with the new core files and then restore the sites directory to keep all of your custom settings. In other words, your life becomes simpler when you separate contributed modules from core modules. For reference, check out steps #1 and #8 of the UPGRADE.txt in the root of your Drupal install.

Peace,
Brian

I'm still pretty new to

I'm still pretty new to Drupal, so this might seem like a question with an obvious answer for regular Drupal users- but I'm trying to track only anonymous users on my site. Under the Page Specific options, I'm assuming I keep all the default pages listed so as not to throw off my stats, but I'm kind of wondering about the "node/*/*" page. If I leave that in there, does it mean that it only tracks anonymous users that visit the home page, and not my other "nodes"? Clarification on that would be much appreciated. :)

Thanks!
Rachel

about node/*/*

Hi Rachel,
Those default values that you see in there are to help filter out page views that might skew your analytics totals. In this case, node/*/* is to detect "node add" or "node edit" operations. The urls for those operations look like this:
http://www.brianstevenson.com/node/add/page
http://www.brianstevenson.com/node/1591/edit
The asterisks (*) are wildcards that detect any value.  So keywords like "node/add/page" or "node/1591/edit" would be excluded with a "node/*/*" rule.
Hope that helps.  :-)
Peace,
Brian

Excellent video. You speak

Excellent video. You speak very well and clearly. You should also focus on creating tutorials/how-to's via screen-casts for other topics revolving around Drupal. How about one for Clean URLs?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Subscribe to Drupal Screencasts (RSS)