Data not appearing in Google Analytics

stinky - February 15, 2008 - 00:50
Project:Google Analytics
Version:5.x-1.4
Component:Documentation
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I see the js code on my pages,

_uacct = "UA-1209333";urchinTracker();

However, the data isn't showing up in Google Analytics.

I have the

<?php
print $closure
?>
statement in my page.tpl.php file.

I've tried downloading the dev version, but the js code didn't appear on any of the pages.

#1

stinky - February 15, 2008 - 00:55

I wonder if the problem is that the modules is using old style Google analytic tracking code, see https://www.google.com/support/googleanalytics/bin/answer.py?answer=7512...

#2

highfly - February 15, 2008 - 04:18

I'm experiencing the same problem on my site. A manual review of the source code from my landing page shows that the following code appears in the body:

_uacct = "UA-3165214";urchinTracker();

Furthermore, my google analytics page says that it is "receiving data".

However, no activity is turning up in my goal funnel visualization reports, despite my ads having received in excess of 100 clicks. I suppose that a few people might have clicked the ads and then suddenly changed their mind, but it seems odd for this to have happened over 100 times.

#3

hass - February 15, 2008 - 18:48
Status:active» active (needs more info)

I'm using version 1.3, too in production and checked my GA a few seconds ago... it shows data from yesterday!?

Shouldn't your GA code not something like _uacct = "UA-3165214-1"

#4

stinky - February 16, 2008 - 21:04

You're right. I was using my base GA code and not the site specific one. My bad. Thanks for pointing this out. I don't think this info is too obvious on the GA site. I looked at it a zillion times.

This module uses the old GA code though, and not the new. Guess I'll just put the GA code in my page.tpl.php file.

#5

hass - February 17, 2008 - 00:01
Category:bug report» support request
Status:active (needs more info)» fixed

Do you like to use the new GA? Upgrade the module to 1.4 and you are able to choose Urchin or GA... it's your choice. No need to edit any template files...

#6

a great place f... - February 17, 2008 - 22:40

I'm having the same problem. Should I just add -1 to the end of my code. Where did that come from?

#7

hass - February 17, 2008 - 23:05

"-1" is your first site registered in Google Analytics... If you look into the JS code you should normally (w/o Drupal) integrate into your site - look carefully inside the JS code... you will see the correct number of your current site you are editing. If you have more then one site registered in GA you may have -2, -3, etc.

We should think about adding a regex for verification to this GA number field in google_analytics config module... :-). I'm not sure if something like UA-(\d+)-(\d+) is save to verify.

#8

Chadimoglou - February 19, 2008 - 01:30

I seem to be having the same problem..

Google Analytics isn't receiving data. I have entered the correct UA- code but when I view the source of my webpage it doesn't show the javascript correctly. It still shows the document.write() markup being there. Could this be the problem? Am I missing some other setting?
The website is as follows.
http://www.nascarfreedom.com

Thank you
Chad

#9

congthai - February 19, 2008 - 01:33

You should saw theme.

Because the theme decide to so content together javascript and CSS. I think so.

#10

hass - February 19, 2008 - 02:19

@Chadimoglou: I checked your site footer and it looks good. Additional "Firebug" logged a request to Google - so everything should be fine!?

I'm running 5.x-1.4 in production and it works, well. Only difference i can see is - you are not using download tracking, maybe you removed all extensions from the default list!? But this shouldn't be any problem at all...

#11

highfly - February 19, 2008 - 03:31

Thanks for your help Hass ... I will try again and check carefully for the "-1" at the end.

#12

hass - February 19, 2008 - 08:52

It may be -2 or -3 or higher... -1 was only an example. You must check your GA account to be sure. If you have more than one site this number must change - or you added one, deleted it, re-added and now it is a higher number...

#13

Chadimoglou - February 19, 2008 - 15:55

@Hass

Thank you for looking at everything. Yes I did delete the other data types. I thought that might have had something to do with it. I guess not though.
Google is now receiving data.

Thanks again!
Chad

#14

lefnire - February 21, 2008 - 17:34

what data types should be present? the ones that were set up automatically were pdf|zip|mp3, should php be in the mix or what?

yeah, same issue here... i have -1 on there, my analytics javascript shows up just fine in the footer, but analytics still isn't receiving any information....

reverting back to prev. version until fixed

#15

hass - February 21, 2008 - 20:31

@lefnire: there is no known bug in v1.4 and it is working well. As a follow up of this support requests i decided to create a "Google Analytics account number validation" patch in http://drupal.org/node/223046, but this is not a bug.

#16

cfowler - February 25, 2008 - 17:42
Version:5.x-1.3» 5.x-1.4

Hi,

