<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AskApache &#187; Search Results  &#187;  urchin.js</title>
	<atom:link href="http://www.askapache.com/search/urchin.js/feed/rss2/" rel="self" type="application/rss+xml" />
	<link>http://www.askapache.com</link>
	<description>Advanced Web Development</description>
	<lastBuildDate>Sun, 29 Jan 2012 12:04:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Speed Up Google Analytics, use local ga.js</title>
		<link>http://www.askapache.com/google/ga-urchin-speed.html</link>
		<comments>http://www.askapache.com/google/ga-urchin-speed.html#comments</comments>
		<pubDate>Wed, 30 Jan 2008 13:35:11 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.askapache.com/linux/ga-urchin-speed.html</guid>
		<description><![CDATA[<p><a class="IFL" rel="lb" href='http://uploads.askapache.com/2008/01/google-analytics-speed.png' title='Google Analytics ga.js Speed'><img src='http://uploads.askapache.com/2008/01/google-analytics-speed.png' alt='Google Analytics ga.js Speed' /></a>Host Google Analytics ga.js file locally for increased speed!  Makes web pages load faster.<br class="C" /></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/google/ga-urchin-speed.html"></a><a href="http://www.askapache.com/google/ga-urchin-speed.html"><cite>AskApache.com</cite></a></p><p><a class="IFL" rel="lb" href='http://uploads.askapache.com/2008/01/google-analytics-speed.png' title='Google Analytics ga.js Speed'><img src='http://uploads.askapache.com/2008/01/google-analytics-speed.png' alt='Google Analytics ga.js Speed' title="google analytics speed google" /></a>Last year I wrote about <a href="http://www.askapache.com/webmaster/faster-google-analytics-with-a-local-urchinjs.html">hosting Google Analytics urchin.js file on your own server</a>, to speed up the loading of your site.  Well, google has migrated to a new analytics javascript, ga.js.  You can read the <a href="http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=57045">urchin.js to ga.js migration guide</a> if you want.  They also wrote about the changes on the <a href="http://analytics.blogspot.com/2007/12/announcing-new-graphing-tools-gajs.html">Google Analytics Blog</a>.  And if you want to learn about advanced features of <code>ga.js</code> check out this <a href="http://code.google.com/apis/analytics/docs/">Google Analytics Documentation</a>.<br class="C" /></p>


<h2>XHTML for hosting ga.js locally</h2>
<p>If you use a relative link like below, you don't need the https detection part of the script.</p>
<p>Also note that the <code>-151</code> is from my advanced <a href="http://www.askapache.com/htaccess/mod_rewrite-fix-for-caching-updated-files.html" title="mod_rewrite Fix for Caching Updated Files">mod_rewrite Fix for Caching Updated Files</a>.  So you won't need that unless you implement that technique.</p>
<pre>&lt;script src="/j/ga-151.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
var pageTracker = _gat._getTracker("UA-732153-7");
pageTracker._initData();pageTracker._trackPageview();
&lt;/script&gt;</pre>


<h2>Shell Script to Update ga.js</h2>
<p>Here is an updated shell script that fetches the latest ga.js file from google and places it in the folder of your site.</p>
<pre>#!/bin/sh
&nbsp;
# TMP DIRECTORY
MYTMP=/tmp/
&nbsp;
# SAVE ga.js HERE
INSTALL_IN=/home/user/askapache.com/z/j/
&nbsp;
# RESOURCE URLS
GOOGLE_GA_URL=http://www.google-analytics.com/ga.js
&nbsp;
# USER-AGENT
UA="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3"
&nbsp;
# CD TO TMP DIRECTORY
cd $MYTMP
&nbsp;
# DOWNLOAD THE FILE
curl --header "Pragma:" -f -s -A "${UA}" -m 1800 --retry 15 --retry-delay 15 --max-redirs 8 -O $GOOGLE_GA_URL
&nbsp;
# GIVE FILE CORRECT PERMISSIONS
chmod 644 $MYTMP/ga.js
&nbsp;
# COPY FILE TO SITE DIRECTORY
cp -r $MYTMP/ga.js $INSTALL_IN
&nbsp;
# RETURN TO OLDPWD
cd $OLDPWD
&nbsp;
exit 0;</pre>


<h2>Updating ga.js with Crontab</h2>
<p>Just add this to your crontab by typing <code>crontab -e</code> where google-analytics-update.sh is the location of your shell script.</p>
<pre>@daily /home/user/scripts/google-analytics-update.sh &gt;/dev/null 2&gt;&amp;1</pre>



<h2>More Speed Tips</h2>
<ul>
<li><a href="http://www.askapache.com/htaccess/mod_rewrite-fix-for-caching-updated-files.html" title="mod_rewrite Fix for Caching Updated Files">mod_rewrite Fix for Caching Updated Files</a></li>
<li><a href="http://www.askapache.com/htaccess/speed-up-your-site-with-caching-and-cache-control.html" title="Speed up your site with Caching and cache-control">Speed up your site with Caching and cache-control</a></li>
<li><a href="http://www.askapache.com/web-cache/top-methods-for-faster-speedier-web-sites.html" title="Top methods for Faster, Speedier web sites">Top methods for Faster, Speedier web sites</a></li>
</ul><p><a href="http://www.askapache.com/google/ga-urchin-speed.html"></a><a href="http://www.askapache.com/google/ga-urchin-speed.html">Speed Up Google Analytics, use local ga.js</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/google/ga-urchin-speed.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Speed Up Google Analytics with urchin.js</title>
		<link>http://www.askapache.com/google/faster-google-analytics-local-urchinjs.html</link>
		<comments>http://www.askapache.com/google/faster-google-analytics-local-urchinjs.html#comments</comments>
		<pubDate>Sat, 15 Sep 2007 03:10:16 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.askapache.com.com/webmaster/faster-google-analytics-with-a-local-urchinjs.html</guid>
		<description><![CDATA[<p><a href="http://www.askapache.com/google/faster-google-analytics-local-urchinjs.html"></a><a href="http://www.askapache.com/google/faster-google-analytics-local-urchinjs.html"><cite>AskApache.com</cite></a></p><p class="cnote"><strong>Update:</strong> This article is a bit dated, to get the newest and latest Google Analytics Speed Tips, check out the 3 part update about <a href="http://www.askapache.com/javascript/google-analytics-speed-tips.html#googleanalyticshosting" title="Host the Google-Analytics ga.js file locally">Hosting</a>, <a href="http://www.askapache.com/javascript/google-analytics-speed-tips.html#googleanalyticsdomain" title="Set Correct Cookie Domain">Cookie Domains</a>, and <a href="http://www.askapache.com/javascript/google-analytics-speed-tips.html#googleanalyticsloading" title="Make Sure Google Analytics Loads Fast and as often as Possible">JavaScript Loading and Failproofs</a></p>
<hr class="C" />


<p>Ever notice that sometimes your sites take a while to load all the way because google's urchin.js file is taking forever?  You may recognize this &#8230; <a href="http://www.askapache.com/google/faster-google-analytics-local-urchinjs.html" class="read_more">Read the rest</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/google/faster-google-analytics-local-urchinjs.html"></a><a href="http://www.askapache.com/google/faster-google-analytics-local-urchinjs.html"><cite>AskApache.com</cite></a></p><p class="cnote"><strong>Update:</strong> This article is a bit dated, to get the newest and latest Google Analytics Speed Tips, check out the 3 part update about <a href="http://www.askapache.com/javascript/google-analytics-speed-tips.html#googleanalyticshosting" title="Host the Google-Analytics ga.js file locally">Hosting</a>, <a href="http://www.askapache.com/javascript/google-analytics-speed-tips.html#googleanalyticsdomain" title="Set Correct Cookie Domain">Cookie Domains</a>, and <a href="http://www.askapache.com/javascript/google-analytics-speed-tips.html#googleanalyticsloading" title="Make Sure Google Analytics Loads Fast and as often as Possible">JavaScript Loading and Failproofs</a></p>
<hr class="C" />


<p>Ever notice that sometimes your sites take a while to load all the way because google's urchin.js file is taking forever?  You may recognize this problem when you see something similar to this in your browsers status bar <code>"Transferring data from google-analytics.com..."</code></p>
<hr />

<h2>Time To Setup?</h2>
<strong>4 minutes</strong>  I got tired of seeing that all the time and so I set up an automated cronjob that runs every 12 hours and downloads the latest version from google, and saves it to my website directory, then I reference /urchin.js instead of http://www.google-analytics.com/urchin.js.. and my site loads a lot faster!

Take a look at the source for this page if you want to see what is going on (look at the bottom)





<h2>There are 2 pretty major things that you accomplish by hosting urchin.js locally</h2>
<ol>
	<li>You Enable persistant connections</li>
	<li>You ensure that the correct 304 Not Modified header is sent back to your site visitors instead of reserving the entire file.</li>
</ol>



<h3>The urch.sh shell script</h3>
Create a shell script called urch.sh.. this will be executed every 1/day or 1/wk, whatever you want.  The following script removes the local urchin.js, then it wgets the latests version into the local directory.
<pre>#!/bin/sh
rm /home/user/websites/askapache.com/z/j/urchin.js
cd /home/user/websites/askapache.com/z/j/
wget http://www.google-analytics.com/urchin.js
chmod 644 /home/user/websites/askapache.com/z/j/urchin.js
cd ${OLDPWD}
exit 0;</pre>

<h3>Improved shell script</h3>
<p>I realized right away that a more modular shell script would be needed.. I admin like 50+ web-sites and it would be stupid to have to type the same block of code 50 times, wget the same file 50 times, etc..   So this version downloads the urchin.js file into a temporary directory, then it copies it OVER the old file for each directory.  So 1 GET request for unlimited sites..   The below is just for 2 sites.
<pre>#!/bin/sh
&nbsp;
# SETTINGS
export TMP=${HOME}/sites/tmp/
export SH=${HOME}/sites/
export SJ=/public_html/z/j/
export UA="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3"
&nbsp;
# SITES
export S1=htaccesselite.com
export S2=askapache.com
&nbsp;
# RESOURCE URLS
L1=http://www.google-analytics.com/urchin.js
&nbsp;
# SETS CORRECT PERMS AND COPIES TO EACH SITES DOC_ROOT
setit(){
chmod 644 *.js
cp *.js $SH$1$SJ
}
&nbsp;
cd $TMP
&nbsp;
curl --header "Pragma:" -A "${UA}" --retry 200 --retry-delay 15 -O ${L1}
&nbsp;
setit $S1
setit $S2
&nbsp;
cd ${OLDPWD}
&nbsp;
exit 0;</pre>


<h3>The crontab</h3>
Add this to your crontab by typing <code>crontab -e</code>
<pre>11 12 * * * /home/user/websites/urch.sh &gt;/dev/null 2&gt;&amp;1</pre>
Or to just check once a week do
<pre>0 2 * * 6 /home/user/websites/urch.sh &gt;/dev/null 2&gt;&amp;1</pre>
<strong>
Finished!  Read on for more in-depth overkill.</strong>




In the past year urchin.js has only been updated once, yet the Last-Modified header reflects an updated date every request.. not even in a linear fashion I might add!

The problem happens when requests for the urchin.js file on google-analytics.com spike, even with load-balancing technologies which are obviously in place. When this happens your browser makes the request for the urchin.js file, but instead of an immediate connection and transfer of the file you get a lagging transfer.

One reason is because the server that the urchin.js file is served from does not allow persistant connections.

<blockquote>This object will be fresh for 1 week. It has a validator present, but when a conditional request was made with it, the same object was sent anyway. It doesn't have a Content-Length header present, so it can't be used in a HTTP/1.0 persistent connection.</blockquote>

Another big big reason is that even though Cache-Control headers are correctly set by google-analytics when serving urchin.js, Instead of responding to an If-Modified-Since header correctly with a 304 Not Modified header, indicating the file has not been modified, google-analytics instead returns the entire urchin.js file again, thus rendering the cache-control void.

You can see this problem with a <a href="http://wireshark.org/">wireshark</a> <a href="http://www.askapache.com/htaccess/sniff-http-to-debug-apache-htaccess-and-httpdconf.html">capture</a> from an exchange.

<pre>GET /urchin.js HTTP/1.1
Accept: */*
Referer: http://www.askapache.com
Accept-Language: en-us
UA-CPU: x86
Accept-Encoding: gzip, deflate
If-Modified-Since: Tue, 20 Mar 2007 22:49:11 GMT
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SU 2.011; .NET CLR 1.1.4322; .NET CLR 2.0.50727; Alexa Toolbar; .NET CLR 3.0.04506.30)
Host: www.google-analytics.com
Connection: Keep-Alive</pre>


<pre>HTTP/1.1 200 OK
Cache-Control: max-age=604800, public
Content-Type: text/javascript
Last-Modified: Tue, 20 Mar 2007 22:54:02 GMT
Content-Encoding: gzip
Server: ucfe
Content-Length: 5675
Date: Sat, 24 Mar 2007 18:23:12 GMT</pre>

Of course you should <a href="http://www.askapache.com/htaccess/speed-up-sites-with-htaccess-caching.html">implement your own caching scheme</a> for best results.

<h3>So there are 2 pretty major things that you can eliminate by using a locally hosted version of the urchin.js file.</h3>
<ol>
	<li><strong>Enable persistant connections</strong></li>
	<li><strong>Send correct 304 Not Modified headers</strong></li>
</ol>

Still, this issue only becomes an issue if you notice lags from the google-analytics site, which happen from time to time.


<h2>Other Speed Tips</h2>
<p>To truly speed up your site, you will want to implement a <a href="http://www.askapache.com/htaccess/speed-up-sites-with-htaccess-caching.html" title="Speed Up Sites with htaccess Caching">server-side caching technique</a>.  Or you can read more about <a href="http://www.askapache.com/htaccess/speed-up-sites-with-htaccess-caching.html" title="Caching Overview">caching and web cache</a>.<br /></p>

<h3><a href="http://askapache.info/trunk/caching.html" title="Apache Caching Guide">Apache Caching Guide</a></h3>
<p><a href="http://askapache.info/trunk/caching.html" title="Apache Caching Guide">This document</a> supplements the <a href="http://askapache.info/trunk/mod/mod_cache.html" title="Apache mod_cache">mod_cache</a>, <a href="http://askapache.info/trunk/mod/mod_disk_cache.html" title="Apache mod_disk_cache">mod_disk_cache</a>, <a href="http://askapache.info/trunk/mod/mod_mem_cache.html" title="Apache mod_mem_cache">mod_mem_cache</a>, <a href="http://askapache.info/trunk/mod/mod_file_cache.html" title="Apache mod_file_cache">mod_file_cache</a> and <a href="http://askapache.info/trunk/programs/htcacheclean.html" title="Apache htcacheclean">htcacheclean</a> reference documentation.</p>
<p>It describes how to use Apache's caching features to accelerate web and proxy serving, while avoiding common problems and misconfigurations.</p><p><a href="http://www.askapache.com/google/faster-google-analytics-local-urchinjs.html"></a><a href="http://www.askapache.com/google/faster-google-analytics-local-urchinjs.html">Speed Up Google Analytics with urchin.js</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/google/faster-google-analytics-local-urchinjs.html/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Advanced Google Analytics 404 Error Page</title>
		<link>http://www.askapache.com/google/tip-google-analytics-404-error-page.html</link>
		<comments>http://www.askapache.com/google/tip-google-analytics-404-error-page.html#comments</comments>
		<pubDate>Sun, 01 Jul 2007 20:16:54 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.askapache.com.com/seo/tip-google-analytics-404-error-page.html</guid>
		<description><![CDATA[<p><a class='IFL' href='http://uploads.askapache.com/2007/02/google-analytics-tips.png' title='ScreenShot of Google Analytics Custom 404 Error Page Results'><img src='http://uploads.askapache.com/2007/02/google-analytics-tips.thumbnail.png' alt='ScreenShot of Google Analytics Custom 404 Error Page Results' /></a><strong>Advanced 404 Not Found Error page usage with Google Analytics</strong>.  This makes it very easy to diagnose and keep track of 404 Error messages from within google analytics.  Enjoy!<br class="C" /></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/google/tip-google-analytics-404-error-page.html"></a><a href="http://www.askapache.com/google/tip-google-analytics-404-error-page.html"><cite>AskApache.com</cite></a></p><p><a rel="lb" class='IFL' href='http://uploads.askapache.com/2007/02/google-analytics-tips.png' title='ScreenShot of Google Analytics Custom 404 Error Page Results'><img src='http://uploads.askapache.com/2007/02/google-analytics-tips.thumbnail.png' alt='ScreenShot of Google Analytics Custom 404 Error Page Results' title="google analytics tips.thumbnail google" /></a><strong>Advanced 404 Not Found Error page usage with Google Analytics</strong>.  This makes it very easy to diagnose and keep track of 404 Error messages from within google analytics.  Enjoy!<br class="C" /></p>
<p class="anote"><span>NOTE:</span>You will most definately want to check out and use the <a href="http://www.askapache.com/seo/404-google-wordpress-plugin.html" title="404 Error Page WordPress Plugin">Google 404 Error Page</a>.</p>

<h3>Normal Google Analytics code on 404 error page</h3>
<p>This default setup for 404 error pages makes it very difficult to find and analyze 404 error page usage stats in Google Analytics</p>
<pre>&lt;script src="http://www.google-analytics.com/urchin.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
_uacct = "UA-732153-7"; urchinTracker();
&lt;/script&gt;</pre>


<h3>Advanced 404 Error Page Setup for Google Analytics urchin</h3>
<p>Since the urchinTracker function has 1 argument which is called "page", this code tells it that the "page" should be <code>/404/?page-not-found=page-requested&amp;linked-from=referrer</code>.</p>
<pre>&lt;script src="http://www.google-analytics.com/urchin.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
_uacct = "UA-732153-7";
urchinTracker("/404/?page-not-found=" + _udl.pathname + _udl.search + "&amp;linked-from=" + _ubd.referrer);
&lt;/script&gt;</pre>




<h2>My WordPress 404.php page</h2>
<p>Note also how I have used the <a href="http://www.askapache.com/seo/seo-with-robotstxt.html" title="googlebot noodp, noindex, noarchive, nofollow">googlebot</a> and <a href="http://www.askapache.com/seo/seo-with-robotstxt.html" title="robots noodp, noindex, noarchive, nofollow">robots meta tags</a> to tell robots not to index or follow links in this page</p>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"&gt;
&lt;head profile="http://gmpg.org/xfn/11"&gt;
    &lt;title&gt;404 Error - Page Not Found&lt;/title&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
    &lt;meta name="googlebot" content="noarchive,noindex,nofollow" /&gt;
    &lt;meta name="robots" content="noarchive,noindex,nofollow" /&gt;
    &lt;link rel="stylesheet" type="text/css" href="http://www.askapache.com/wp-content/themes/apachehtaccess-10/style.css" media="screen" /&gt;
    &lt;script src="http://static.askapache.com/j/askapache.js?v924" type="text/javascript"&gt;&lt;/script&gt;
    &lt;link rel="shortcut icon" href="http://www.askapache.com/favicon.ico" type="image/x-icon" /&gt;
&lt;/head&gt;
&lt;body class="notfound404"&gt;
&lt;h1&gt;&lt;a href="http://www.askapache.com/"&gt;&lt;/a&gt;&lt;/h1&gt;
&lt;div class="a"&gt;
    &lt;div class="b"&gt;
        &lt;h2&gt;&lt;span style="color:red;"&gt;Ooops!&lt;/span&gt;&lt;strong&gt; - The requested page could not be found.&lt;/strong&gt;&lt;/h2&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;p id="FootW"&gt;&amp;copy;2007 AskApache Privacy Policy - Terms of Service - &lt;a class="ICOdreamhost" rel="nofollow" href="http://www.dreamhost.com/r.cgi?211825"&gt;DreamHost Hosting&lt;/a&gt;&lt;/p&gt;
&lt;script src="http://www.google-analytics.com/urchin.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
_uacct = "UA-732153-7";
urchinTracker("/404/?page-not-found=" + _udl.pathname + _udl.search + "&amp;linked-from=" + _ubd.referrer);
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>




<h3>Google Analytics urchin.js</h3>
<pre>//-- Google Analytics Urchin Module
//-- Copyright 2005 Google, All Rights Reserved.
&nbsp;
//-- Urchin On Demand Settings ONLY
var _uacct="";      // set up the Urchin Account
var _userv=1;      // service mode (0=local,1=remote,2=both)
&nbsp;
//-- UTM User Settings
var _ufsc=1;      // set client info flag (1=on|0=off)
var _udn="auto";    // (auto|none|domain) set the domain name for cookies
var _uhash="on";    // (on|off) unique domain hash for cookies
var _utimeout="1800";     // set the inactive session timeout in seconds
var _ugifpath="/__utm.gif";  // set the web path to the __utm.gif file
var _utsp="|";      // transaction field separator
var _uflash=1;      // set flash version detect option (1=on|0=off)
var _utitle=1;      // set the document title detect option (1=on|0=off)
var _ulink=0;      // enable linker functionality (1=on|0=off)
var _uanchor=0;      // enable use of anchors for campaign (1=on|0=off)
var _utcp="/";      // the cookie path for tracking
var _usample=100;    // The sampling % of visitors to track (1-100).
&nbsp;
//-- UTM Campaign Tracking Settings
var _uctm=1;      // set campaign tracking module (1=on|0=off)
var _ucto="15768000";    // set timeout in seconds (6 month default)
var _uccn="utm_campaign";  // name
var _ucmd="utm_medium";    // medium (cpc|cpm|link|email|organic)
var _ucsr="utm_source";    // source
var _uctr="utm_term";    // term/keyword
var _ucct="utm_content";  // content
var _ucid="utm_id";    // id number
var _ucno="utm_nooverride";  // don&#039;t override
&nbsp;
//-- Auto/Organic Sources and Keywords
var _uOsr=new Array();
var _uOkw=new Array();
_uOsr[0]="google";  _uOkw[0]="q";
_uOsr[1]="yahoo";  _uOkw[1]="p";
_uOsr[2]="msn";    _uOkw[2]="q";
_uOsr[3]="aol";    _uOkw[3]="query";
_uOsr[4]="aol";    _uOkw[4]="encquery";
_uOsr[5]="lycos";  _uOkw[5]="query";
_uOsr[6]="ask";    _uOkw[6]="q";
_uOsr[7]="altavista";  _uOkw[7]="q";
_uOsr[8]="search";  _uOkw[8]="q";
_uOsr[9]="netscape";  _uOkw[9]="s";
_uOsr[10]="cnn";  _uOkw[10]="query";
_uOsr[11]="looksmart";  _uOkw[11]="qt";
_uOsr[12]="about";  _uOkw[12]="terms";
_uOsr[13]="mamma";  _uOkw[13]="query";
_uOsr[14]="alltheweb";  _uOkw[14]="q";
_uOsr[15]="gigablast";  _uOkw[15]="q";
_uOsr[16]="voila";  _uOkw[16]="kw";
_uOsr[17]="virgilio";  _uOkw[17]="qs";
_uOsr[18]="live";  _uOkw[18]="q";
_uOsr[19]="baidu";  _uOkw[19]="wd";
_uOsr[20]="alice";  _uOkw[20]="qs";
_uOsr[21]="seznam";  _uOkw[21]="w";
_uOsr[22]="yandex";  _uOkw[22]="text";
_uOsr[23]="najdi";  _uOkw[23]="q";
&nbsp;
//-- Auto/Organic Keywords to Ignore
var _uOno=new Array();
//_uOno[0]="urchin";
//_uOno[1]="urchin.com";
//_uOno[2]="www.urchin.com";
&nbsp;
//-- Referral domains to Ignore
var _uRno=new Array();
//_uRno[0]=".urchin.com";</pre>

<a href='http://uploads.askapache.com/2007/03/urchin1.js' title='Google Analytics urchin.js'>Google Analytics urchin.js</a>
<pre>Urchin On Demand Settings ONLY
_uacct  =""       set up the Urchin Account
_userv  =1       service mode (0 =local,1 =remote,2 =both)
&nbsp;
UTM User Settings
_ufsc  =1       set client info flag (1 =on|0 =off)
_udn ="auto"     (auto|none|domain) set the domain name for cookies
_uhash ="on"     (on|off) unique domain hash for cookies
_utimeout ="1800"      set the inactive session timeout in seconds
_ugifpath ="/__utm.gif"   set the web path to the __utm.gif file
_utsp ="|"       transaction field separator
_uflash =1       set flash version detect option (1 =on|0 =off)
_utitle =1       set the document title detect option (1 =on|0 =off)
_ulink =0       enable linker functionality (1 =on|0 =off)
_uanchor =0       enable use of anchors for campaign (1 =on|0 =off)
_utcp ="/"       the cookie path for tracking
_usample =100     The sampling % of visitors to track (1-100).
&nbsp;
UTM Campaign Tracking Settings
_uctm =1       set campaign tracking module (1 =on|0 =off)
_ucto ="15768000"     set timeout in seconds (6 month default)
_uccn ="utm_campaign"   name
_ucmd ="utm_medium"     medium (cpc|cpm|link|email|organic)
_ucsr ="utm_source"     source
_uctr ="utm_term"     term/keyword
_ucct ="utm_content"   content
_ucid ="utm_id"     id number
_ucno ="utm_nooverride"   don&#039;t override</pre><p><a href="http://www.askapache.com/google/tip-google-analytics-404-error-page.html"></a><a href="http://www.askapache.com/google/tip-google-analytics-404-error-page.html">Advanced Google Analytics 404 Error Page</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/google/tip-google-analytics-404-error-page.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Use php.ini to replace html with anything</title>
		<link>http://www.askapache.com/php/use-phpini-to-add-http-headers-to-output.html</link>
		<comments>http://www.askapache.com/php/use-phpini-to-add-http-headers-to-output.html#comments</comments>
		<pubDate>Sat, 10 Mar 2007 02:19:10 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.askapache.com/htaccess/use-phpini-to-add-http-headers-to-output.html</guid>
		<description><![CDATA[Use php.ini to add HTTP Headers to output]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/php/use-phpini-to-add-http-headers-to-output.html"></a><a href="http://www.askapache.com/php/use-phpini-to-add-http-headers-to-output.html"><cite>AskApache.com</cite></a></p><h2>What to include?</h2>
<p>By including a php file using php.ini, you can replace the headers in your html with dynamic headers.</p>
<p>Include a php file that contains a function to replace html with different html.  You include a file from your php.ini like <code>auto_prepend_file /home/askapache.com/config.php</code>?
<hr />
<p>config.php example from: <a href="http://brajeshwar.com/2007/effective-way-to-update-your-blogs-header-scripts-mybloglog-google-analytics-mint/" title="MyBlogLog, Google Analytics, Mint">Effective way to update your blog's header scripts</a></p>

<pre>&lt;?php
function Config($page)  {
&nbsp;
$googleAnalytics = &#039;&lt;!-- Google Analytics --&gt;
&lt;script src="http://www.google-analytics.com/urchin.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;_uacct = "UA-188760-13";urchinTracker();&lt;/script&gt;
&#039;;
&nbsp;
$quantcast = &#039;&lt;!-- Quantcast  --&gt;
&lt;script type="text/javascript" src="http://edge.quantserve.com/quant.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;_qacct="p-0dzSWakPjpGqM";quantserve();&lt;/script&gt;
&lt;noscript&gt;&lt;img src="http://pixel.quantserve.com/pixel/p-0dzSWakPjpGqM.gif" style="display: none" height="1" width="1" alt="Quantcast"/&gt;&lt;/noscript&gt;
&#039;;
&nbsp;
$mybloglog = &#039;&lt;!-- MyBlogLog --&gt;
&lt;script type="text/javascript" src="http://track.mybloglog.com/js/jsserv.php?mblID=2007020306380804"&gt;&lt;/script&gt;
&#039;;
&nbsp;
$pages  = array(); // Add pages (relative to the public site root) that should be ignored
$ip    = array(); // Add IP addresses that should be ignored, for instance you don&#039;t want to track yourself or your company&#039;s visit to your blog.
&nbsp;
if (
  strpos($page,&#039;frameset&#039;) !== false ||
  (!empty($ip) &amp;&amp; in_array($_SERVER[&#039;REMOTE_ADDR&#039;], $ip)) ||
  (!empty($pages) &amp;&amp; in_array((isset($_SERVER[&#039;PHP_SELF&#039;]) &amp;&amp; !empty($_SERVER[&#039;PHP_SELF&#039;]))?$_SERVER[&#039;PHP_SELF&#039;]:$_SERVER[&#039;SCRIPT_NAME&#039;], $pages))
  )
{ return $page; }
$replace = array
  (
    &#039;&lt;/head&gt;&#039;,
    &#039;&lt;/head&gt;&#039;
  );
  return str_replace($replace, "\n{$googleAnalytics}\n\n{$quantcast}\n\n{$mybloglog}\r&lt;/head&gt;", $page);
}
ob_start("Config");
?&gt;</pre>


<h2>php.ini</h2>
<h3>auto_prepend_file</h3>
<p>Specifies the name of a file that is automatically parsed before the main file. The file is included as if it was called with the include() function, so include_path is used.
The special value none disables auto-prepending.</p>

<h3>auto_append_file</h3>
<p>Specifies the name of a file that is automatically parsed after the main file. The file is included as if it was called with the include() function, so include_path is used.
The special value none disables auto-appending.</p>

<p><strong>Note</strong>: If the script is terminated with exit(), auto-append will not occur.</p><p><a href="http://www.askapache.com/php/use-phpini-to-add-http-headers-to-output.html"></a><a href="http://www.askapache.com/php/use-phpini-to-add-http-headers-to-output.html">Use php.ini to replace html with anything</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/php/use-phpini-to-add-http-headers-to-output.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

