<?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>Thoughts Electrique &#187; Google Analytics</title>
	<atom:link href="http://www.sebastian.himberger.de/blog/tag/google-analytics/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sebastian.himberger.de/blog</link>
	<description>Sebastian Himbergers blog about technology and software development</description>
	<lastBuildDate>Sat, 16 Jul 2011 22:48:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Google Analytics with OpenCms</title>
		<link>http://www.sebastian.himberger.de/blog/2008/11/19/google-analytics-with-opencms/</link>
		<comments>http://www.sebastian.himberger.de/blog/2008/11/19/google-analytics-with-opencms/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 20:17:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Google Analytics]]></category>
		<category><![CDATA[OpenCms]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[Sourcecode]]></category>
		<category><![CDATA[Websites]]></category>

		<guid isPermaLink="false">http://www.sebastian.himberger.de/blog/?p=12</guid>
		<description><![CDATA[Avoid the wrong track For a while I have been using Google Analytics for my website statistics (additionally to AWStats) and I really like the reports (Note: Yahoo! now has a competing product out there called &#8220;Yahoo! Web Analytics&#8221; which I might check out in the future). I&#8217;ve also installed various tracking software (like etracker [...]]]></description>
			<content:encoded><![CDATA[<h3>Avoid the wrong track</h3>
<p>For a while I have been using Google Analytics for my website statistics (additionally to <a href="http://awstats.sourceforge.net/" target="_blank">AWStats</a>) and I really like the reports (<strong>Note: </strong>Yahoo! now has a competing product out there called &#8220;<a href="http://web.analytics.yahoo.com/">Yahoo! Web Analytics</a>&#8221; which I might check out in the future). I&#8217;ve also installed various tracking software (like <a href="http://www.etracker.de/" target="_blank">etracker </a>- which is a German service) on different CMS solutions at customer sites.</p>
<p>Nearly all services offer some copy&amp;paste code to throw into your HTML/JSP/PHP/Whatever, but if you&#8217;re using a CMS system things might be a bit more complicated. In most CMS systems you have two different kinds of traffic: Visitor generated and editor generated. Editors browse the site while checking their changes or proofreading text in the offline area (unpublished content). You most likely don&#8217;t want to have this traffic screw up your statistics, so it makes sense to filter out the traffic. Mostly a simple <em>if(&#8230;)-clause</em> is all that&#8217;s needed to achieve this. Here is my solution for OpenCms:</p>
<pre>&lt;%@ page session="false" %&gt;
&lt;%@ page import="org.opencms.jsp.*,org.opencms.file.*" %&gt;
&lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
&lt;%
  CmsJspActionElement cmsa = new CmsJspActionElement(pageContext,request,response);
  CmsUser currentUser = cmsa.getRequestContext().currentUser();
  boolean displayAnalytics = currentUser.isGuestUser() || currentUser.isWebuser();
  pageContext.setAttribute("displayAnalytics",new Boolean(displayAnalytics));
%&gt;
&lt;c:if test="${displayAnalytics}"&gt;
  &lt;!-- Your Google Analytics JavaScript goes here --&gt;
&lt;/c:if&gt;</pre>
<p>Of course you can easily create a JSP from this and include it in your template.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastian.himberger.de/blog/2008/11/19/google-analytics-with-opencms/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

