PDA

View Full Version : Miscellaneous Hacks - Dynamic Google Analytics


bdude
01-22-2008, 10:00 PM
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
01-23-2008, 05:18 AM
Reserved for future use.

soletrader
01-23-2008, 07:04 AM
Hi,

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

M-Tuning
01-23-2008, 08:29 AM
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
01-23-2008, 09:11 AM
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
01-23-2008, 10:21 AM
* projectego clicks install :)

Collussus
01-23-2008, 10:31 AM
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
01-23-2008, 12:57 PM
Tick the box so that it ignores the max version.

Collussus
01-23-2008, 01:26 PM
Tick the box so that it ignores the max version.

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

ssslippy
01-23-2008, 02:17 PM
If you go into the top of the file you can change it.

TCooper
01-23-2008, 02:50 PM
nevermind hehehe

cosy
01-23-2008, 03:31 PM
this add need more info from the coder alot more

bdude
01-23-2008, 11:19 PM
this add need more info from the coder alot more

What info do you require?

bdude
01-23-2008, 11:23 PM
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
01-24-2008, 07:26 AM
Can't seem to find the settings. Any help would be nice.

KURTZ
01-24-2008, 09:41 AM
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
01-24-2008, 03:07 PM
will it work with Vb 3.6.8 patch 2

bdude
01-24-2008, 11:22 PM
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
01-25-2008, 02:14 AM
nice hack :)

bdude
01-25-2008, 05:05 AM
Thanks.

Collussus
01-25-2008, 07:01 AM
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
01-25-2008, 08:56 PM
Do you fill in the number with or without "UA-"?

With UA-

Martell
01-26-2008, 02:03 AM
Thanks, useful product for analytics on Google.

Collussus
01-26-2008, 03:58 PM
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-02-2008, 12:29 AM
I turned it on so I guess I wait a few days and check the stats at Google. :)

DrKNickel
02-07-2008, 09:11 AM
Looks nice but does it work? :)

nitro
02-18-2008, 10:20 PM
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
02-19-2008, 02:18 AM
@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
02-26-2008, 03:49 PM
do u have to put in the google analytics html

or just you Google Analytics UA number?

tmiland
03-19-2008, 03:27 AM
Sweet! :D

Dabbi
03-28-2008, 11:42 PM
It worked! Thank you! :)

stemmy
04-03-2008, 02:27 PM
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
04-03-2008, 07:26 PM
If your vBAdvanced page uses standard vBulletin Header/Footer templates, then it should be included on your vba page.

Gimmick
04-22-2008, 04:48 PM
will this work in 3.6.8 patch 1?

Evoix_mr2006
04-30-2008, 12:43 PM
I assume the security patch in vB3.7.0 RC4 and STABLE kill this modification?

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

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

RichieBoy67
05-01-2008, 08:57 PM
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
05-01-2008, 11:13 PM
I'm asking the same 24 hours later nor response yet.

myown
05-05-2008, 06:42 AM
does it work on 3.7 Gold?

GavM
07-30-2008, 06:29 AM
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
08-17-2008, 04:00 PM
if this works, brilliant mod!

Logician
09-08-2008, 08:09 PM
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-09-2008, 07:04 AM
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-09-2008, 12:13 PM
Great job bdude! :D

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

potukxystus
10-07-2008, 07:50 AM
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
10-13-2008, 06:34 AM
sorry for late but i add it my google analytics Ua number but how do i know it;s working or not?

Videx
10-14-2008, 01:17 AM
You wait and see if it shows up. It will.

Goomzee
10-14-2008, 06:30 AM
more then 24 hours i still can;t see it;s up or not

Keyser S?ze
10-18-2008, 07:56 AM
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
04-15-2009, 10:14 AM
Excellent! Works like a charm!

**cut**

Works!

Namaless
04-27-2009, 07:43 PM
Italian Language for 1.0.1

Dennis Kaczor
05-09-2009, 06:58 PM
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
02-14-2011, 01:44 AM
thahks!