<?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>Seocracy.com &#187; analytics</title>
	<atom:link href="http://seocracy.com/tag/analytics/feed/" rel="self" type="application/rss+xml" />
	<link>http://seocracy.com</link>
	<description>A blog about technical SEO, Ruby, Web Apps, and more</description>
	<lastBuildDate>Wed, 28 Apr 2010 21:47:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Updated Google Analytics Keyword Extractor</title>
		<link>http://seocracy.com/2009/04/updated-google-analytics-keyword-extractor/</link>
		<comments>http://seocracy.com/2009/04/updated-google-analytics-keyword-extractor/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 13:34:27 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Google Hacking]]></category>
		<category><![CDATA[Link-Love]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Tools & Applications]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[gattica gem]]></category>
		<category><![CDATA[keywords]]></category>
		<category><![CDATA[organic]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[statistics]]></category>

		<guid isPermaLink="false">http://seocracy.com/?p=298</guid>
		<description><![CDATA[OK,  I&#8217;ll admit, my last post was downright shameful&#8230;
The code was poorly presented, and poorly formatted. It wasn&#8217;t at ALL my normal caliber of work, so I went ahead and rewrote the concept into a tighter little wrapper.
I am using the Gattica gem to interact with the Google Analytics API.
This little script provides a wrapper [...]]]></description>
			<content:encoded><![CDATA[<p>OK,  I&#8217;ll admit, my last post was downright shameful&#8230;</p>
<p>The code was poorly presented, and poorly formatted. It wasn&#8217;t at ALL my normal caliber of work, so I went ahead and rewrote the concept into a tighter little wrapper.</p>
<p>I am using the <a href="http://github.com/cannikin/gattica/tree/master" target="_blank">Gattica gem</a> to interact with the Google Analytics API.</p>
<p>This little script provides a wrapper around the gem that easily allows you to extract your sites organic keywords and sort them based on the number of unique entrances to your site via each keyword.</p>
<p><script src="http://gist.github.com/104452.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://seocracy.com/2009/04/updated-google-analytics-keyword-extractor/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using the Google Analytics API with Ruby, Open-Uri &amp; Hpricot</title>
		<link>http://seocracy.com/2009/04/using-the-google-analytics-api-with-ruby-open-uri-hpricot/</link>
		<comments>http://seocracy.com/2009/04/using-the-google-analytics-api-with-ruby-open-uri-hpricot/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 19:51:38 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Google Hacking]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[hpricot]]></category>
		<category><![CDATA[keywords]]></category>
		<category><![CDATA[open-uri]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[scraping]]></category>

		<guid isPermaLink="false">http://seocracy.com/?p=269</guid>
		<description><![CDATA[You may or may not have heard that Google has finally opened up their Analytics API to the public. You can read Googles official statement here.
I thought I&#8217;d show you all a quick crash introduction on how you can access the API using Ruby.
The following code uses Open-Uri to access the API and Hpricot to [...]]]></description>
			<content:encoded><![CDATA[<p>You may or may not have heard that Google has finally opened up their Analytics API to the public. You can read Googles official statement <a href="http://analytics.blogspot.com/2009/04/attention-developers-google-analytics.html">here</a>.</p>
<p>I thought I&#8217;d show you all a quick crash introduction on how you can access the API using Ruby.</p>
<p>The following code uses Open-Uri to access the API and Hpricot to parse the response. In this example, we&#8217;re going to authenticate with the API, and then we&#8217;re going to use it to extract all the keywords (organic and paid) which have brought visitors to our site within the past year (limited to 100 keywords max)</p>
<p>NB: sorry for the shitty formatting. I tried like hell to get this code to display well, but I gave up. Just copy and paste..you&#8217;ll be able to sort it out.</p>
<p>require &#8216;rubygems&#8217;<br />
require &#8216;open-uri&#8217;<br />
require &#8216;hpricot&#8217;</p>
<p>USER_EMAIL=&#8221;XXXXXX&#8221; #Insert your Google Account email address here<br />
USER_PASS=&#8221;XXXXXX&#8221; #Insert your password here<br />
PROFILE_ID=&#8221;XXXXXX&#8221; #Insert your profile ID here (Find this in your analytics profile under profile settings)<br />
results = {}<br />
keywords = []<br />
auth_url = &#8220;https://www.google.com/accounts/ClientLogin?Email=#{USER_EMAIL}&amp;amp;Passwd=#{USER_PASS}&amp;amp;accountType=GOOGLE&amp;amp;source=open-uri-limbo-v01&amp;amp;service=analytics&#8221;</p>
<p>auth_key = (open(auth_url).read).split(&#8221;\n&#8221;).last</p>
<p>#now query for keywords, you can change the date values as you see fit, as well as the max-results value<br />
response = Hpricot.XML(open(&#8221;https://www.google.com/analytics/feeds/data?start-date=2008-10-01&amp;amp;end-date=2009-04-21&amp;amp;dimensions=ga:keyword&amp;amp;max-results=100&amp;amp;ids=ga:#{PROFILE_ID}&amp;amp;prettyprint=true&#8221;,<br />
&#8220;Authorization&#8221; =&amp;gt; &#8220;GoogleLogin #{auth_key}&#8221;).read)<br />
## storing some of the extra information in a &#8220;results&#8221; hash in case we need it later<br />
results[:total_results] = (response/&#8217;openSearch:totalResults&#8217;).inner_text<br />
results[:start_index] = (response/&#8217;openSearch:startIndex&#8217;).inner_text<br />
results[:items_per_page] = (response/&#8217;openSearch:itemsPerPage&#8217;).inner_text<br />
results[:start_date] = (response/&#8217;dxp:startDate&#8217;).inner_text<br />
results[:end_date] = (response/&#8217;dxp:endDate&#8217;).inner_text<br />
results[:aggregates] = (response/&#8217;dxp:aggregates&#8217;).inner_text<br />
results[:data_source] = (response/&#8217;dxp:dataSource&#8217;)<br />
results[:entries] = (response/&#8217;entry&#8217;)<br />
## the entries contain each individual keyword</p>
<p>## for my purposes, I&#8217;m not interested in visitors coming from search operators like &#8220;site:&#8221;<br />
## so we&#8217;re scrubbing those out.<br />
for entry in results[:entries]<br />
keyword = (entry/&#8217;dxp:dimension&#8217;).first[:value]<br />
keywords &amp;lt;&amp;lt; keyword unless keyword.include? &#8220;site:&#8221; or keyword.match(/\(.*\)/)<br />
end</p>
<p>## Now print out our keywords<br />
keywords.each {|kw|<br />
puts kw<br />
}</p>
<p><strong>UPDATE</strong> just seconds ago, a new gem was released called <a href="http://github.com/cannikin/gattica/tree/master">Gattica</a> which you can use to access the Google Analytics API. How&#8217;s that for up to the minute blogging? Thanks Twitter!</p>
]]></content:encoded>
			<wfw:commentRss>http://seocracy.com/2009/04/using-the-google-analytics-api-with-ruby-open-uri-hpricot/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

