<?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>Kevin Deldycke &#187; analytics</title> <atom:link href="http://kevin.deldycke.com/tag/analytics/feed/" rel="self" type="application/rss+xml" /><link>http://kevin.deldycke.com</link> <description>Free software engineer &#38; wannabe videomaker</description> <lastBuildDate>Fri, 03 Feb 2012 19:08:27 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>How-to add Google Analytics tracking to Zenphoto</title><link>http://kevin.deldycke.com/2008/08/how-to-add-google-analytics-tracking-to-zenphoto/</link> <comments>http://kevin.deldycke.com/2008/08/how-to-add-google-analytics-tracking-to-zenphoto/#comments</comments> <pubDate>Sat, 16 Aug 2008 20:49:55 +0000</pubDate> <dc:creator>Kev</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[analytics]]></category> <category><![CDATA[Google]]></category> <category><![CDATA[hack]]></category> <category><![CDATA[patch]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Snippet]]></category> <category><![CDATA[Web]]></category> <category><![CDATA[Zenphoto]]></category><guid isPermaLink="false">http://kevin.deldycke.com/?p=286</guid> <description><![CDATA[This is the patch I apply on each Zenphoto I install and upgrade. This little hack add Google Analytics tracking for all users except administrators. Why ? As you can see in ticket #441 in Zenphoto bugtracker, there is no &#8230; <a href="http://kevin.deldycke.com/2008/08/how-to-add-google-analytics-tracking-to-zenphoto/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p><img src="http://kevin.deldycke.com/wp-content/uploads/2008/08/zenphoto-12-150x23.png" alt="" title="zenphoto-12" width="150" height="23" class="alignleft size-thumbnail wp-image-299" /></p><p>This is the patch I apply on each <a href="http://www.zenphoto.org">Zenphoto</a> I install and upgrade. This little hack add <a href="http://www.google.com/analytics/">Google Analytics</a> tracking for all users except administrators.</p><p>Why ? As you can see in <a href="http://www.zenphoto.org/trac/ticket/441">ticket #441 in Zenphoto bugtracker</a>, there is no intention of adding support of GA in Zenphoto, even as an optional plugin. Hence my tiny hack. And for the non-admin stuff, I like having unbiased statistics: on low-audience websites, administrators can generate more traffic than legitimate users (if not all&#8230;).</p><p>Here is the <a href='http://kevin.deldycke.com/wp-content/uploads/2008/08/google-analytics-tracking-for-non-admin-users.patch'>downloadable patch file</a>, and its content:</p><pre class="brush: diff; title: ; notranslate">
diff -ru ./zenphoto-orig/zp-core/template-functions.php ./zenphoto/zp-core/template-functions.php
--- ./zenphoto-orig/zp-core/template-functions.php  2008-08-15 07:43:05.000000000 +0200
+++ ./zenphoto/zp-core/template-functions.php 2008-08-16 17:08:03.000000000 +0200
@@ -147,7 +147,16 @@

    echo &quot;&lt;li&gt;&lt;a href=\&quot;&quot;.$zf.&quot;/admin.php?logout$redirect\&quot;&gt;&quot;.gettext(&quot;Logout&quot;).&quot;&lt;/a&gt;&lt;/li&gt;\n&quot;;
    echo &quot;&lt;/ul&gt;&lt;/div&gt;\n&quot;;
- }
+ } else {
+    echo &quot;&lt;script type=\&quot;text/javascript\&quot;&gt;
+var gaJsHost = ((\&quot;https:\&quot; == document.location.protocol) ? \&quot;https://ssl.\&quot; : \&quot;http://www.\&quot;);
+document.write(unescape(\&quot;%3Cscript src='\&quot; + gaJsHost + \&quot;google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\&quot;));
+&lt;/script&gt;
+&lt;script type=\&quot;text/javascript\&quot;&gt;
+var pageTracker = _gat._getTracker(\&quot;UA-XXXXXX-Y\&quot;);
+pageTracker._trackPageview();
+&lt;/script&gt;&quot;;
+  }
 }

 /**
</pre><p>This patch was generated from a <a href="http://www.zenphoto.org/2008/08/zenphoto-12-release-announcement/">Zenphoto v1.2</a> and will likely not work with any other version.</p><p>Do not forget to update the dummy Google Analytics account ID above (<code>UA-XXXXXX-Y</code>) by yours.</p><p>And finally, to apply the patch, invoke the classic <code>patch</code> command:</p><pre class="brush: bash; title: ; notranslate">
patch -p0 &lt; ./google-analytics-tracking-for-non-admin-users.patch
</pre>]]></content:encoded> <wfw:commentRss>http://kevin.deldycke.com/2008/08/how-to-add-google-analytics-tracking-to-zenphoto/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 2/15 queries in 0.009 seconds using apc
Object Caching 508/524 objects using apc

Served from: kevin.deldycke.com @ 2012-02-08 10:52:58 -->
