<?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>Pickled Shark&#187; Web Development</title>
	<atom:link href="http://www.pickledshark.com/category/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pickledshark.com</link>
	<description>Web Development, SEO and Internet Entrepreneurship</description>
	<lastBuildDate>Mon, 12 Jul 2010 10:59:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Importing Large MySQL Database SQL Dump Files</title>
		<link>http://www.pickledshark.com/importing-large-mysql-database-sql-dump-files/</link>
		<comments>http://www.pickledshark.com/importing-large-mysql-database-sql-dump-files/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 14:58:47 +0000</pubDate>
		<dc:creator>Carey</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.pickledshark.com/?p=80</guid>
		<description><![CDATA[Exporting and importing large MySQL databases can sometimes be a problem due to timeouts from web interfaces, hosting restrictions and inconsistent internet connections. Here we look at a script that will help to reliably export and import MySQL databases.]]></description>
			<content:encoded><![CDATA[<p>If you have ever tried to transfer a large MySQL database you will no doubt have come across some issues. With <a href="http://www.phpmyadmin.net/">phpMyAdmin</a> being the most popular interface most webhosts provide it (and only this) as the way for you to interact with your databases.</p>
<p>Unfortunately, import an SQL dump containing your data and table structure often causes timeouts via phpMyAdmin when the database is particularly large meaning you have to import data a table at a time (or even part of a table at a time) which takes a long time and is prone to error.</p>
<p>In the past I have done many things from writing custom import scripts to importing the database bit by bit. I have also used desktop tools (such as the excellent <a href="http://www.sequelpro.com/">Sequel Pro</a> for Mac OS X) although many web hosts disallow external access.</p>
<p>Fortunately I came across an excellent, flexible import script called <a href="http://www.ozerov.de/bigdump.php">BigDump</a> which takes your SQL file, splits it and automatically imports it (via javascript reloads). Script and full instructions are available at <a href="http://www.ozerov.de/bigdump.php">http://www.ozerov.de/bigdump.php</a></p>
<p><span style="color: #ff0000;">Do you have any tips, tricks, advice or questions about importing/exporting MySQL databases? Get involved and comment below!</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pickledshark.com/importing-large-mysql-database-sql-dump-files/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Accessing Websites Without a Subdomain</title>
		<link>http://www.pickledshark.com/accessing-websites-subdomain/</link>
		<comments>http://www.pickledshark.com/accessing-websites-subdomain/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 14:39:45 +0000</pubDate>
		<dc:creator>Carey</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.pickledshark.com/?p=74</guid>
		<description><![CDATA[Many websites simply time out if you try to access them without the www prefix on the URL. Read on and make sure you don't lose visitors by making this mistake.]]></description>
			<content:encoded><![CDATA[<div style="float: right; display: inline; text-align: center;"><img class="alignright size-full" src="http://farm2.static.flickr.com/1041/990866224_b7be4405df_m.jpg" alt="World Wide Web" /><br />
<small><a title="Attribution-ShareAlike License" rel="nofollow" href="http://creativecommons.org/licenses/by-sa/2.0/" target="_blank"><img src="http://www.pickledshark.com/wp-content/plugins/photo-dropper/images/cc.png" border="0" alt="Creative Commons License" width="16" height="16" align="absmiddle" /></a> photo credit: <a title="Bull3t" rel="nofollow" href="http://www.flickr.com/photos/56315780@N00/990866224/" target="_blank">Bull3t</a></small></div>
<p>The www prefix is essentially a subdomain of your website and although many people will type it in, some may just try to enter the domain itself.</p>
<p>Many websites, including high profile ones, can&#8217;t be accessed without the www subdomain. For example, barclaycardunwind.co.uk is inaccessible while <a href="http://www.barclaycardunwind.co.uk">www.barclaycardunwind.co.uk</a> is.</p>
<p>This is essentially a DNS or server configuration problem, so a single solution is not available for everyone but it should be straightforward. Contact your web host if you are not sure or modify your server configuration if you know what you need to do.</p>
<p>Once you can access your site without the www, <a href="http://www.pickledshark.com/htaccess-redirect-nonwww-www/">make sure that the traffic is forwarded to one or the other</a> to prevent potential duplicate content issues with google.</p>
<p>Make sure you do it, or risk frustrating and/or losing a lot of your visitors!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pickledshark.com/accessing-websites-subdomain/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>.htaccess Redirect from Non-WWW to WWW</title>
		<link>http://www.pickledshark.com/htaccess-redirect-nonwww-www/</link>
		<comments>http://www.pickledshark.com/htaccess-redirect-nonwww-www/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 15:50:24 +0000</pubDate>
		<dc:creator>Carey</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.pickledshark.com/?p=66</guid>
		<description><![CDATA[Make sure you cannot access your website from both http://www.website.com and http://website.com - doing so could trigger duplicate content issues and damage your Google rankings. Here is a method to prevent this using .htaccess]]></description>
			<content:encoded><![CDATA[<p>If you can access your website both with www and without then you are effectively serving duplicate content. I am sure Google are sensible enough to filter this out but some people feel like it could be an issue so my recommendation is better safe than sorry.</p>
<p>Place the following code in your .htaccess file to automatically force www. on the front of your URLs:</p>
<p><code><br />
RewriteEngine On<br />
RewriteCond %{HTTP_HOST} !^www\.<br />
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]<br />
</code></p>
<p><em>You might not need the &#8220;RewriteEngine On&#8221; &#8211; check if it already exists in your .htaccess</em></p>
<p>There are a lot of other solutions using .htaccess but this particular solution does not need editing (i.e. your URL is not in the code) so you can use it in a distributed project or many websites without having to customise it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pickledshark.com/htaccess-redirect-nonwww-www/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using the Google Analytics Cookies</title>
		<link>http://www.pickledshark.com/google-analytics-cookies/</link>
		<comments>http://www.pickledshark.com/google-analytics-cookies/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 09:59:54 +0000</pubDate>
		<dc:creator>Carey</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Cookies]]></category>
		<category><![CDATA[Google Analytics]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.pickledshark.com/?p=14</guid>
		<description><![CDATA[What is contained in the Google Analytics Cookies and how could you use them? In this article we take an in depth look at the data, how to extract it, how to record it and possible uses for your website.]]></description>
			<content:encoded><![CDATA[<div style="float: right; display: inline; text-align: center;"><img src="http://farm2.static.flickr.com/1280/1117398599_b86f47800a_m.jpg" alt="14th August 2007 / Day 226" class="alignright size-full" /><br /><small><a href="http://creativecommons.org/licenses/by-nc-sa/2.0/" title="Attribution-NonCommercial-ShareAlike License" target="_blank" rel="nofollow"><img src="http://www.pickledshark.com/wp-content/plugins/photo-dropper/images/cc.png" alt="Creative Commons License" border="0" width="16" height="16" align="absmiddle" /></a> photo credit: <a href="http://www.flickr.com/photos/47183913@N00/1117398599/" title="Mrs Magic" target="_blank" rel="nofollow">Mrs Magic</a></small></div>
<p>In this article I will be looking at the raw data that Google Analytics records, picking apart the Google cookies and showing some examples of how to extract and use that data.</p>
<p>I personally find Google Analytics a great free tool and use it as default on most of my sites. There is of course the old privacy accusations that follow Google around (I have some insight and warnings for a future post) but generally I don&#8217;t let this keep me up at night.</p>
<p>On a project I found myself wanting access to certain Google Analytics data from within my own custom admin dashboard. I had looked at recording my own information but consider it bad practice to duplicate in this way. Another option I considered was exporting )data using the <a href="http://code.google.com/apis/analytics/">Google Analytics API</a> but unfortunately the quota limits of 10000 requests per 24 hours (<a href="http://code.google.com/apis/analytics/docs/gdata/gdataDeveloperGuide.html">more API limits detailed here</a>) meant I couldn&#8217;t have the real time statistics I wanted.</p>
<p>Eventually I decided to take a look at using the Google Analytics cookies themselves and recording the data locally. This also gave the benefit of being able to link website actions (in this case adding a product to cart, removing it etc.) to a specific Google Analytics user and therefore giving me a bigger picture of my user habits.</p>
<p>So as an overview, this is how I did it:<br />
1) The page loads with the Google Analytics javascript, creating the cookie and sending data to Google<br />
2) After the Google Analytics javascript, an Ajax request is fired passing along any local website actions (e.g. adding to cart)<br />
3) The code run by the Ajax request deciphers the Google Analytics cookies and records all the information locally</p>
<p>There is a good reason for using an Ajax request. With PHP (or indeed any server side language) the Cookie details are accurate to the point of the initial page request. If this is a new visitor the Google Analytics Cookies will not yet exist as the Javascript has not been executed, therefore the script must fire after the Google Analytics Javascript has run.</p>
<p>Using Ajax also ensures that the details of the final page request are recorded.</p>
<h2>Picking Apart the Google Analytics Cookies</h2>
<p>The part that required the most figuring out was what the data within the Google Analytics cookies meant. There are actually three Cookies placed by Google Analytics:</p>
<p><strong>__utma</strong> &#8211; A &#8220;long term&#8221; cookie containing the main details of the user<br />
<strong>__utmb</strong> &#8211; A &#8220;current session&#8221; cookie containing details about the current website visit<br />
<strong>__utmc</strong> &#8211; A &#8220;no expiration&#8221; cookie which is used only to determine if the user has closed their browser (therefore initiating a new session when they next visit)<br />
<strong>__utmz</strong> &#8211; A &#8220;current session&#8221; cookie containing referral details about the current visit</p>
<p>Each cookie contains data seperated by a period (.), with the __utmz cookie further seperating details with a pipe (|). The cookies break down as follows (the segments represent the data in the order as they appear in the string):</p>
<p><strong>__utma</strong><br />
Segment 1: Unique number identifying the user. Useful for keeping track of return visits and as a primary key for storing locally.<br />
Segment 2: Unix timestamp of this visitors first ever visit to the website.<br />
Segment 3: Unix timestamp of this visitors previous visit to the website.<br />
Segment 4: Unix timestamp of this visitors current visit to the website (the start of the current session).<br />
Segment 5: Total number of sessions.</p>
<p><strong>__utmb</strong><br />
Segment 1: Pages viewed in the current session<br />
Segment 2: Unknown (My notes say Responses&#8230;)</p>
<p><strong>__utmz</strong><br />
Segment 2: Referral Count<br />
Segment 3: Source Count<br />
Segment 4: This segment contains all the information about where the visitor came from. It is seperated by pipes and then the label/value is seperated again by an equals sign. An example for this segment: &#8220;utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=keywords&#8221;. The information is as follows:<br />
utmcsr: Source<br />
utmcmd: Medium (e.g. for google it can be organic or adwords)<br />
utmctr: The keywords used<br />
utmcct: Campaign content. Adwords information.<br />
utmccn: Campaign name. Adwords information.<br />
utmgclid: Click ID from Adwords.</p>
<p>Some other cookies you may also see are __utmv and __utmx which are related to customer user segments and the Website Optimizer respectively.</p>
<p><em><strong>If you have any questions on this leave a comment and I will update the article so everyone can benefit. </strong></em>You may also be able to glean some information from (although they don&#8217;t spec the cookies in detail):</p>
<p><a href="http://code.google.com/apis/analytics/docs/concepts/gaConceptsCookies.html">http://code.google.com/apis/analytics/docs/concepts/gaConceptsCookies.html<br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pickledshark.com/google-analytics-cookies/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
