Hi
i test a bit with the labjs module..and i must say ..tracking with analystics module is not working. when i disable the module the tracking will work..so something must be wrong...

CommentFileSizeAuthor
#5 1071182_LabJS_Google_Analytics.patch584 bytesdalin
#2 analabjs.png4.35 KBeule

Comments

jcisio’s picture

Component: Code » Compatibility
Category: bug » feature

Which module?

eule’s picture

StatusFileSize
new4.35 KB

sorry the Google Analytics 7.x-1.1 a png save it..i know is not mutch visits but you see tracking works without LABjs

eule’s picture

i put the snippet from analytics in the head ..here is the source code...hope it helps

<script type="text/javascript" src="http://www.EXAMPLE.eu/sites/all/libraries/labjs/LAB.min.js?lh3og1"></script>
<script type="text/javascript"> 
<!--//--><![CDATA[//><!--
$LAB.queue(function() {
window.google_analytics_uacct = "UA-xxxxx-xx";
});
//--><!]]>
</script>
<script type="text/javascript"> 
<!--//--><![CDATA[//><!--
// LABjs exclusion
$LAB._q=[];$LAB.queue=function(){Array.prototype.push.apply($LAB._q,arguments);return this};$LAB.executeQueue=function(){var a=$LAB;for(var i=0,l=$LAB._q.length;i<l;i++){if(typeof $LAB._q[0]=="string"){a=a.script($LAB._q[0])}else if($LAB._q[0]===false){a=a.wait()}else{a=a.wait($LAB._q[0])}$LAB._q.shift()}$LAB._q=[]};$LAB.setGlobalDefaults({AlwaysPreserveOrder:true});
//--><!]]>
</script>

some css

<script type="text/javascript"> 
<!--//--><![CDATA[//><!--
$LAB.queue(function() {
var _gaq = _gaq || [];_gaq.push(["_setAccount", "UA-xxxxxx-xx"]);_gaq.push(["_gat._anonymizeIp"]);_gaq.push(["_setVar", "anonymous user"]);_gaq.push(['_setCustomVar', 1, "User roles", "anonymous user", 1]);_gaq.push(['_setCustomVar', 2, "Zeit", "02\/24\/2011 - 04:22", 2]);_gaq.push(['_setCustomVar', 3, "Besucht", "http:\/\/www.EXAMPLE.eu\/node am", 3]);_gaq.push(["_trackPageview"]);(function() {var ga = document.createElement("script");ga.type = "text/javascript";ga.async = true;ga.src = "http://www.EXAMPLE.eu/sites/default/files/googleanalytics/ga.js?lh3og1";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(ga, s);})();
});
//--><!]]>
</script>
jcisio’s picture

Status: Active » Closed (duplicate)

Ok I can confirm it. Reopen the old issue #1040734: Compatiblity with google_analytics

dalin’s picture

Category: feature » bug
Status: Closed (duplicate) » Needs review
StatusFileSize
new584 bytes

I don't think this is directly related to that other issue since that is D6 and appears to be an issue with advagg.

I'm getting a JS error:

$L is not defined. The code that throws the error is:

<script type="text/javascript">
<!--//--><![CDATA[//><!--
$L = $L.wait(function() {
window.google_analytics_uacct = "UA-289449-1";
});
//--><!]]>
</script> 
<script type="text/javascript">
<!--//--><![CDATA[//><!--
// LABjs exclusion
var $L = $LAB.setGlobalDefaults({AlwaysPreserveOrder:true});
//--><!]]>
</script> 

As you can see the GA script is called before LABjs is loaded. GA adds the JS like so:

drupal_add_js('window.google_analytics_uacct = ' . drupal_json_encode($id) . ';', array('type' => 'inline', 'group' => JS_LIBRARY-1));

Which is frustrating. "Lets all try and race to the bottom".

Not sure if LabJS module should be doing the same, or if we should request that GA not do that.

Here's a patch that makes things work.

jcisio’s picture

Which version do you use? Have you this problem with a clean install? I've just tested with GA 7.x-1.2 and don't have this problem. The order is:

<script type="text/javascript" src="http://test.hainam.com/d7a/sites/all/modules/d7/labjs/labjs.min.js?m1z110"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
// LABjs exclusion
var $L = $LAB.setGlobalDefaults({AlwaysPreserveOrder:true});
//--><!]]>
</script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
// LABjs exclusion
$L = $L.script(["http://test.hainam.com/d7a/misc/jquery.js",
// etc.
"http://test.hainam.com/d7a/modules/toolbar/toolbar.js"]);
//--><!]]>
</script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
$L = $L.wait(function() {
if (typeof(_gaq)=="undefined") _gaq=[];_gaq.push(["_setAccount", "UA-00000000-00"]);_gaq.push(["_trackPageview"]);(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);})();
});
//--><!]]>

I can see that utm.gif is sent to GA.

dalin’s picture

See here
http://drupalcode.org/project/google_analytics.git/blob/refs/heads/7.x-1...

Looks like this only applies if you're tracking adsense.

jcisio’s picture

Status: Needs review » Fixed

Ok let's join the race. Fixed with http://drupalcode.org/project/labjs.git/commit/9406ce4
Thanks.

udvranto’s picture

Did you patch the 6.x branch as well?

jcisio’s picture

A priori D6 does not have this kind of problem.

vacilando’s picture

Title: incompatible with analystics module » Incompatible with Google Analytics module

Adjusting the title...

Status: Fixed » Closed (fixed)

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