I was encountering the same problem as others in that Google Analytics indicated it was receiving data, yet I did not see any visitors. I am using 5.x-1.4. I learned about a scanner called "sitescanga" (http://www.sitescanga.com), which scans sites for free to see if they have correct JavaScript on their sites to work with Google Analytics. Anyway, the scan results indicated I did not have the SSL version of tracking code on secure pages. Since my site uses SSL, this seemed possible. When I compared the generated JavaScript with what Google Analytics says I should emit, I got the differences shown below (as you can see I am using the new GA JavaScript):

JavaScript on my web site:
----------------------------------

document.write(unescape("%3Cscript src='http://www.google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

JavaScript recommended by Google Analytics:
-----------------------------------------------------------

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"));

After seeing this error, I locally modified the PHP code to emit the exact same code as recommended by Google Analytics. After rerunning sitescanga, I no longer got the error diagnostic mentioned above. And, most importantly, I am now getting statistical data on my site that I can see in the reports.

The weird thing is I am still getting a problem diagnostic from "sitescanga", specifically "Tracking Code Installation - Problem". When I drill down for more detail, the detailed diagnostic is "missing ga.js". I have checked the generated JavaScript on my home page (the page where the error was flagged) and it looks fine. So, I do not know whether this is a real issue on my site or a case where the scanning tools simply had trouble parsing the home page to locate the JavaScript. I'd definitely be interested in knowing if others have encountered this and what they learned.

The last thing I am wondering about is the "downloadtracker.js" script. I have seen some CVS comments indicating it does not work with ga.js. But code to call it is emitted in my case. Should "downloadtracker.js" be run? I would definitely like to get download statistics. I also wonder whether somehow the JavaScript for "downloadtracker.js" is somehow tripping up "sitescanga".

Thoughts?

Thanks,

Chuck

#17

hass - February 25, 2008 - 18:20

We are not using the ga.js standard HTTPS detection... we use our own logic from urchin days. This should work well, too. I'm sure a site checker complains - something is wrong, but it isn't. Until Google does not complain there is no need to change.

I've added ga.js downloadtracker support with v1.4 and it works for me.

After you have added the module and enabled it, entered the CORRECT Google Analytics Account Number of your unique site, and it will runs, you must wait 1-2 days until data is shown in Google Analytics. I'm sure you see it...

As i remember all the above posts. All people have used a wrong "Google Analytics Account Number" for their site or have been tooo impatient. And i assure you all, v1.4 with ga.js is running fine with downloadtracker. Don't be so impatient with Google... :-)

#18

lefnire - February 25, 2008 - 20:32

mine at least has the correct account number & still didn't work. I copied & pasted the account number that's given in the javascript code that google provides, nada. so I uninstalled analytics module and pasted the google-provided code into my theme, and it's working. same acct # that I fed to the module. i'll just go this route for now.

#19

hass - February 25, 2008 - 22:18

1. Have you used the legacy (urchin.js) or new ga.js version?
2. Was the site already been checked and approved by google or new?
3. Is Google telling you it receives data?

#20

lefnire - February 25, 2008 - 22:20

1) ga.js
2) checked & approved for about a year
3) yes

#21

hass - February 25, 2008 - 22:32

Are you able to send me a screen shot of your GA settings page in Drupal and provide a link to your site with the active module, please.

#22

drupalrocks - February 26, 2008 - 02:17

I am also having trouble with the new version. Google is saying "Tracking code not detected "
link: http://rookiesite.com
- new site, just got verified by google today. (can this be the reason?)
I've used this module (previous versions) with other sites, so I am confident that I used it correctly.
Thanks very much!

#23

lefnire - February 26, 2008 - 04:04

i attached the settings page and html output. I can't give you a live URL because that would require breaking analytics on the current site & my client would have a fit ;)

EDIT: oh, and the live site where analytics works (embedded into page.tpl.php) is http://indianchiefguides.com

AttachmentSize
settings.zip32.25 KB

#24

hass - February 26, 2008 - 07:19

@lefnire: This config is nearly 1:1 the same like mine except segmentation and for me it works. I cannot figure out what could be wrong if there is not enough information.

1. Could you try to figure out with Firebug/LiveHTTPHeaders what's happen if the page is fully loaded. For e.g. if the Google image "__utmf.gif" and downloadtracker.js are loaded or not.
2. Is the HTML code added to the site or not? How does it looks like?
3. Could you try urchin.js (legacy mode)?

@drupalrocks: could you provide a screenshot of your GA settings page, please? Until the site is not verified, nothing is logged. Is it now working or not?

#25

lefnire - February 26, 2008 - 17:50

you're going to kill me... in the code I gave you I forgot to remove the modifications I made to page.tpl.php, which contained the google-provided javascript. so the html source has both your module's html and google's html.
i set up a dummy version of the site at http://ic.lefnire.selfip.com which contains only the module's html (same settings as the image I gave you), and you can compare the source to http://indianchiefguides.com which contains only the google-provided code. i figured this would be best because I'm not much of a firebug pro, but if there's something you still need me to do maybe just point me to a livehttpheaders tutorial or something and i'll see what i can do.

as far as urchin, i tried that already no success.

#26

hass - February 26, 2008 - 18:20

I wonder how urchin cannot work... i haven't changed anything at urchin in D5. The logic changed a little bit with D6... but not very much. I would not expect any problems with this change - but nothing is impossible. Never say - no :-)

