By hypersloth on
This is probably terribly simple, but...
I want to use the new Google Analytics service, but it offers a bit of javascript code to go before the /head tag in html... How would I translate that to php for my chameleon theme?
I tried to submit the code using the code tag here, but it still got kicked out for suspicious input... So here's a screenshot instead.
http://slackdaddy.org//jpg/code.jpg
Thanks in advance
Comments
edit themes/chameleon/chameleon.theme
I edited chameleon.theme directly to add the analytics js code directly before the line containing
$output .= "</head>";e.g.
I didn't have to escape anything in the code, just worked as described above. Good Luck.
yep.. that works great
thanks paulr for posting this.
thank you
for the prompt response - I'll try it when I get home.
Bingo
That seemed to work.
www.lumine.net
Cheers.
move code on lumine.net
legacyb4, you might want to move where you have your code placed. having anthing above your title tag other then your doctype is not recommended.
best of luck,
keto
Code moved to right above
Code moved to right above
</head>.Thanks for the tip.
Noticing that in different theme (Chameleon, for example), the code appears as one long string. Assume that still works?
www.lumine.net
Google Analytics Module
You'll be happy to know the solution is much easier with the module located at http://www.ixis.co.uk/drupal-modules/google-analytics
Happy analysing!
--
www.bargainspy.co.uk
--
Ixis (UK): Drupal support, Drupal hosting.
good stuff
Thanks budda. I just got everything setup last night and I am still not seeing any stats. I am assuming that is because 3 million people signed up for this service today after the news stories all over the web. stupid slashdot! heheh
- keto
Yeah I've got no stats yet
Yeah I've got no stats yet either, still claiming they will be available in 12 hours, it's been a good few days now!
--
www.bargainspy.co.uk | More Drupal modules
--
Ixis (UK): Drupal support, Drupal hosting.
same here
and my other site is old-fashioned html, and had a good 15 hour head start. Good to know I'm not the only one not getting reports yet.. I'm off to look for answers outside drupal.
Meanwhile, thanks for the link to the module, budda!
They're too busy; see this message...
Got this message today at my Analytics account:
___________________
discover new oceans
lose sight of the shore
Not sure if it's
Not sure if it's coincidence, but since trying out the module, my stats have gone flat...
Updated Module for 4.7
I did a quick conversion of the module to work with Drupal 4.7b4 (and it shouldn't break with the release).
http://addingunderstanding.com/google_analytics_module_drupal_4.7
------------------------------
Adding Understanding
--
Wow!
Wow... Thank god I stumbled on this post...
This service looks to be a killer for all those other counter utilities out there...
Its free and looks great.
http://www.google.com/analytics/
Thanks guys for the drupal module and info.
_________________________________________________
Blog - Sydney News, Current Affairs, Photography, Travelling & University...
how to track file downloads?
Does anyone know if this module will work to track file downloads. I have Drupal's download method set to:
Private - files are transferred by Drupal.
Does anyone know if that will work? I know that I can use this method to track file downloads:
http://www.google.com/support/analytics/bin/answer.py?answer=27242&hl=en
But I'm wondering if there is a way to make drupal do this automatically so I don't need to update all the download links on my site.
Interesting, please file a
Interesting, please file a feature request!
--
Ixis (UK) providing Drupal consultancy and Drupal theme design.
--
Ixis (UK): Drupal support, Drupal hosting.
Excluding Drupal Admin activities in Google Analytics
I dont think putting the analytics code inside the head section is required. I put the code inside a block and it still works.
What I did was put the analytics code inside a Google Adsense block that I created. Like this:
Excluding Drupal Admin activities in Google Analytics
So that when I'm logged in as administrator, my activities don't get reflected in my Google Analytics stats.
(Sorry for the link. I too cant post code due to 'suspicious input'.)
Good idea about not putting
Good idea about not putting tracking data in the head of admin pages. I'll amend the module to reflect this sometime soon.
--
www.bargainspy.co.uk | More Drupal modules
--
Ixis (UK): Drupal support, Drupal hosting.
How does this module persist the id?
Hi there,
I just installed your module and decided to have a look at the code. How does drupal persist "googleanalytics_account" variable that is set in the module? Is it in the db somewhere?
You enter the account id in
You enter the account id in the module settings page.
This is saved in the variables table in the dbase.
--
www.bargainspy.co.uk | More Drupal modules
--
Ixis (UK): Drupal support, Drupal hosting.
Format of user ID in googleanalytics module?
Thanks for the googleanalytics module, budda!
What should be the format of the user ID to be entered in the googleanalytics setting? Should it be UA-xxxxxx-x including the UA (and without the quotes)?
Yeah enter it exactly as you
Yeah enter it exactly as you would have it in the javascript provided by Google.
--
www.bargainspy.co.uk | More Drupal modules
--
Ixis (UK): Drupal support, Drupal hosting.
Not yet detected after 24 hours
Entered the proper user account format, but after 24 hours it still says in my account, 'Tracking not installed,' even if my site was checked recently by Google Analytics. I've also viewed the source for each of my web pages and the script is there. Any step I might have missed?
I am using a customized phptemplate version of the bluemarine theme btw.
Template types don't
Template types don't matter.
Google is pretty slack. Give it a good few days.
As a 2nd check, view your sites html and compare the generated javascript at the top of the page with that which Google provides. it should be identical.
--
www.bargainspy.co.uk | More Drupal modules
--
Ixis (UK): Drupal support, Drupal hosting.
that's a problem if you want to track downloads through Google
I added the Google module to a website a couple of weeks ago, and it works great. Now, however, the site owners want to track downloads through Google as well. I coerced the Google tracking code in the download links, and thought I was home free. Then I read the through the stuff at Google. If you want to use the download tracking code, then the Google stats code has to be above the links in the page! The nice Google module puts it at the botom. I'm not sure what the best thing is to do here, but I suppose I'm going to have to disabled the Google module and work the code into a block that I can put farther up on the page. Does anybody out there have some advice on that? I'm pretty new to Drupal, and I'm poking around in the dark.
Excluding admin/ pages is
Excluding admin/ pages is now included in the Drupal 4.7 release of the Google Analytics module available right here on drupal.org!
--
Drupal consultancy
--
Ixis (UK): Drupal support, Drupal hosting.
How exactly do you exclude
How exactly do you exclude admin pages with the google_analytics.module? I don't see anywhere to specify this other than in the custom script section, but I don't know what to put anyway.
adding the tracking code
I'm confused about where to, or whether to, add the tracking code provided by google.
If we have to add the tracking code manually, what is the module doing?
Where is the best place to add the tracking code? I tried putting it in the footer, using the footer field via settings, but now it actually displays some "_uacct = "UA-296245-1"; urchinTracker();" at the bottom of my site, which I obviosly don't want.
I originally assumed I would just enter my UA code into the module settings and it would enter the code for me, but that didn't seem to happen.
I spent some time searching and reading all the posts, but it got pretty confusing and there is currently a lot of conflicting advice.
Help.
Thank you!
All you need to do is enter
All you need to do is enter your UA-296245-1 ID in the module settings page. Set what user roles you want to track, and you're off.
--
Ixis (UK) providing Drupal consultancy and Drupal theme design.
--
Ixis (UK): Drupal support, Drupal hosting.