<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5850249675402791846</id><updated>2012-01-23T21:34:42.317-08:00</updated><category term='PHP'/><category term='Google Analytics'/><category term='Google Website Optimizer'/><category term='xhtml'/><category term='API'/><title type='text'>Nethab | Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://nethab.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5850249675402791846/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://nethab.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Nethab</name><uri>http://www.blogger.com/profile/00729890173827654664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5850249675402791846.post-42763103609945656</id><published>2009-04-24T17:35:00.000-07:00</published><updated>2009-06-18T14:21:14.925-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='Google Analytics'/><category scheme='http://www.blogger.com/atom/ns#' term='API'/><title type='text'>Using PHP with Google Analytics API</title><content type='html'>&lt;p&gt;
Since Google Analytics just released their API as a public beta, I decided to try and get it working with the &lt;a href="http://framework.zend.com/download/gdata"&gt;PHP Zend GData library&lt;/a&gt;. I've seen several implementations using cURL, but the GData library seems ready-made for it, so I figured why not save some hassle.
&lt;/p&gt;
&lt;h2&gt;Logging In&lt;/h2&gt;
&lt;p&gt;
The first thing you have to do is login to the API service.
&lt;/p&gt;
&lt;p style="white-space:pre"&gt;
        $email = "&amp;lt;email@domain.com&amp;gt;";
        $pass = "&amp;lt;password&amp;gt;";

        require_once("Zend/Loader.php");

        Zend_Loader::loadClass('Zend_Gdata');
        Zend_Loader::loadClass('Zend_Gdata_Query');
        Zend_Loader::loadClass('Zend_Gdata_ClientLogin');

        $client = Zend_Gdata_ClientLogin::getHttpClient($email, $pass, "analytics");
        $gdClient = new Zend_Gdata($client);
