hi, i recently upgraded our drupal from 6.16 to 6.19 and our google analytics module from 6.x-2.2 to 3.0 (and then a couple days later to 3.0-dev). i also updated a number of other modules at the same time.

after this, google analytics dashboard started showing 0 visits for our domains (we have just one Drupal installation which is multi-site, using the domain module (http://drupal.org/project/domain), but we don't set separate Google Web Property ID's for each site -- instead we just use one ID for all of them and then set filters at Google Analytics dashboard in order to view results for each domain separately).

we are running Fedora 9 with apache 2 and php 5.2.6.

i have checked that the google analytics code being generated by the module is correct, by running it through http://sitescanga.com , and it says that it is.

we do have some custom javascript "Code snippet (after)" code,

pageTracker._setDomainName(".example.com");

..which was the same before the upgrade, and which is still there (despite the message we got after the upgrade that we have to replace it).

so everything appears to be the same on our pages as before. the script IS being inserted, and everything looks fine. so i can't imagine what would be different unless somehow the drupal 6.19 is sending a slightly different response header or something, and Google thinks it might be a different machine now? but i haven't pursued that further.

here is our code (with ID and domain changed to protect the innocent) which shows up for all anonymous visitors:

<script type="text/javascript">
<!--//--><![CDATA[//><!--
var _gaq = _gaq || [];_gaq.push(["_setAccount", "UA-1234567-1"]);_gaq.push(["_trackPageview"]);pageTracker._setDomainName(".example.com");(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>

i was going to post this question on the Google Analytics help forum but I thought I'd post here first. would anyone have any ideas? i'd be most appreciative.

Comments

jastern’s picture

just to clarify which version of the module we're using: i noticed we had this problem with 6.x-3.0 so i tried the 6.x-3.x-dev version hoping it would solve the problem but hasn't. to date we're still using 6.x-3.x-dev (oct-01).

i have not tried "downgrading" back to 6.x-2.x series..

hass’s picture

Title: Using non-async custom tracking code snippets causes tracking failure (0 visits) » analytics shows 0 visits since upgrade
Status: Fixed » Active

pageTracker._setDomainName(".example.com"); is invalid! You must upgrade to async!!! This is why the message appeared. Aside it is and was wrong that you entered it into the AFTER page tracker textarea. This must be placed BEFORE... You schould read GA API docs more carefully.

_gaq.push(["_setDomainName", ".example.com"]);

hass’s picture

Title: analytics shows 0 visits since upgrade » Using non-async code causes tracking failure (0 visits)
Status: Active » Fixed
hass’s picture

Title: Using non-async code causes tracking failure (0 visits) » Using non-async custom tracking code snippets causes tracking failure (0 visits)
izmeez’s picture

I am also having this problem and do not understand what the solution is.

I was using the Google Analytics 2.2 module and switched to 3.0
I did not uninstall 2.2, simply replaced it with 3.0 and ran update.php
Do I have to obtain a new Google tracking code for async ?
Or is there something else I have to do to upgrade to async ?

Thanks,

Izzy

hass’s picture

Title: analytics shows 0 visits since upgrade » Using non-async custom tracking code snippets causes tracking failure (0 visits)
Status: Active » Fixed

You need to upgrade your CUSTOM tracking code snippets manually after the upgrade to 3.x (async). The answer to the specific example is above.

You schould read GA API migration examples at http://code.google.com/intl/de-DE/apis/analytics/docs/tracking/asyncMigr.... If you do not understand how to upgrade, delete the entered custom snippets and ask someone who have configured it how to upgrade the previous code snippets. There is no support here for custom code snippets.

izmeez’s picture

Sorry, I did not read the full title of this issue. I am not using any custom code snippets, only the php code to exclude some roles. But have been having difficulties getting things to work with the upgrade from 6.x-2.2 to 6.x-3.x

I do not want to hijack this issue and will search the issue queue or open a specific issue. Thanks,

Izzy

hass’s picture

Nothing has changed regarding this... Must work as before

Status: Fixed » Closed (fixed)

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