Thread: Google Analytics MOD (
-
04-27-2010 #1
ClipBucket User
- Join Date
- Apr 2010
- Posts
- 11
Google Analytics MOD (
I've posted a copy of this tutorial in my blog with syntax highlight for better reading. You can find it here http://www.davidgouveia.net/2010/04/...to-clipbucket/
Summary: with this mod you will be able to insert any script into your clipbucket. I’m using it to manage google analytics.
1st – Open styles/cbv2new/layout/global_header.html. Find:
Add below:Code:<!-- Setting Template Variables --> shit scriptshit scriptshit scriptshit scriptshit script} if(!$_COOKIE['current_style']) $_COOKIE['current_style'] = 'grid_view'; {/php}
2nd – includes/common.php. Find:Code:<!-- Google Analytics --> {show_analytics|html_entity_decode}
Add below:Code:$Smarty->register_function('cbtitle','cbtitle');
3rd – Open includes/functions.php. Find:Code:$Smarty->register_function('show_analytics', 'show_analytics');
Add above:Code:/** * Function used to load clipbucket title */ function cbtitle($params=false) {
4th – Open admin_area/main.php. Find:Code:/** * Function used to load Google Analytics - me( at )davidgouveia.net */ function show_analytics() { global $Cbucket; // code to convert html entities back usefull code. echo base64_decode($Cbucket->configs['google_analytics']); }
Add above:Code:'gravatars',
Find:Code:'google_analytics',
Add above:Code:$value = mysql_clean($_POST[$field]); if(in_array($field,$num_array))
(the “else” MUST be in the line immediately above “$value = mysql_clean($_POST[$field]);”).Code:if($field == 'google_analytics') $value = base64_encode($_POST['google_analytics']); else
Finally, open /admin_area/styles/cbv2/layout/main.html. Find:
Add below:Code:<tr> <td valign="top">Meta Description</td> <td valign="top"><textarea name="description" id="description" cols="45" rows="5">{$row.description}</textarea></td> </tr>
Done ! You shoud see another option under Web Settings.Code:<tr> <td valign="top">Google Analytics</td> <td valign="top"><textarea name="google_analytics" id="google_analytics" cols="45" rows="5">{$row.google_analytics|base64_decode|html_entity_decode}</textarea></td> </tr>
Tested under ClipBucket 2.0.6.
PS: I’m using base64_encode/decode because I want to save the script as its original values and I need to avoid using functions like mysql_clean() to sanitize the code. By saving it as a base64 string I avoid potential malicious SQL injection problems. I’m sure there are other ways of doing it but this works OK (I think
).
-
04-27-2010 #2
Super Moderator
- Join Date
- Jan 2010
- Location
- Denmark
- Posts
- 860
Re: Google Analytics MOD (
Hey there, thanks for sharing!
It looks like something went pretty haywire, think it was the forum going crazy about the first section, people should check with the blog-post for the correct code to be sure it's correct.
-
05-25-2010 #3
ClipBucket User
- Join Date
- Aug 2008
- Posts
- 106
Re: Google Analytics MOD (
My question on my admin I just have a test area box named google analytics what i supposed to add inside because. there is noting on my site where i can see the data i opened an account on google analytics and paste the code that supposed to be after body there. there is nothing more in admin just that .. can you explain with more details thanks
-
05-25-2010 #4
ClipBucket User
- Join Date
- Aug 2008
- Posts
- 106
Re: Google Analytics MOD (
never mind but explain me how supposed to work
-
05-25-2010 #5
ClipBucket User
- Join Date
- Aug 2008
- Posts
- 106
Re: Google Analytics MOD (
may be the base 64 is my problem
-
07-29-2010 #6
ClipBucket User
- Join Date
- Mar 2010
- Posts
- 4
Re: Google Analytics MOD (
you have to add the record 'google_analytics' to your database as well (in the xx_config table)
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)


Reply With Quote
Bookmarks