I'm really interested in this "edge-case"! I feel like there have been opened "many" cases with this "my site is not tracked" or something similar. I'm sure we already identified the missing regex check on the account number that would prevent ~60%, and another ~30% for the change that you must activate tracking for every role you'd like to track and not vice versa what could be very problematic if an non anonymous group get tracked and you don't like this. I'm not sure what more is possible, but i'd like to make it 99% save from support side...

You should really install the Firefox Plugin named "Firebug". It sooooo helpful for development and analysis... a simple page load, one click on "Net" and it shows you all files downloaded and how long it took and so on an so on.

I checked your above test site and it looks correct... if there is something wrong, please report... your mail sounds like it is now working well!?

#27

drupalrocks - February 27, 2008 - 01:57

unfortunately it's still not working even though the site has been verified already. Thanks.

AttachmentSize
rookiesite_ga_screenshot.png.tar_.gz93.7 KB

#28

hass - February 27, 2008 - 08:14

@drupalrocks: What page have you tried? In your screenshot it looks like you do not have menu node items. I could be wrong... but i don't see them. Have you read "admin pages are never tracked"? Please provide a link to the page with the active module. Does your theme have a $closure variable? See your page.tpl.php code...

#29

drupalrocks - February 27, 2008 - 13:32

I don't quite understand "What page have you tried? In your screenshot it looks like you do not have menu node items.". Which page? and what "menu node items" do I need? sorry for being so ignorant.

I don't have $closure in my theme. by comparing with other themes, I added "

<?php
print $closure
?>
" after footer. unfortunately, no luck so far.

Thanks

#30

hass - February 27, 2008 - 14:05

If your theme do not have a $closure variable - file a bug against the theme, please!

Google analytics module cannot work with such a faulty theme. We are adding the JS code into the $closure variable... for a simple verification - if the module works correctly - simply turn on garland theme on your box and check your source code again. If GA JS code is added to the page closure, the module works as expected and your theme is broken.

#31

drupalrocks - February 27, 2008 - 17:25

it's working with garland now. One more lesson learned. Thanks!

#32

jkg - March 1, 2008 - 09:09
Category:support request» bug report
Status:fixed» active

I upgraded to 1.4 recently from 1.3. I no longer see the tracking code on any page.
I also tried to upgrade to the latest 1.x-dev version but still no luck. What could be the issue?

Update:
The theme has the $closure variable and everything was working perfectly when v1.3 was installed.

#33

jkg - March 1, 2008 - 09:17
Component:Code» Documentation

I found the issue the setting now is "Define what user roles should be tracked by Google Analytics" while earlier it was the opposite.

We should update the documentation that people who are upgrading from releases upto 1.3 to a higher release will have to set the check boxes as opposite of their present values.

#34

Shane Birley - March 3, 2008 - 17:40

Upgrade info:
All people upgrading from 5.x-1.3 or earlier should be aware, we flipped the tracking logic to the opposite. From 5.x-1.4 and above we only track a role if this role is explicitly checked. This makes sure we are not starting to track internal roles you don't like to be tracked.

#35

hass - March 6, 2008 - 19:48
Status:active» fixed

Should be enough if on project home!?

#36

Shane Birley - March 6, 2008 - 19:52

I think it would be cool if the update status system were to have the ability for project owners to send notes when it may be something that is required to note. A lot of people will update modules but not check to see what is changed. This change of logic in the module is crucial to know but when you can download the module right from your own web site I suspect a majority of module updates are done without checking the project pages themselves.

#37

hass - March 6, 2008 - 20:21

Yes i know - shame on my head, but we cannot fix this now or we break all installations already upgraded to v1.4 again. I cannot say what's more bad.

#38

Shane Birley - March 6, 2008 - 20:33

I don't think it is that bad. The worse thing that will happen is someone will lose some analytics data from Google.

I think the way to avoid this kind of stuff in the future is to modify the update status module to pull in the actual comment text from the CVS/SVN system - that way, when there is an official release of a module, they can add appropriate text that would say what changes were made and what the manager of the Drupal installation should be aware of before updating.

On the other side, development releases of modules shouldn't be included in this method since those can be just plain bug fixes and releasing text like that is not recommended and useless since it would change all the time and if multiple developers are working on a module, it would cease to make sense after a while.

Those are my two cents. :)

#39

hass - March 6, 2008 - 20:43

Open a feature request for update_status. I'm not sure if dww closes this after some minutes...

I'm only saying i cannot add an update hook to flip all values now... it's too late i think or updated sites get untracked again.

#40

Shane Birley - March 6, 2008 - 21:05

Done and done. :)

http://drupal.org/node/230893

#41

Tobias Maier - March 7, 2008 - 09:49

I had the same problem regarding the behaviour change of which roles get tracked.

Can't you add it to in bold letter to the Release node http://drupal.org/node/222287
If you can't do it by yourself ask one of the admins to do it for you

#42

hass - March 7, 2008 - 12:46

Done

#43

Anonymous (not verified) - March 21, 2008 - 12:51
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.