Sorry, I had lost track of this thread. Yes, your code is at least odd, perhaps ultimately doing nothing on tab load. You may only have one countries.onajaxpageload function, in your case, the second one overwrites the first, so:
Code:
countries.onajaxpageload=function(){
pageTracker._initData();
pageTracker._trackPageview();
}
never happens. This one:
Code:
countries.onajaxpageload=function(pageurl){
jQuery(document).ready(function($) {
$('a[rel*=facebox]').facebox()
})
pageTracker._initData();
pageTracker._trackPageview();
}
overwrites it. But the jQuery(document).ready event has already passed, so I doubt that part does anything, it may even throw an error and prevent execution of:
Code:
pageTracker._initData();
pageTracker._trackPageview();
So, I'd just forget about facebox, at least until we can see if we can get the Google Analytics working. I took my init for that from one I found on a page on Dynamic Drive, but yours looks different, so let's try that. Replace both of your countries.onajaxpageload functions with:
Code:
countries.onajaxpageload=function(){
try{
var pageTracker = _gat._getTracker("UA-XXXXXXXX-X");
pageTracker._trackPageview();
} catch(err) {}
};
Make sure the live page is updated and not showing in the browser. Clear the browser's cache, then navigate to the live page to see what the effect has been.
We still have a potential problem, one I'm not sure if there is anything we can do about. Either or both of these functions:
_gat._getTracker("UA-XXXXXXXX-X")
and:
instance._trackPageview()
May only be allowed to run once. If it's just _gat._getTracker("UA-XXXXXXXX-X") we could remove that line and try again with just:
Code:
countries.onajaxpageload=function(){
try{
pageTracker._trackPageview();
} catch(err) {}
};
If the instance._trackPageview() can only be run once, there isn't a lot we can do. Perhaps there is a forum where Google Analytics is discussed. If so, they may have a solution.
Another thing to try though would be using only:
Code:
countries.onajaxpageload=function(){
try{
pageTracker._initData();
pageTracker._trackPageview();
} catch(err) {}
};
But it could be possible that the Google Analytics code is not flexible enough to be applied to AJAX imported content.
Bookmarks