You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 289 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - Google Analytics [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
wildo69
Lieutenant
Lieutenant


Joined: Jul 29, 2003
Posts: 164

Location: Michigan

PostPosted: Tue Nov 15, 2005 11:27 am Reply with quoteBack to top

has anyone been able to add google analytics to there nuke site?

here are the requirements

paste the code segment after the <head>, <meta> tags and before the </head> tag on each page you are planning to track

Code:

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


since nuke is the way it is, i figured there would be a way to add this code to the header.php or the includes/javascript.php

this is a bit beyond my expertise, so i am open to suggestions


more info can be found here
http://www.google.com/analytics/

_________________
Hosting for your Nuke powered sites and full service podcast hosting
http://www.webcyberhosting.com
Image
Find all posts by wildo69View user's profileSend private messageSend e-mailVisit poster's websiteAIM AddressYahoo MessengerMSN Messenger
NukeyDoo
Nuke Soldier
Nuke Soldier


Joined: Nov 03, 2005
Posts: 24


PostPosted: Tue Nov 15, 2005 1:05 pm Reply with quoteBack to top

You're correct. I just put mine into the header.php file.

_________________
NukeyDoo
Find all posts by NukeyDooView user's profileSend private messageVisit poster's website
wildo69
Lieutenant
Lieutenant


Joined: Jul 29, 2003
Posts: 164

Location: Michigan

PostPosted: Tue Nov 15, 2005 2:38 pm Reply with quoteBack to top

not to be needy.. but where did you put it?

_________________
Hosting for your Nuke powered sites and full service podcast hosting
http://www.webcyberhosting.com
Image
Find all posts by wildo69View user's profileSend private messageSend e-mailVisit poster's websiteAIM AddressYahoo MessengerMSN Messenger
NukeyDoo
Nuke Soldier
Nuke Soldier


Joined: Nov 03, 2005
Posts: 24


PostPosted: Wed Nov 16, 2005 6:23 am Reply with quoteBack to top

I may of spoken too soon. I have it set in both a cpgnuke installation and a phpnuke 7.0 installation (both were slightly different) and when viewing the source of the page ofter the addition of the code, it's all there, between the head tags and with proper formatting.

However, when using the "Verify" link on the Google Analytics (GA) page, it fails to see the code as inserted, and after a full day of waiting for GA to log info, it's only showing a single hit on my cpg site and no traffic at all on the PHPNuke site, and I know that there should be more since I've personally been to both of them since then more than one time as well as some other stat trackers I have running showing others going to them.

Regardless, here's how I added the code in case you want to test. In my cpgnuke version, I added it to header.php:

Before:
Code:
function head() {
    global $slogan, $sitename, $banners, $nukeurl, $Version_Num, $artpage, $topic, $hlpfile, $user, $userinfo, $hr, $theme, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $textcolor1, $textcolor2, $forumpage, $adminpage, $userpage, $pagetitle,$name, $username,$locale,$coppermine;
    global $modheader, $copyright, $MAIN_CFG, $_CLASS, $admin;
    $themes = unserialize(base64_decode(bb_user));
    eval($themes['nuke']);
    define('NOTE', $coppermine);
    $ThemeSel = get_theme();
    include("themes/$ThemeSel/theme.php");
//    include("includes/blocker.php"); // Protector System 1.14b+: 18 queries and 0.026 seconds
    $year = date("Y");
    if (!defined('_LANGCODE')) {
        define('_LANGCODE', $locale);
    }
    if (!defined('_CHARSET')) {
        define('_CHARSET', "ISO-8859-1");
    }
    $copyright = $coppermine;
    echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="'._LANGCODE.'">
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset='._CHARSET.'">
<title>'.$sitename.' '.$pagetitle.'</title>
<base href="http://'.getenv('HTTP_HOST').$MAIN_CFG['server']['path'].'">'."\n";
    include("includes/meta.php");
    echo '<meta HTTP-EQUIV="EXPIRES" CONTENT="0">
<meta NAME="RESOURCE-TYPE" CONTENT="DOCUMENT">
<meta NAME="DISTRIBUTION" CONTENT="GLOBAL">
<meta NAME="AUTHOR" CONTENT="'.$sitename.'">
<meta NAME="COPYRIGHT" CONTENT="Copyright (c) '.$year.' by '.$sitename.'">
<meta NAME="ROBOTS" CONTENT="INDEX, FOLLOW">
<meta NAME="RATING" CONTENT="GENERAL">
<META NAME="GENERATOR" CONTENT="CPG-Nuke '.$Version_Num.' - Copyright(c) '.$year.' by http://cpgnuke.com">
';


After:
Code:
function head() {
    global $slogan, $sitename, $banners, $nukeurl, $Version_Num, $artpage, $topic, $hlpfile, $user, $userinfo, $hr, $theme, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $textcolor1, $textcolor2, $forumpage, $adminpage, $userpage, $pagetitle,$name, $username,$locale,$coppermine;
    global $modheader, $copyright, $MAIN_CFG, $_CLASS, $admin;
    $themes = unserialize(base64_decode(bb_user));
    eval($themes['nuke']);
    define('NOTE', $coppermine);
    $ThemeSel = get_theme();
    include("themes/$ThemeSel/theme.php");
//    include("includes/blocker.php"); // Protector System 1.14b+: 18 queries and 0.026 seconds
    $year = date("Y");
    if (!defined('_LANGCODE')) {
        define('_LANGCODE', $locale);
    }
    if (!defined('_CHARSET')) {
        define('_CHARSET', "ISO-8859-1");
    }
    $copyright = $coppermine;
    echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="'._LANGCODE.'">
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset='._CHARSET.'">
<title>'.$sitename.' '.$pagetitle.'</title>
<base href="http://'.getenv('HTTP_HOST').$MAIN_CFG['server']['path'].'">'."\n";
    include("includes/meta.php");
    echo '<meta HTTP-EQUIV="EXPIRES" CONTENT="0">
<meta NAME="RESOURCE-TYPE" CONTENT="DOCUMENT">
<meta NAME="DISTRIBUTION" CONTENT="GLOBAL">
<meta NAME="AUTHOR" CONTENT="'.$sitename.'">
<meta NAME="COPYRIGHT" CONTENT="Copyright (c) '.$year.' by '.$sitename.'">
<meta NAME="ROBOTS" CONTENT="INDEX, FOLLOW">
<meta NAME="RATING" CONTENT="GENERAL">
<META NAME="GENERATOR" CONTENT="CPG-Nuke '.$Version_Num.' - Copyright(c) '.$year.' by http://cpgnuke.com">

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



On my PHPNuke 7.0 Install, I had to put it in My_Header.php

I just added it towards the bottom like this:
Code:
// Google Analytics Code
echo "<script src=\"http://www.google-analytics.com/urchin.js\" type=\"text/javascript\">\n";
echo "</script>\n";
echo "<script type=\"text/javascript\">\n";
echo "_uacct = \"UA-555555-2\";\n";
echo "urchinTracker();\n";
echo "</script>\n\n";
// End Google Analytics Code


If you figure out why GA isn't logging data, please let me know in this thread.

HTH

_________________
NukeyDoo
Find all posts by NukeyDooView user's profileSend private messageVisit poster's website
wildo69
Lieutenant
Lieutenant


Joined: Jul 29, 2003
Posts: 164

Location: Michigan

PostPosted: Wed Nov 16, 2005 9:43 am Reply with quoteBack to top

i will play with it some more.

curious.. could it be placed in the includes/javascript.php, and called as a function?

_________________
Hosting for your Nuke powered sites and full service podcast hosting
http://www.webcyberhosting.com
Image
Find all posts by wildo69View user's profileSend private messageSend e-mailVisit poster's websiteAIM AddressYahoo MessengerMSN Messenger
NukeyDoo
Nuke Soldier
Nuke Soldier


Joined: Nov 03, 2005
Posts: 24


PostPosted: Thu Nov 17, 2005 10:28 am Reply with quoteBack to top

After a full 24 hours I've gone back and looked at my stats on the 2 sites, and it appears they're working fine now. The Check Status links in the setup still show as not working but, I emailed Google Analytics before the stats showed and this is the reply I got:

Quote:
Hello,

Thank you for your email.

I understand that you have some concerns about data not appearing in your account. We appreciate your interest in Google Analytics and hope to have your reports populated as soon as possible. Since we have received an unexpected demand for Google Analytics, there have been some delays reporting data since launch. I'd like to give you an overview of what to expect going forward:

- The "Check Status" feature is currently not accurate. If you added the code to your pages correctly, then we are collecting data. You can make sure by seeing if your site has set "_utm" cookies in your browser.

- If your reports aren't currently populated, they will be as soon as the next processing run is complete. We process every 24 hours.

- You may see some reports within a profile before others. We're populating reports like this to get you as much information as soon as we can. If you see this, rest assured that all applicable reports will show data soon.

- Once we catch up with the data for your account, you'll see new reports every 24 hours.

For additional questions, please visit the Analytics Help Center at http://www.google.com/support/analytics. If you're unable to find an answer to your question on our site, please feel free to reply to this email.

Sincerely,

Analytics Support

*************************
Share your knowledge and learn from others at the Google Analytics Help forum: http://www.google.com/analytics/analyticshelp
*************************


Everything the email says appears to be accurate, so if you use the code I gave in my previous post you should be OK.

Hope this helps.

_________________
NukeyDoo
Find all posts by NukeyDooView user's profileSend private messageVisit poster's website
wildo69
Lieutenant
Lieutenant


Joined: Jul 29, 2003
Posts: 164

Location: Michigan

PostPosted: Thu Nov 17, 2005 11:25 am Reply with quoteBack to top

Ok.. all set..

here is where i put the code
its in header.php

Code:

if (stristr(htmlentities($_SERVER['PHP_SELF']), "header.php")) {
   Header("Location: index.php");
   die();
}

define('NUKE_HEADER', true);
require_once("mainfile.php");

##################################################
# Include some common header for HTML generation #
##################################################


function head() {
   global $slogan, $sitename, $banners, $nukeurl, $Version_Num, $artpage, $topic, $hlpfile, $user, $hr, $theme, $cookie, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $textcolor1, $textcolor2, $forumpage, $adminpage, $userpage, $pagetitle;
   $ThemeSel = get_theme();
   include_once("themes/$ThemeSel/theme.php");
   echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
   echo "<html>\n";
   echo "<head>\n";
   echo "<title>$sitename $pagetitle</title>\n";
   include("includes/meta.php");
   include("includes/javascript.php");

// Google Analytics Code
echo "<script src=\"http://www.google-analytics.com/urchin.js\" type=\"text/javascript\">\n";
echo "</script>\n";
echo "<script type=\"text/javascript\">\n";
echo "_uacct = \"UA-555555-2\";\n";
echo "urchinTracker();\n";
echo "</script>\n\n";
// End Google Analytics Code

   if (file_exists("themes/$ThemeSel/images/favicon.ico")) {
      echo "<link REL=\"shortcut icon\" HREF=\"themes/$ThemeSel/images/favicon.ico\" TYPE=\"image/x-icon\">\n";
   }
   echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"backend.php\">\n";
   echo "<LINK REL=\"StyleSheet\" HREF=\"themes/$ThemeSel/style/style.css\" TYPE=\"text/css\">\n\n\n";
   if (file_exists("includes/custom_files/custom_head.php")) {
      include_once("includes/custom_files/custom_head.php");
   }
   echo "\n\n\n</head>\n\n";
   if (file_exists("includes/custom_files/custom_header.php")) {
      include_once("includes/custom_files/custom_header.php");
   }
   themeheader();
}

online();
head();
include("includes/counter.php");
if(defined('HOME_FILE')) {
   message_box();
   blocks("Center");
}

?>


per the google site, it has to be in the hte <head> tags after the </meta tag> before the </head>

so basically it has to be like this
Code:

<head>
blah blah blah
<meta>
meta blah blah bla
meta blah blah bla
</meta>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-134401-1";
urchinTracker();
</script>

</head>


after all this i went to the google site, and it is showing me that all is well, that its installed properly, and i should have reports in the next 12 hours.

nuke version = 7.9

_________________
Hosting for your Nuke powered sites and full service podcast hosting
http://www.webcyberhosting.com
Image
Find all posts by wildo69View user's profileSend private messageSend e-mailVisit poster's websiteAIM AddressYahoo MessengerMSN Messenger
dionsis
Sergeant
Sergeant


Joined: Jul 18, 2005
Posts: 133


PostPosted: Thu Nov 17, 2005 3:44 pm Reply with quoteBack to top

7.9 here

installed the code to the header file in my theme

Google reports success and is doing my report
Find all posts by dionsisView user's profileSend private message
wildo69
Lieutenant
Lieutenant


Joined: Jul 29, 2003
Posts: 164

Location: Michigan

PostPosted: Thu Nov 17, 2005 4:48 pm Reply with quoteBack to top

great!!!
Two Success stories Very Happy

_________________
Hosting for your Nuke powered sites and full service podcast hosting
http://www.webcyberhosting.com
Image
Find all posts by wildo69View user's profileSend private messageSend e-mailVisit poster's websiteAIM AddressYahoo MessengerMSN Messenger
luisr320
Nuke Soldier
Nuke Soldier


Joined: Jul 06, 2003
Posts: 18


PostPosted: Tue Oct 17, 2006 3:25 pm Reply with quoteBack to top

How can we present the resulting analisis page to someone else? Can we present the XML code as a html page?
I would like to show the following stats to my members:

Image

But I would like it to be updated automatically without my intervention.

Any ideas?
Find all posts by luisr320View user's profileSend private message
saaa
Nuke Cadet
Nuke Cadet


Joined: Nov 18, 2006
Posts: 7


PostPosted: Fri Jan 26, 2007 6:40 pm Reply with quoteBack to top

Placing the code in header.php worked great for me!

Thanks Smile

_________________
http://www.sci-kids.com
Find all posts by saaaView user's profileSend private message
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next 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



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.105 Seconds - 552 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::