Log in

View Full Version : Administrative and Maintenance Tools - Google Analytics in the Archive (and Forum) by BOP5


BirdOPrey5
01-01-2011, 10:00 PM
Brought to you by BirdOPrey5
www.Qapla.com (http://www.qapla.com/mods/)

Upgraded to version 1.6 - Updated option to put code in header OR footer on forum pages.


Header - Recommended location by Google for the Asyncronous Code (the popular code)
Footer - Recommended location for non-Async (legacy) tracking code.


I strongly urge everyone to confirm with google your code is working by checking the analytics the next day after installing to confirm your hits are bing registered. The google tool for confirming the code is on the page is not good enough!

The main purpose of this mod was originally to add your Google Analytics code to the archive. The archive traditionally gets overlooked because the standard instructions of copying your analytics code into the footer doesn't cover the archive.

You simply copy and paste the full analytics code Google gives you into the mod options and enable it.

Optionally you can also use this mod to put your analytics code in the regular forum (non-archive) as well, however if you have already manually put your analytics code in the footer you should leave this option disabled.

To confirm it is working go to your archive and view the source on any archive page. At the bottom directly above the VB Copyright info should be your google code.

I have tested this on 4.0.8, 4.1.12, and 4.2.0 and it will work in all 4.0.x and 4.1.x /4.2.x at least.

For a VB 3.8 version see here: https://vborg.vbsupport.ru/showthread.php?t=246171

You won't see any indication on the pages but you can demo the product at:
www.qapla.com/mods/

Please mark as installed if you use this. :)
Donations Always Appreciated. :up:

English - Download .zip file. Version 1.6
Arabic - Translated by Dr. OsamA - Download .xml file. Version 1.13 (old version)

BirdOPrey5
01-01-2011, 11:29 PM
Reserved

raicars
01-02-2011, 08:35 AM
Product not work
Demo:

http://www.yhanoi.com/forum/archive/index.php

Dr.osamA
01-02-2011, 01:21 PM
installed + 5 stars
showing only in archive no else

translated to Arabic , plzz be nice and add translation to 1st original post

thank you

Edit : update translated XML file to version 1.13

BirdOPrey5
01-02-2011, 01:29 PM
Product not work
Demo:

http://www.yhanoi.com/forum/archive/index.php

Can you show me a screenshot of the mod setting you are using?

BirdOPrey5
01-02-2011, 01:31 PM
installed + 5 stars
showing only in archive no else

translated to Arabic , plzz be nice and add translation to 1st original post

thank you

Are you saying you tried it in the forum and it didn't work? What VB are you using?

raicars
01-02-2011, 03:11 PM
Images Option

BirdOPrey5
01-02-2011, 04:00 PM
OK, I'm not 100% sure what is wrong but I just updated to a new version, 1.13. Please try it now and let me know if it's any better.

raicars
01-02-2011, 04:58 PM
I has just update product 1.1.3.
It's not word :d.
http://www.yhanoi.com/forum/archive/index.php

BirdOPrey5
01-02-2011, 05:06 PM
I has just update product 1.1.3.
It's not word :d.
http://www.yhanoi.com/forum/archive/index.php

Just FYI it IS working in the forum- I see this code in your "view HTML source" on your forum:


<!--Google Analytics in (Forum) Begin-->
<script type="text/javascript">
var _gaq = _gaq || [];

_gaq.push(['_setAccount', 'UA-11533753-1']);

_gaq.push(['_setDomainName', 'none']);

_gaq.push(['_setAllowLinker', true]);

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

})();
</script>
<!--Google Analytics in (Forum) End-->


I will continue to see if I can think of anything blocking it in the archive.

BirdOPrey5
01-02-2011, 08:41 PM
I has just update product 1.1.3.
It's not word :d.
http://www.yhanoi.com/forum/archive/index.php

Could you try one more thing for me... in the mod settings erase all the google analytics code and replace it with:

<p> THIS IS A TEST </p>


