PDA

View Full Version : Administrative and Maintenance Tools - Google Analytics Code Plugin


DomainArchitect
05-01-2008, 10:00 PM
This is my first plugin mod so its beta. :D

Purpose:
The purpose of this is to make it easy to add or remove your Google Analytics code or similar footer code in your vBulletin 'footer' template. This is helpful when you need to revert your footer template and want to add back your google analytics or similar footer code with ease, or quickly update the extra footer code without having to enter your admin control panel ('ACP').

Steps:
I broke the steps down into 3 easy parts.

Part 1
* - Create a folder titled custom_plugins in your forum folder;
* - In this folder, create a file titled index.html and add some text, like 'Blank' or a period '.' for example;
* - Create a file titled footercode.html and paste your Google Analytics code in it;
* - Login to your vBulletin ACP

Part 2
* - Go into your 'Style Manager' under the 'Styles & Templates' menu;
* - Click the 'Go' button next to your top-level style
* - Scroll down and double-click on the 'footer' template;
* - Scroll to the bottom of the selected 'footer' template and enter '$footercode' as the last piece of code;
* - Repeat Part 2 for all styles whose 'footer' templates have been modified or whose 'footer' template is not inherited by the top-level 'footer' template modified above(most people will only have one top-level 'footer' template inherited by all subsidiary styles);

Part 3
* - Create a new plugin by looking for 'Add New Plugin' under the 'Plugins & Products' menu;
* - Select 'vBulletin' for the Product;
* - Select 'global_start' for the Hook Location;
* - Enter a title. I used 'Footer Code';
* - Insert the following code in the PHP field:

$footercode = implode('', file('/enter/the/path/to/your/file.html'));

***Be sure to update the above code with the actual path to the footercode.html file you created above***


Feel free to comment or critique. Support will be provided on vBulletin Domain Architects (http://www.DomainArchitects.com)

gwerzal
05-02-2008, 09:16 AM
If i hadn't just installed vbseo i would defo be installing this for ease of use.

Barakat
05-02-2008, 09:52 AM
i belive i saw a similar hack her somewhere ....

anyway thanks for shareing

projectego
05-02-2008, 09:58 AM
* projectego clicks install :D

Big Boss
05-02-2008, 11:50 AM
Nice release, although this comes with vBSEO already for those who are running the product.

COBRAws
05-02-2008, 02:40 PM
Nice release, although this comes with vBSEO already for those who are running the product.
Not everyone has vBSEO

DomainArchitect
05-02-2008, 06:11 PM
Thank you guys. I run vBSEO on one site but I wanted a plugin for my new vB sites that I am too cheap to pay for vBSEO on. This is a free and easy mod :) so I thought I would share it.

Big Boss
05-02-2008, 11:49 PM
Not everyone has vBSEO
I was just trying to say that it comes with vBSEO already for those who haven't noticed yet. ;)

Jasem
05-02-2008, 11:52 PM
Thank you

KURTZ
05-14-2008, 11:22 AM
i don't understand one thing, the $footercode must be placed after this (in the footer template)?

<script type="text/javascript">
<!--
// Main vBulletin Javascript Initialization
vBulletin_init();
//-->
</script>

also i put this code in the php field:

$footercode = implode('', file('/board/custom_plugins/footercode.html'));

but it doesn't run ... :(

siliconfinance
05-15-2008, 04:08 PM
i don't understand one thing, the $footercode must be placed after this (in the footer template)?

<script type="text/javascript">
<!--
// Main vBulletin Javascript Initialization
vBulletin_init();
//-->
</script>

also i put this code in the php field:

$footercode = implode('', file('/board/custom_plugins/footercode.html'));

but it doesn't run ... :(

The only thing that goes in the footer template is:

$footercode

The php field is located on the add new plugin page.

Does that make sense?

River_rush
01-02-2009, 07:24 PM
thanks installed and working

steven s
01-02-2009, 07:33 PM
Doesn't the ad_footer templates accomplish this except not requiring an external file?
And you still need to edit the footer template after reverting.

Dean C
01-02-2009, 08:08 PM
Doesn't the ad_footer templates accomplish this except not requiring an external file?
And you still need to edit the footer template after reverting.

Yep, but at the time of this mod, that hook wasn't available :)

steven s
01-02-2009, 08:18 PM
Yep, but at the time of this mod, that hook wasn't available :)Thanks. But it was included in 3.7, wasn't it?