I seem to have issues with Google analytics and loading objects in the colorbox. If you have analytics on and you try to load for instance a node into the colorbox the browser will white screen and the error reported is document.body is null. Anybody else experiencing it as well? My workaround was to exclude the path through the GA module, but I was wondering if anyone else might have an idea.

Comments

frjo’s picture

What happens if you do the same thing with Lightbox2 or Thickbox?

jdwfly’s picture

Not sure what would happen, and I really don't have time to check. You should be able to reproduce the error fairly easily by trying to load a node in a colorbox with Google Analytics module on.

Part of the issue might be that the entire page is trying to get loaded inside the colorbox and when jquery runs it looks for a body tag but does not find one, thus the document.body is null. I'm going to try to load content in an iframe to see if it clears it up.

jdwfly’s picture

Loading the content through an iframe definitely clears up this issue, but it also creates a display problem. I want the node to display differently inside of the colorbox than it does if the actual page were loaded. As far as I can tell there is not an easy way to figure out whether or not a page is being displayed in an iframe.

Should we have some type of special path to display a simple node view in a colorbox? (colorbox/node/[nid])

hankpalan.com’s picture

I have this issue as well, I'm running Embedded Media Field using video from vimeo. The video starts to load and then the entire page goes white and hangs up on google-analytics

frjo’s picture

Status: Active » Postponed (maintainer needs more info)

Could you try to disable "Link tracking" in Google Analytics module settings and see if that removes the problem?

jdwfly’s picture

I can't remember how I fixed this... I just checked today and GA is working fine and I don't remember what I did. Anyway, if it comes to me I'll post what I did.

hankpalan.com’s picture

I disabled that, didn't work. I even tried to add a specific page to the page specific tracking section so it wouldn't load that page, still won't work.

It did work however when I disabled the google analytics module :) So its definitely some sort of conflict.

I'll try a few more combinations of things to see if I can get it to work.

Thanks for the quick reply!

noah’s picture

Category: support » bug
Status: Postponed (maintainer needs more info) » Active

I'm running into this issue consistently with any site that use Google Analytics and Colorbox. Rather than disabling Analytics altogether, it can be eliminated by disabling Analytics for the content being called within the Colorbox. So, for example, if you're showing videos in an overlay, and the videos all have a URL that starts with "video/", the Analytics config can be used to disable Analytics on pages with URLs that match "video/*" -- this eliminates the problem (but also eliminates tracking on video pages).

A little more detail on what exactly is going wrong, thanks to Firebug:

Error: document.body is null
Source File: http://www.example.com/sites/all/modules/jquery_update/replace/jquery.js?Z Line: 4355

Line 4355 looks like:

top += body.offsetTop,

It shows up in the "else" part of "if ( document.documentElement["getBoundingClientRect"] )".

Hope that's of some use to someone in sorting out the problem.

HLopes’s picture

I was having issues with Colorbox and Google Analytics.

I was using the method of adding the "colorbox" class on a link, but it was solved by updating GA module to version 6.x-3.0.

Then it just got slow, really slow, like 6 seconds minimum to load a node on colorbox.

I switched to colorbox-load method and now everything is ok, loading in a couple seconds tops.

frjo’s picture

Status: Active » Fixed
philltran’s picture

I think Google Analytics adds code to the outbound link which breaks Colorbox. As a temporary fix, I disabled tracking on outbound links.

Status: Fixed » Closed (fixed)

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