And then go to your archive and see if you see "THIS IS A TEST" on your page?

Dr.osamA
01-02-2011, 11:11 PM
thank you for update

i am using VB 4.1.0
now it is 100% ok

working very good

i will update translated XML file

thank you sir

OldSchoolDSL
01-02-2011, 11:47 PM
Installed & working

4.1 PL2

This should be a default setting in vBulletin :)

BirdOPrey5
01-03-2011, 03:17 AM
thank you for update

i am using VB 4.1.0
now it is 100% ok

working very good

i will update translated XML file

thank you sir

Thank you, I have added the translation to the main post. :up:

Installed & working

4.1 PL2

This should be a default setting in vBulletin :)

Thank You. :)

BirdOPrey5
01-04-2011, 03:06 AM
Updated again to version 1.3... There was an issue where people who had the "Branding Free" vBulletin license couldn't get this to work in the forums (because the copyright text isn't present.) - I have altered the mod so it will always add the code to the footer regardless of the vBulletin copyright.

If you don't have the branding-free vBulletin license there is no need to upgrade.

OldSchoolDSL
01-04-2011, 03:13 AM
Updated again to version 1.3... There was an issue where people who had the "Branding Free" vBulletin license couldn't get this to work in the forums (because the copyright text isn't present.) - I have altered the mod so it will always add the code to the footer regardless of the vBulletin copyright.

If you don't have the branding-free vBulletin license there is no need to upgrade.

Do not think I needed to update, but did anyways.

Didn't un-install the previous version....

Simply imported and told it to over write....

Installed and working

4.1 PL2

Thank you :)

BirdOPrey5
01-04-2011, 11:35 AM
Do not think I needed to update, but did anyways.

Didn't un-install the previous version....

Simply imported and told it to over write....

Installed and working

4.1 PL2

Thank you :)

You're welcome.

Please go to your Admin CP -> Plugin Manager, scroll down to "Google Analytics in Archive" and see how many plugins are listed. If there are 2 you're good, if there are 3 then an old one didn't get removed. That was the reason I suggested uninstalling first.

OldSchoolDSL
01-04-2011, 03:51 PM
You're welcome.

Please go to your Admin CP -> Plugin Manager, scroll down to "Google Analytics in Archive" and see how many plugins are listed. If there are 2 you're good, if there are 3 then an old one didn't get removed. That was the reason I suggested uninstalling first.

There is only 1

But everything is working, so I'm not worried.

BirdOPrey5
01-06-2011, 10:37 PM
Updated again to version 1.3... There was an issue where people who had the "Branding Free" vBulletin license couldn't get this to work in the forums (because the copyright text isn't present.) - I have altered the mod so it will always add the code to the footer regardless of the vBulletin copyright.

If you don't have the branding-free vBulletin license there is no need to upgrade.

Wow... downgraded this back to 1.13- back to the drawing board as the "fix" I put in v 1.3 causes more problems then it fixes. :o

OldSchoolDSL
01-06-2011, 10:45 PM
Wow... downgraded this back to 1.13- back to the drawing board as the "fix" I put in v 1.3 causes more problems then it fixes. :o

So I guess I've been lucky!?! (no issues here)

Think I'll keep it and not downgrade just yet.

But I really do want to thank you for all the hard work you continue to put into this mod and others here.

BirdOPrey5
01-06-2011, 10:57 PM
Thank you for that. The issue is only related to showing the code outside the archive so if you keep that part disabled you won't have any issues in any version.

In version 1.13 it works fine if you don't have a branding-free license.

In version 1.3 (which I removed) it will display the google code but stop most of the rest of the footer from showing at all.

BirdOPrey5
01-06-2011, 11:26 PM
OK... it turned out to be a pretty easy fix... now upgraded to version 1.4... I really think this will be the final version unless some new functionality is asked for.

I suggest everyone upgrade to 1.4, especially if you have version 1.3 OR a branding-free license.

