PDA

View Full Version : Miscellaneous Hacks - Dynamic Google Analytics


bdude
23 Jan 2008, 06:17
Dynamic Google Analytics

This is a very simple mod, it adds the ability to dynamically generate the code for Google Analytics.

For visitors who didn't understand what the hack does:

It creates a google analytics section in your vb options page and when you enter analytics ID there, it automatically puts analytics code into your footer.

If you don't install this hack, you can do the same by copy/pasting google analytics code in your footer template.
Version History:
1.0 - Initial Release, using ga.js instead of urchin.js
1.0.1 - Removed vB 3.7 requirement

bdude
23 Jan 2008, 06:18
Reserved for future use.

soletrader
23 Jan 2008, 08:04
Hi,

Sorry for the newbie question. What do you mean by dynamic? How does this differ from implementing the analytics code normally?

M-Tuning
23 Jan 2008, 09:29
I think it adds a menu to the admin panel where you can set you Google Analytics code.

Which will then be implemented in the site.

Magnumutz
23 Jan 2008, 10:11
Yeah, that's what i was thinking of too...
vBSEO also has such an integration, but this is the free way to add it :D

projectego
23 Jan 2008, 11:21
/me clicks install :)

Collussus
23 Jan 2008, 11:31
Unfortunately i get this error:

This product is not compatible with version 3.7.0 Beta 3 of vBulletin. (Compatible starting with 3.7)

TomJames
23 Jan 2008, 13:57
Tick the box so that it ignores the max version.

Collussus
23 Jan 2008, 14:26
Tick the box so that it ignores the max version.

What box? you only have allow overwrite, which wont help much.

ssslippy
23 Jan 2008, 15:17
If you go into the top of the file you can change it.

TCooper
23 Jan 2008, 15:50
nevermind hehehe

cosy
23 Jan 2008, 16:31
this add need more info from the coder alot more

bdude
24 Jan 2008, 00:19
this add need more info from the coder alot more

What info do you require?

bdude
24 Jan 2008, 00:23
Unfortunately i get this error:

This product is not compatible with version 3.7.0 Beta 3 of vBulletin. (Compatible starting with 3.7)

Sorry, I removed the requirement for 3.7, I was playing around with the dependencies settings - thought I'd removed it. Feel free to try the new XML file.

Collussus
24 Jan 2008, 08:26
Can't seem to find the settings. Any help would be nice.

KURTZ
24 Jan 2008, 10:41
I think it adds a menu to the admin panel where you can set you Google Analytics code.

Which will then be implemented in the site.

where is the menu?

kollam003
24 Jan 2008, 16:07
will it work with Vb 3.6.8 patch 2

bdude
25 Jan 2008, 00:22
My most humble apologies for not fully testing this (I'm new to vB Development), you should see a new setting group called 'Google Analytics'

Brandon Sheley
25 Jan 2008, 03:14
nice hack :)

bdude
25 Jan 2008, 06:05
Thanks.

Collussus
25 Jan 2008, 08:01
My most humble apologies for not fully testing this (I'm new to vB Development), you should see a new setting group called 'Google Analytics'

Now it works -clicks install-

EDIT:

Do you fill in the number with or without "UA-"?

bdude
25 Jan 2008, 21:56
Do you fill in the number with or without "UA-"?

With UA-

Martell
26 Jan 2008, 03:03
Thanks, useful product for analytics on Google.

Collussus
26 Jan 2008, 16:58
With UA-

Doesn't seem to send the information to analytics for me... I'm pretty sure i get around 100 unique hits daily but it only shows 3, seems unlikely to me.

rinkrat
02 Feb 2008, 01:29
I turned it on so I guess I wait a few days and check the stats at Google. :)

DrKNickel
07 Feb 2008, 10:11
Looks nice but does it work? :)

nitro
18 Feb 2008, 23:20
Would this not be better in the global_complete hook location with something like:


if ($vbulletin->options['ga_enable']) {

$vbulletin->config['google_analytics']['replacementvariable'] = '</body>';
$output = str_replace($vbulletin->config['google_analytics']['replacementvariable'],
$code.$vbulletin->config['google_analytics']['replacementvariable'], $output);

}

This way you are anchoring onto the closing body tag as google instructs and the global_complete location is a better place to do this, not just for vbulletin itself but other addons which may use alternative templates for headers. footers etc.

