Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.30.01 RN All Other Issues
Author Message
cornishpixie
Regular
Regular



Joined: Dec 15, 2008
Posts: 79

PostPosted: Thu Mar 05, 2009 12:56 pm Reply with quote

I'd like to place this on my 2 ravenNuke sites, and added the code to the bottom of the index.php as instructed in the Google Analytics account dashboard, but nothing happens.

It's saying that the code isn't installed.

On html sites the code is placed directly before the /body tag.

Does anyone else use Google Analytics, and could tell me if there's some place else I should be putting the code for it to work?

Thanks.

Hope this is the right place to post this, it didnt seem to fit in with any other category.
 
View user's profile Send private message
nuken
RavenNuke(tm) Development Team



Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Thu Mar 05, 2009 1:13 pm Reply with quote

Try installing it in your footer.php after the closing ?> and see if that works for you.

_________________
Tricked Out News 
View user's profile Send private message Send e-mail Visit poster's website
jakec
Site Admin



Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom

PostPosted: Thu Mar 05, 2009 2:06 pm Reply with quote

On one of my sites I posted it in WYSIWYG editor under preferences and it worked. It seemed to take a little bit of time for Google to recognise it, but it did work.

Also you can create a custom_footer.php file and save it in /includes/custom_files/ that works also.
 
View user's profile Send private message
nuken







PostPosted: Thu Mar 05, 2009 2:25 pm Reply with quote

I put it in a file and did an include in header.php. It will take a few hours for google to check it and I will let you know how it went.
 
nuken







PostPosted: Thu Mar 05, 2009 2:40 pm Reply with quote

It should work because it shows up with view source.

I created a file in the includes directory named googleanalytics.php with the following code:


Code:


<?php
echo "<script type=\"text/javascript\">\n";
echo "var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\n";
echo "document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));\n";
echo "</script>\n";
echo "<script type=\"text/javascript\">\n";
echo "try {\n";
echo "var pageTracker = _gat._getTracker(\"UA-yournumber-1\");\n";
echo "pageTracker._trackPageview();\n";
echo "} catch(err) {}</script>\n";
echo "\n";
?>

replace yournumber with the analytics number you get from google.
Code:
echo "var pageTracker = _gat._getTracker(\"UA-yournumber-1\");\n"; 


Inside header.php find:
Code:


//End of Dynamic Titles changes
   include_once 'includes/meta.php';
   include_once 'includes/javascript.php';
         if (file_exists('themes/' . $ThemeSel . '/images/favicon.ico')) {


change to:
Code:


//End of Dynamic Titles changes
   include_once 'includes/meta.php';
   include_once 'includes/javascript.php';
        include_once 'includes/googleanalytics.php';
   if (file_exists('themes/' . $ThemeSel . '/images/favicon.ico')) {


That should do it.

Edit:
It does work. Google Analytics gave the status a big green check.
 
cornishpixie







PostPosted: Thu Mar 05, 2009 5:30 pm Reply with quote

ooh thanks for all the replies.

Gonna go with the last one from nuken. Thanks so much for that. xxx
 
jakec







PostPosted: Fri Mar 06, 2009 1:58 am Reply with quote

It should really be in the footer, but it is good that it works.

Instead of modding the header.php file, which would be wiped out by an upgrade you can easily create a custom_footer.php file and this is included automatically.

....but I still think using the WYSIWYG editor is probably the easiest. Switch it to Source and paste the code straight in. Very Happy
 
cornishpixie







PostPosted: Fri Mar 06, 2009 6:16 am Reply with quote

I did try it in the footer but it didnt work, Google couldnt find it. Maybe Sentinel blocks it?

The php file in includes works a treat though.
 
jakec







PostPosted: Fri Mar 06, 2009 6:18 am Reply with quote

It may take a little time for Google to find it. I know it did on mine, but once it found it I had no problems.
 
nuken







PostPosted: Fri Mar 06, 2009 6:22 am Reply with quote

if it shows up in view source on you browser, google will find it.
 
nuken







PostPosted: Fri Mar 06, 2009 6:27 am Reply with quote

on a side note.... Google Analytics really shows detailed info about site visitors. It does everything except show their house on google maps. Cheers
 
cornishpixie







PostPosted: Fri Mar 06, 2009 7:05 am Reply with quote

It is good isnt it. I'm very impressed for something that good to be free.
 
nuken







PostPosted: Fri Mar 06, 2009 8:42 am Reply with quote

jakec is 100% correct that you can create a file in includes/custom_files named custom_header.php with the analytics code and it will work. This would be the best option just like jekec said. It would not be over written after an upgrade and is easily changed if the google code changes. Thank you.
 
jakec







PostPosted: Fri Mar 06, 2009 8:51 am Reply with quote

Try the WYSIWYG editor as well under preferences, I promise that works as well. Wink
 
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6432

PostPosted: Fri Mar 06, 2009 10:34 pm Reply with quote

If you like Google Analytics, check out Quantcast.

_________________
I search, therefore I exist...
nukeSEO - nukeFEED - nukePIE - nukeSPAM - nukeWYSIWYG
 
View user's profile Send private message
nuken







PostPosted: Sun Mar 08, 2009 12:40 pm Reply with quote

Quote:
Try the WYSIWYG editor as well under preferences, I promise that works as well. Wink


worship

That is the best option. The custom_header gives you XHTML issues. The WYSIWYG editor in the preferences has no issues.
 
jakec







PostPosted: Sun Mar 08, 2009 12:59 pm Reply with quote

Wave
 
dad7732
RavenNuke(tm) Development Team



Joined: Mar 18, 2007
Posts: 1242

PostPosted: Sun Mar 08, 2009 1:47 pm Reply with quote

kguske wrote:
If you like Google Analytics, check out Quantcast.


I had an issue with Quantcast. They harvested one of my sites with a lot of copyrighted material on it and since I didn't register with them they refused to update the inaccurate analytics themselves. That wasn't so bad but they were very rude and flat refused to cooperate saying in essence that they do what they want and refused to change anything. Sooo, I did a little fiddling with the htaccess file and included a referrer image of a nasty note referring to Quantcast (not vulgar, just not so nice) that prominently displayed on their site when someone clicked on it. Only took 14 days for them to remove my site. Smile
 
View user's profile Send private message
kguske







PostPosted: Sun Mar 08, 2009 3:33 pm Reply with quote

Circumvention is the key to all progress... That's unfortunate, but I like the creative alternative. I use a special treat like that for special purposes, too - a little redirection to certain sites that I don't want referring to me. If you click a link to one of my sites from one of those sites, you end up right back where you were....
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.30.01 RN All Other Issues

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©