OldSchoolDSL
01-07-2011, 02:34 AM
OK... it turned out to be a pretty easy fix... now upgraded to version 1.4... I really think this will be the final version unless some new functionality is asked for.

I suggest everyone upgrade to 1.4, especially if you have version 1.3 OR a branding-free license.

Upgraded....

Import > Allow Over write > YES

Installed and working

4.1 PL2

GoHighVoltage
01-19-2011, 03:20 PM
One question, Google says to install it here:

Copy and place the code snippet
Once you find the code snippet, copy and paste it into your web page, just before the closing </head> tag*. If your website uses templates to generate pages, enter it just before the closing </head> tag in the file that contains the <head> section. (Most websites re-use one file for common content, so it's likely that you won't have to place the code snippet on every single page of your website.)
For the best performance across all browsers we suggest you position other scripts in your site in one of these ways:

* before the tracking code snippet in the <head> section of your HTML
* after both the tracking code snippet and all page content (e.g. at the bottom of the HTML body)

BirdOPrey5
01-19-2011, 04:05 PM
Google suggests it near the <head> tag so it means the Analytics code will always load and be counted even before the rest of your pages loads. In an ideal world this would be best for you and Google. But in the real world sometimes Google's codes don't load so fast and putting it here would prevent the rest of your page from being displayed until it finishes loading which can cause you to annoy users.

From experience with vBulletin and Google I, and I think most, admins have come to the conclusion it's best in the footer so the page can load before the Analytics code. If a couple of visitors aren't counted because they change pages too fast, so be it.

It definitely works in the footer where this mod puts it, it's where I've always had it and have installed/tested it on numerous forums and used Google's own tools to confirm the code is active and deployed.

8thos
01-20-2011, 03:47 PM
Installed.

BirdOPrey5
01-20-2011, 09:47 PM
what exact version are you using?

And just to confirm this is viewing online.php?

Does it go away if you turn it off in your forums?

Manandrox
01-21-2011, 01:14 PM
Hi Bird!

Ok, I edited my post. I apologize, I was not clear. It is only 1 or 2 people that will show that location.

I am using 4.1. Yes, the online.php? page.

The Google Analytic code, on page view, shows up on the page great! I just disabled it now so I will watch it for a few hours to see. It seems that it was just the registered users that were showing this location.

BirdOPrey5
01-21-2011, 05:37 PM
Do you by chance have some sort of mod that attempts to minimize or combine javascripts?

I can't replicate the problem and the file path you posted:
/folder/forumdisplay.php/clientscript/vbulletin_css/style00002l/.google-analytics.com/ga.js
shouldn't even exist... :confused:

Manandrox
01-21-2011, 07:44 PM
Do you by chance have some sort of mod that attempts to minimize or combine javascripts?

I can't replicate the problem and the file path you posted:

shouldn't even exist... :confused:

Ok, I still get the error with the mod disabled.

Unknown Location

Unknown Location
/folder/member.php/1-user

So it is something else. I will delete my previous post.

Awesome mod though!!! Thanks!!!

BirdOPrey5
01-21-2011, 08:54 PM
Thanks for confirming... I would check your plugins for any mods on the "member_location" hook first.

bosken
01-22-2011, 03:22 AM
Installed on v.4.1.1 Works

HughM
01-22-2011, 05:36 PM
Nice mod. I'd put the code into the template manually, but it's nice to have it nicely configurable...

HughM
01-26-2011, 10:31 PM
I'm going to have to take back my "Nice mod" comment...

You have a nasty bug in your code, and I've now got no idea where, on our website's launch day, people came from, or what they did. This was important to me.

Your mod allows admins to have the code inserted into both the archives and the main forum. The archives bit works fine, but on the main , when it inserts the code, it has escaped each and every quote...

My main forum footer had something like the following in:


<script type=\"text/javascript\">

var _gaq = _gaq || [];
_gaq.push([\'_setAccount\', \'UA-########-#\']);
_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);
})();