The google code could perhaps be an additional temple for eval in which case it would want a cache plugin. A textarea option to add scipts to exclude the code from maybe quite a desireable feature to add. Was just a few thoughts, nice hack still. :)

bdude
19 Feb 2008, 03:18
@nitro: Thanks for the suggestions, I am quite new to vB coding - and if I have any spare time, I will try and implement your suggestions.

AndrewC1971
26 Feb 2008, 16:49
do u have to put in the google analytics html

or just you Google Analytics UA number?

tmiland
19 Mar 2008, 04:27
Sweet! :D

Dabbi
29 Mar 2008, 00:42
It worked! Thank you! :)

stemmy
03 Apr 2008, 15:27
Does this hack automatically put in the HTML code for analytics ??

If so I assume it puts in in the home page. What if your using vb advanced as your home page. I thing google analytics looks at the home page for the code. if this is the case then do I need to add the code to my vb advanced home page ??

Thanks in advance

bdude
03 Apr 2008, 20:26
If your vBAdvanced page uses standard vBulletin Header/Footer templates, then it should be included on your vba page.

Gimmick
22 Apr 2008, 17:48
will this work in 3.6.8 patch 1?

Evoix_mr2006
30 Apr 2008, 13:43
I assume the security patch in vB3.7.0 RC4 and STABLE kill this modification?

bdude
30 Apr 2008, 21:22
I don't see why it would be, however it has not been tested on vB 3.7 final

Charlie98902
30 Apr 2008, 23:05
I am running a test forum on 3.7 gold right now so if I just import this xml that's it?

RichieBoy67
01 May 2008, 21:57
Are you saying that this mod will save us the trouble of having to install the analytics code?

I tell you, if it works I will be very happy because I find it a pain to install this code everywhere. I guess it isn't really that tough but geez, installing a plug in?? Sounds great...

Does anyone have this working so far??

Thanks

Charlie98902
02 May 2008, 00:13
I'm asking the same 24 hours later nor response yet.

myown
05 May 2008, 07:42
does it work on 3.7 Gold?

GavM
30 Jul 2008, 07:29
I'm using this on 3.7.2 PL1 - It's working flawlessly as far as I can see.

Very nice, very handy plugin! A*!

Thank you!

Amm0
17 Aug 2008, 17:00
if this works, brilliant mod!

Logician
08 Sep 2008, 21:09
For visitors who didn't understand what the hack does:

It creates a google analytics section in your vb options page and when you enter analytics ID there, it automatically puts analytics code into your footer.

If you don't install this hack, you can do the same by copy/pasting google analytics code in your footer template.

I had to dig into code to understand what this is doing and want to share since thread's first post lacks details and many people are asking for it.

bdude
09 Sep 2008, 08:04
For those who are asking, this should work on all versions of vB 3.7 (sorry for not responding sooner, I thought I was email subscribed to this thread)

ArnyVee
09 Sep 2008, 13:13
Great job bdude! :D

Goomzee
12 Sep 2008, 09:19
i installed this could you lease tell me where i find "Analytics UA Code"

potukxystus
07 Oct 2008, 08:50
installed! many thanks
@goomzee - log into your google analytics account, then Analytics Settings > Edit Account and Data Sharing Settings

your UA number is one of the first pieces of info

Goomzee
13 Oct 2008, 07:34
sorry for late but i add it my google analytics Ua number but how do i know it;s working or not?

Videx
14 Oct 2008, 02:17
You wait and see if it shows up. It will.

Goomzee
14 Oct 2008, 07:30
more then 24 hours i still can;t see it;s up or not

Keyser Söze
18 Oct 2008, 08:56
just to make sure i understand here, once u enter the numbers that start wuth UA

thats all u need to do? u dont need to put the java code somewhere?

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-5xxxxx8-1";
urchinTracker();
</script>

The_Rayman
15 Apr 2009, 11:14
Excellent! Works like a charm!

**cut**

Works!

Namaless
27 Apr 2009, 20:43
Italian Language for 1.0.1

Dennis Kaczor
09 May 2009, 19:58
Has anyone used this with 3.8.2 yet? I tried it and I don't see anything in the footer code wise, I take it that is where the code is installed.

Xerosis
14 Feb 2011, 02:44
thahks!