<?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>qvister &#187; analytics</title>
	<atom:link href="http://qvister.se/tag/analytics/feed/" rel="self" type="application/rss+xml" />
	<link>http://qvister.se</link>
	<description></description>
	<lastBuildDate>Tue, 01 Nov 2011 12:56:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>Server-side Google Analytics</title>
		<link>http://qvister.se/2010/02/02/server-side-google-analytics/</link>
		<comments>http://qvister.se/2010/02/02/server-side-google-analytics/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 11:49:14 +0000</pubDate>
		<dc:creator>Anton Lindqvist</dc:creator>
				<category><![CDATA[Blogg]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[mobil]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://qvister.se/?p=624</guid>
		<description><![CDATA[In late 2009 Google announced a new Analytics SDK used for tracking events inside iPhone and Android applications. The same release also featured a new method for more accurate tracking running Analytics server-side instead of using JavaScript. This especially comes handy when developing mobile websites. Many older phones suffer from the lack of JavaScript support. [...]]]></description>
			<content:encoded><![CDATA[
<p>In late 2009 Google announced a new Analytics SDK used for tracking events inside iPhone and Android applications. The same release also featured a new method for more accurate tracking running Analytics server-side instead of using JavaScript. This especially comes handy when developing mobile websites.<span id="more-624"></span></p>
<p>Many older phones suffer from the lack of JavaScript support. Which in some cases makes it more complicated to track the user. But running the tracking service server-side will solve this problem easily.</p>
<p>As mentioned earlier Google does offer a server-side solution for Analytics. Sadly enough the documentation is almost non-existing and the only thing provided is some crappy PHP <a href="http://www.google.com/url?sa=D&amp;q=http://www.google.com/analytics/googleanalyticsformobile.zip&amp;usg=AFQjCNEzXGXLA9w0rSdNPKJT-BA0QfJ3MQ">example code</a> to get you started.</p>
<p>Therefor I wrote a simple class in PHP used for interacting with the server-side solution for Analytics. The logic and flow is provided by the existing example code. Below you&#8217;ll find a brief description of the &#8220;<em>flow</em>&#8220;.</p>
<p>A user comes to your site and the url function will generate an uri with all mandatory parameters included. This uri is will be included in the src attribute inside an img element. The browser will then request the uri believing that it&#8217;s an image. The uri will actually be pointing to a executable script. In this script the track function is called. A unique visitor id will be generated and stored inside a cookie. An HTTP-request will be sent to Analytics including all kind of parameters in order to track the user. When the request is done a 1&#215;1 GIF image will be severed in order to satisfy the browser.</p>
<p>The method described above is a quite common way of solving lack of JavaScript related problems.</p>
<p>In order to start using this tracking method you&#8217;ll need to create a new Analytics profile for your website.</p>
<ul>
<li>Create a new profile.</li>
<li>Select &#8220;tracking for a new domain&#8221; or new subdomain if applicable.</li>
<li>Click on the &#8220;Advanced&#8221; tab and choose the mobile option.</li>
<li>Copy your new Analytics ID from the textarea (MO-XXXXXX-XX).</li>
</ul>
<p>The code is available on <a href="http://github.com/mptre/php-ga">GitHub</a> so feel free to fork away! There&#8217;s also a demo included in the repository. Should be just enough to get you started.</p>
<p>To all CodeIgniter fanboys out there. The class works perfectly as a library in CodeIgniter. You just need to make sure to include the uri generated from the url function inside your view. And then point it towards a function in your controller which executes the track function. See the demo inside the repository for further reference.</p>
<p>Happy accurate tracking!</p>
<p><em>Photo credit: <a href="http://www.flickr.com/photos/manfrys/" target="_blank">Antonio Manfredonio</a>.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://qvister.se/2010/02/02/server-side-google-analytics/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Spåra utgående länkar med Google Analytics</title>
		<link>http://qvister.se/2008/11/12/spara-utgaende-lankar-med-google-analytics/</link>
		<comments>http://qvister.se/2008/11/12/spara-utgaende-lankar-med-google-analytics/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 08:24:37 +0000</pubDate>
		<dc:creator>Anton Lindqvist</dc:creator>
				<category><![CDATA[Blogg]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://qvister.se/?p=106</guid>
		<description><![CDATA[Ibland kan det vara intressant eller rent ut sagt nödvändigt att se hur många som klickar på ens utgående länkar. Detta är givetvis möjligt med Google Analytics, dock är det inget som sker från start. Utan man behöver lägga till ett onClick-attribut på varje utgående länk. Att göra det här &#8220;manuellt&#8221; är inget jag vill [...]]]></description>
			<content:encoded><![CDATA[<p>Ibland kan det vara intressant eller rent ut sagt nödvändigt att se hur många som klickar på ens utgående länkar. Detta är givetvis möjligt med Google Analytics, dock är det inget som sker från start. Utan man behöver lägga till ett onClick-attribut på varje utgående länk. Att göra det här &#8220;<em>manuellt</em>&#8221; är inget jag vill ödsla tid på. Istället kan man lösa det med en liten bit JavaScript.<span id="more-106"></span></p>
<p>Personligen föredrar jag att använda mig JavaScript-biblioteket <a rel="external" href="http://jquery.com/">jQuery</a>.</p>
<p>Principen är den att varje gång någon för musen över en länk som har attributen rel=external (d.v.s en utgående länk) läggs onClick-attributen på så att den kan spåras via Google Analytics. OBS Google Analytics koden måste komma före alla utgående länkar, annars kommer inga klick registreras. Förslagsvis lägger du Google Analytics koden precis innan body:n avslutas.</p>
<pre>$(document).ready(function() {
    $('a[rel=external]').hover(function() {
        var href = $(this).attr('href');
        $(this).attr('onClick', 'javascript: pageTracker._trackPageview(\'/outgoing/' + href + '\');');

        return false;
    },function() {
    return false;
    });
});</pre>
<p>Notera att det kan upp till 24-48 timmar innan dina utgående länkar dyker upp i Google Analytics. De utgående länkarna kommer du sedan hitta under Content &gt; Top Content. T ex. kommer länken www.example.com listas som /outgoing/www.example.com i Google Analytics. Läs mer om utgående länkar hos <a onclick="javascript: pageTracker._trackPageview('/outgoing/http://www.google.com/support/analytics/bin/answer.py?hl=en&amp;answer=55527');" rel="external" href="http://www.google.com/support/analytics/bin/answer.py?hl=en&amp;answer=55527" target="_blank">Google</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://qvister.se/2008/11/12/spara-utgaende-lankar-med-google-analytics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