</script>

Which was never going to work...

Obviously, we didn't pay for it, and there's no guarantee that it'll work, but it's still incredibly annoying, and I'm sure others will be very appreciative of a fix to this one...

BirdOPrey5
01-26-2011, 11:41 PM
Wow very sorry about this. I do see the bug and have fixed it and released a new version. I did use the check in google analytics to confirm the code was on the page, I don't understand how it confirmed it with the bad code.

Anyway here is a copy and paste of the code from my actual page with this code from version 1.5:


<!--Google Analytics in (Forum) Begin-->
<script type="text/javascript">
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"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-5383701-1");
pageTracker._setSessionTimeout("3600");
pageTracker._trackPageview();
</script>
<!--Google Analytics in (Forum) End-->


As to why this bug was there, it seems in the VB 3.x version the add-slashes is necessary (as they are removed before being output) but not so in VB 4.x.

OldSchoolDSL
01-26-2011, 11:49 PM
Upgraded to 1.5 (allow overwrite, yes)

Installed

4.1.1

To the best of my knowledge, its working.

HughM
01-27-2011, 06:41 AM
Thanks for the speedy update... Will install and give it a go...

Someone else pointed out that we've still got awstats running on the server, so we've got some idea of what went on and where people came from...

Anyone know if you can give google analytics a chunk of access.log and get it to update itself? That'd be very cool to be able to do...

OldSchoolDSL
03-05-2011, 03:03 AM
This was a wonderful modification and well thought out. It works flawlessly in 4.1.2.

vBSEO has this build in it (Google Analytics) though and I'm converting to Mint, which runs locally and does not depend on an outside link (in this case, Google).

Un-installed.

BirdOPrey5
03-05-2011, 11:55 AM
I looked at Mint but it's requirement for javascript to be on to count a hit kind of defeats the purpose of self hosted analytics IMO. The biggest issue with Google isn't load times but that if someone is browsing with noscript enabled (like I'd imagine your users might be prone to do) Google will never count them. Mint won't either though.

OldSchoolDSL
03-05-2011, 01:01 PM
I looked at Mint but it's requirement for javascript to be on to count a hit kind of defeats the purpose of self hosted analytics IMO. The biggest issue with Google isn't load times but that if someone is browsing with noscript enabled (like I'd imagine your users might be prone to do) Google will never count them. Mint won't either though.

This is true... Users running noscript (http://noscript.net) are not always be counted. Know of any alternatives for local tracking?

This was a very useful modification though and you should be very proud of the work you help provider here for this community.

Luca_ITA
08-06-2011, 02:42 PM
Just installed in 4.1.5pl1
Working perfectly
Thank you for this mod!!

misericorde
10-17-2011, 03:27 AM
thank you

Nice

datoneer
11-10-2011, 12:58 PM
I can't see analytics on my forum. Not working at all

vb 4.1.5

BirdOPrey5
11-10-2011, 03:42 PM
link to your forum? Is mod still installed?

datoneer
11-10-2011, 04:35 PM
Yes. www.imspot.org

BirdOPrey5
11-11-2011, 01:11 PM
Yes. www.imspot.org

When I view the HTML source of your page, this code is clearly there:


<!--Google Analytics in (Forum) Begin-->
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-26306379-1']);
_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);
})();

</script>
<!--Google Analytics in (Forum) End-->


So it appears to be fine. :confused:

GoHighVoltage
11-20-2011, 12:12 AM
This mod causes your scheduled tasks not to work. As soon as I uninstalled, they worked fine again.

BirdOPrey5
11-20-2011, 01:12 AM
This mod causes your scheduled tasks not to work. As soon as I uninstalled, they worked fine again.

There's probably more to this issue as it's working fine on many various 4.x forums. But it's no big deal, adding the code to your template or using a similar mod is easier than trouble-shooting.