&lt;/p&gt;
&lt;h2&gt;List of Accounts/Profiles&lt;/h2&gt;
&lt;p&gt;
Now that we've logged in, we need to get a list of available Accounts/Profiles. Specifically we need to get the "profile ID" of the website we want to report on.
&lt;/p&gt;
&lt;p style="white-space:pre"&gt;
try {
        $results = $gdClient-&amp;gt;getFeed("https://www.google.com/analytics/feeds/accounts/$email");
        foreach ($results as $entry) {
                echo "Profile: " . $entry-&amp;gt;title . " - Id: " . $entry-&amp;gt;extensionElements[0] . "\n";
        }
} catch (Zend_Exception $e) {
        echo "Caught exception: " . get_class($e) . "\n";
        echo "Message: " . $e-&amp;gt;getMessage() . "\n";
}
&lt;/p&gt;
&lt;h2&gt;Fetching the Data&lt;/h2&gt;
&lt;p&gt;
Now that we've found our profile ID, we should decide &lt;a href="http://code.google.com/apis/analytics/docs/gdata/gdataReference.html"&gt;which data we want to collect&lt;/a&gt;, and request it from Google's servers. I find it easiest to return it as &lt;acronym title="Comma Separated Values"&gt;CSV&lt;/acronym&gt;.
&lt;/p&gt;
&lt;p style="white-space:pre"&gt;
try {
        $dimensions = array("ga:region", "ga:city", "ga:latitude", "ga:longitude");
        $metrics = array("ga:visits", "ga:pageviews");

        $reportURL = "https://www.google.com/analytics/feeds/data?ids=&amp;lt;profile ID&amp;gt;&amp;amp;" .
                     "dimensions=" . @implode(",", $dimensions) . "&amp;amp;" .
                     "metrics=" . @implode(",", $metrics) . "&amp;amp;" .
                     "start-date=&amp;lt;YYYY-MM-DD&amp;gt;&amp;amp;" .
                     "end-date=&amp;lt;YYYY-MM-DD&amp;gt;";
        $results = $gdClient-&gt;getFeed($reportURL);
        $titleRow = 1; // To output a row of column labels
        foreach ($results as $rep) {
                if ($titleRow) {
                        foreach ($rep-&gt;extensionElements as $elem) {
                                $titles[] = $elem-&gt;extensionAttributes["name"]["value"];
                        }
                        echo implode(",", $titles) . "\n";
                        $titleRow = 0;
                }
                foreach ($rep-&gt;extensionElements as $elem) {
                        $row[] = $elem-&gt;extensionAttributes["value"]["value"];
                }
                echo implode(",", $row) . "\n";
        }
} catch (Zend_Exception $e) {
        echo "Caught exception: " . get_class($e) . "\n";
        echo "Message: " . $e-&amp;gt;getMessage() . "\n";
}
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5850249675402791846-42763103609945656?l=nethab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nethab.blogspot.com/feeds/42763103609945656/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5850249675402791846&amp;postID=42763103609945656' title='63 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5850249675402791846/posts/default/42763103609945656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5850249675402791846/posts/default/42763103609945656'/><link rel='alternate' type='text/html' href='http://nethab.blogspot.com/2009/04/using-php-with-google-analytics-api.html' title='Using PHP with Google Analytics API'/><author><name>Nethab</name><uri>http://www.blogger.com/profile/00729890173827654664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>63</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5850249675402791846.post-8604658429378788748</id><published>2008-08-29T20:51:00.000-07:00</published><updated>2008-11-14T11:54:29.219-08:00</updated><title type='text'>Geo Targeting vs. Language Targeting and Usability</title><content type='html'>&lt;p&gt;
Target languages first, because the visitor might want information about a country other than their own.
&lt;/p&gt;
&lt;p&gt;
Had a meeting with our VP of Marketing today about making our website "international". He (along with the VP of Sales) were adamant about breaking out the website by country, then by language. So for example you would choose France, and your language choice would be Fran&amp;ccedil;ais, and all the information on that page/site would be related to France.
&lt;/p&gt;
&lt;h3&gt;Why that doesn't work&lt;/h3&gt;
&lt;/p&gt;
&lt;p&gt;
On the one hand your company has information specific to a country (ie. product X is only available in France, Germany, and Spain).
&lt;/p&gt;
&lt;p&gt;
On the other hand, your visitor(s) have a specific language preference (ie. s/he only speaks French).
&lt;/p&gt;
&lt;p&gt;
Let's say the visitors' company has offices in France, Spain, and Italy; and needs information about which products are available in those countries. If the "Products available in Spain" is only available in Espa&amp;ntilde;ol, our hypothetical French speaking visitor will not be able to find the information they need (resulting in a potential lost sale).
&lt;/p&gt;
&lt;p&gt;
Arguably this places an artificial barrier between you and a prime demographic: &lt;strong&gt;multi-national companies&lt;/strong&gt;.
&lt;/p&gt;
&lt;h3&gt;That's not all&lt;/h3&gt;
&lt;p&gt;
In a perfect world all country specific information would be available in every language, but even if that were the case, when you take into account the user experience of forcing the visitor to navigate through 3 different country specific sites (clicking to the country selection page, and then re-navigating to the product information) you're talking about a minimum of 3x the clicks to find their information (more if your country sites have a lot of pages).
&lt;/p&gt;
&lt;p&gt;
Instead, if you first organize your site around the language(s) spoken by your visitors, you can reduce the number of clicks required to find information on your site. If you also take into account the ability to auto-detect the language of your visitors (using the browsers "Accept-Language" header), you can reduce the number of clicks further still.
&lt;/p&gt;
&lt;p&gt;
In other words, you never know what your visitors are looking for, so don't limit them by translating country specific information into just that countries language(s). Also, by organizing your site around your visitors language, you will decrease the time and effort required to research your products.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5850249675402791846-8604658429378788748?l=nethab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nethab.blogspot.com/feeds/8604658429378788748/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5850249675402791846&amp;postID=8604658429378788748' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5850249675402791846/posts/default/8604658429378788748'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5850249675402791846/posts/default/8604658429378788748'/><link rel='alternate' type='text/html' href='http://nethab.blogspot.com/2008/08/geo-targeting-vs-language-targeting-and.html' title='Geo Targeting vs. Language Targeting and Usability'/><author><name>Nethab</name><uri>http://www.blogger.com/profile/00729890173827654664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5850249675402791846.post-5924052957617171885</id><published>2008-07-08T11:27:00.000-07:00</published><updated>2009-04-24T19:06:47.819-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Google Website Optimizer'/><title type='text'>Google Website Optimizer in an external JS file</title><content type='html'>&lt;p&gt;
An external ".js" file can come in handy when you use a &lt;strong&gt;content management system&lt;/strong&gt;, &lt;strong&gt;templates&lt;/strong&gt; (or server-side-includes) and/or have a large site and want to test a large number of pages simultaneously. Thanks to some modifications to the &lt;acronym title="Google Website Optimier"&gt;GWO&lt;/acronym&gt; scripts made by &lt;a href="http://groups.google.com/group/gwotechnical/msg/010a33ac65e9515c"&gt;ShoreTel&lt;/a&gt; it is now possible.
&lt;/p&gt;
&lt;h2&gt;How-To&lt;/h2&gt;
&lt;p&gt;
The first thing you will need to do is set up your experiment as normal (using the instructions provided by Google) in order to get your experiment "verified". I use "dummy" pages and the &lt;strong&gt;upload&lt;/strong&gt; verification method so I don't have to mess with any real pages on my site.
&lt;/p&gt;
&lt;p&gt;
Then you will take the section names you defined in your experiment above and "tag" the portions of your page with an ID parameter.
&lt;/p&gt;
&lt;p&gt;
For Example: If your section name is "heading", change the ID of your heading tag like this:
&lt;/p&gt;
&lt;p&gt;&amp;lt;h1 id="heading"&amp;gt;Original Headline&amp;lt;/h1&amp;gt;&lt;/p&gt;
&lt;p&gt;
Any text or content within that tag will be replaced by the variations you defined for that section of the experiment.
&lt;/p&gt;
&lt;p&gt;
The next step is to paste the scripts below into your &amp;lt;head&amp;gt;, substituting the experiment key you received (from GWO) for the control scripts, and the profile ID you received for the tracking scripts.
&lt;/p&gt;
&lt;p&gt;For Example:&lt;/p&gt;
&lt;p&gt;
&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;
var _gwoKey = "XXXXXXXXX";&lt;br /&gt;
var _gwoUacct = "UA-XXXXXX-9";&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script type="text/javascript" src="/&amp;lt;your folder&amp;gt;/gwo.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/p&gt;
&lt;h2&gt;Download Sample&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.nethab.org/web/downloads/gwo.zip"&gt;Download gwo.js with Sample page&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5850249675402791846-5924052957617171885?l=nethab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nethab.blogspot.com/feeds/5924052957617171885/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5850249675402791846&amp;postID=5924052957617171885' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5850249675402791846/posts/default/5924052957617171885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5850249675402791846/posts/default/5924052957617171885'/><link rel='alternate' type='text/html' href='http://nethab.blogspot.com/2008/07/google-website-optimizer-in-external-js.html' title='Google Website Optimizer in an external JS file'/><author><name>Nethab</name><uri>http://www.blogger.com/profile/00729890173827654664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5850249675402791846.post-5018328537659999107</id><published>2008-05-07T23:13:00.000-07:00</published><updated>2009-04-24T19:06:35.058-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='xhtml'/><category scheme='http://www.blogger.com/atom/ns#' term='Google Website Optimizer'/><title type='text'>Google Website Optimizer and XHTML</title><content type='html'>&lt;p&gt;
Google Website Optimizer is not XHTML compliant.
&lt;/p&gt;
&lt;p&gt;
If you're not familiar with the reasons for using XHTML and strict doctypes, then this is not the article for you. I'll just say that &lt;strong&gt;not&lt;/strong&gt; using them will make your life more difficult than it has to be.
&lt;/p&gt;
&lt;h2&gt;What makes GWO incompatible with XHTML 1.1&lt;/h2&gt;
&lt;p&gt;
XHTML 1.1 does not allow &amp;lt;script&amp;gt; tags inside the &amp;lt;body&amp;gt; tag. Google Website Optimizer (&lt;acronym title="Google Website Optimizer"&gt;GWO&lt;/acronym&gt;) uses &amp;lt;script&amp;gt; within the &amp;lt;body&amp;gt; to define the start of each "section" to test, and an unbalanced &amp;lt;/noscript&amp;gt; tag to mark the end of the section.
&lt;/p&gt;
&lt;p&gt;
Furthur, GWO uses document.write extensively. Not only to write the variations to the page, but also to load the control and tracking scripts. Remember that XHTML 1.1 only allows &amp;lt;script&amp;gt; tags in the &amp;lt;head&amp;gt;, which makes document.write useless since &amp;lt;head&amp;gt; is the only part of your page that &lt;strong&gt;doesn't&lt;/strong&gt; get displayed in a browser.
&lt;/p&gt;
&lt;h2&gt;Solution&lt;/h2&gt;
&lt;p&gt;
The solution is to use the built-in DOM functions (like document.createElement and document.getElementById) to load the control scripts and manipulate the contents of the page. Not only are they supported by nearly &lt;strong&gt;all&lt;/strong&gt; modern browsers, but any browser that &lt;strong&gt;doesn't&lt;/strong&gt; support them will never know the difference and will display the original (non-optimized) page. In other words it &lt;strong&gt;fails gracefully&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
The first thing you will need to do is set up your experiment as normal (using the instructions for utmx_section as provided) in order to get your experiment "verified" and ready to run. Then you will take those section names and identify the portions of your page that you want to test with that ID.
&lt;/p&gt;
&lt;p&gt;
For Example: If your section name is "heading", change the ID of your heading tag like this:
&lt;/p&gt;
&lt;p&gt;&amp;lt;h1 id="heading"&amp;gt;Original Headline&amp;lt;/h1&amp;gt;&lt;/p&gt;
&lt;p&gt;
Any text or content within that tag will be replaced by the variations you defined for that section of the experiment.
&lt;/p&gt;
&lt;p&gt;
The next step is to paste the scripts written by &lt;a href="http://groups.google.com/group/gwotechnical/msg/010a33ac65e9515c"&gt;ShoreTel&lt;/a&gt; into your &amp;lt;head&amp;gt;, substituting the experiment key you received (from GWO) for the control scripts, and the profile ID you received for the tracking scripts.
&lt;/p&gt;
&lt;p&gt;For Example:&lt;/p&gt;
&lt;p&gt;
&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;
var _gwoKey = "XXXXXXXXX";&lt;br /&gt;
var _gwoUacct = "UA-XXXXXX-9";&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script type="text/javascript" src="/&amp;lt;your folder&amp;gt;/gwo.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.nethab.org/web/downloads/gwo.zip"&gt;Download gwo.js with Sample page&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5850249675402791846-5018328537659999107?l=nethab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nethab.blogspot.com/feeds/5018328537659999107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5850249675402791846&amp;postID=5018328537659999107' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5850249675402791846/posts/default/5018328537659999107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5850249675402791846/posts/default/5018328537659999107'/><link rel='alternate' type='text/html' href='http://nethab.blogspot.com/2008/05/google-website-optimizer-and-xhtml.html' title='Google Website Optimizer and XHTML'/><author><name>Nethab</name><uri>http://www.blogger.com/profile/00729890173827654664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