GoHighVoltage
11-20-2011, 05:02 AM
I have a clean install of 4.1.8 and it causes the scheduler to fail. Remove and it works fine.
I will leave uninstalled for now. great mod and idea though!!!

Maybe it is just my situation. Thanks!

BlueCheri
02-21-2012, 04:03 PM
Installed, very smart thinking.

Working fine.

Thanx

G!

Pandemikk
03-31-2012, 07:16 AM
Excellent work BOP. I'm sorry to say that I'm going to have to "steal" your idea for automatic archive GA integration :D.

BirdOPrey5
03-31-2012, 02:56 PM
https://vborg.vbsupport.ru/showthread.php?t=234608 ;)

Pandemikk
04-01-2012, 01:00 AM
Nope, only yours :D

Thierry Martin
05-30-2012, 07:42 AM
Installed but disappointed to see it is at the bottom of the page instead of the recommended by Google just before the closing head tag. Is there a problem putting it there?

BirdOPrey5
05-30-2012, 11:21 AM
Installed but disappointed to see it is at the bottom of the page instead of the recommended by Google just before the closing head tag. Is there a problem putting it there?

That was a throwback to older times when the footer was the recommended location. Updated to version 1.6 with option to use header instead. :up:

Thierry Martin
05-31-2012, 02:40 AM
That was a throwback to older times when the footer was the recommended location. Updated to version 1.6 with option to use header instead. :up:

I noticed when trying to install the code manually before the header in the archive page that the page stopped functioning so I ended up putting your code back in the footer. Something doesn't work there.

BirdOPrey5
05-31-2012, 12:01 PM
I didn't move it for the archive, just the forums. Archive is fine as is.

Syxguns
10-03-2012, 08:09 AM
Thanks BOP5! I'll have to ensure that all is working. I set to the header as instructed above. By the way I want to purchase your HTML user color change that I heard you had. Could you drop me a link for that? Thanks again for this mod! :)

voglermc
11-09-2012, 04:32 PM
I think someone stole your code
https://vborg.vbsupport.ru/showthread.php?threadid=290306

BirdOPrey5
11-10-2012, 08:27 PM
Even if they did it is "Re-Usable Code" and people may re-use it however they want.

Thanks though.

Heckwork
03-01-2013, 03:38 PM
FYI, it works with Clicky too (https://clicky.com)

markoroots
03-01-2015, 08:15 PM
Hi there,
please can you explain me what is the difference between the options "Archive" and "Forum"?
What do it change?

And please can you explain me also the difference between "Header" and "Footer" position?

markoroots
03-07-2015, 11:39 AM
Any answer??

BirdOPrey5
03-07-2015, 06:07 PM
Sorry, missed this.

Forum are forum pages- the normal ones you are looking at right now.

The archive refers to the vBulletin archive feature- most new forums keep the archive disabled these days as it serves no purpose. But 10+ years ago when search engines had difficulty indexing forums the archive was much easier for it to index. You can see an example of an archive by clicking the archive link in the footer of any page on vbulletin.org, just to the left of the "Top" link.

(Link URL copied here: https://vborg.vbsupport.ru/archive/index.php )

Archive pages are much simpler than normal forum pages and add-ons do not usually affect the archive. Any changes you make to footer, header, or any other templates won't affect the archive either. For these reasons most people forget to put Google Analytics into the Archive code.

These days however I would recommend just disabling your archive in vBulletin settings.

As for header v. footer... In the header you *sightly* slow down the load of the page but register more visitors because no one can really stop the page loading before the header loads. In the footer there is no page slowdown but some visitors who click links really fast or click stop on their browser might not get counted because the javascipt loads last.

It really makes no difference 99% of the time.

markoroots
03-12-2015, 08:08 PM
Great! Many thanks BOP! :)
Is everything clear.
So in your plugin I have to disable the "Enable in Archive" box?
Right?

BirdOPrey5
03-13-2015, 01:23 PM
If you have the archive disabled in vBulletin Options then i does not matter what you have "Enable in Archive" set to.