<?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>BRADINO &#187; Misc</title>
	<atom:link href="http://www.bradino.com/category/misc/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bradino.com</link>
	<description>Just another Wordpress blog</description>
	<lastBuildDate>Wed, 09 Nov 2011 20:09:20 +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>Zipcodes in CSV Generation</title>
		<link>http://www.bradino.com/php/zipcodes-in-csv-generation/</link>
		<comments>http://www.bradino.com/php/zipcodes-in-csv-generation/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 22:30:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.bradino.com/?p=4839</guid>
		<description><![CDATA[When exporting to CSV format, then opening in a spreadsheet program like Excel zipcodes that start with a zero or zeroes have the preceding zeros stripped off. Obviously it is because the spreadsheet sees that column as integers and preceding zeros in integers are useless. A quick and dirty trick to force Excel (hopefully you [...]]]></description>
			<content:encoded><![CDATA[<p>When exporting to CSV format, then opening in a spreadsheet program like Excel zipcodes that start with a zero or zeroes have the preceding zeros stripped off. Obviously it is because the spreadsheet sees that column as integers and preceding zeros in integers are useless.</p>
<p>A quick and dirty trick to force Excel (hopefully you are using OpenOffice) to display the full zipcode, we wrap it in double quotes and put an equal sign in front of it, to force it to be a string like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$zipcode</span> <span style="color: #339933;">=</span> <span style="color: #208080;">00123</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$zipcode</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;'</span> <span style="color: #339933;">;</span></pre></div></div>

<p>So if you are doing the straight query to CSV export, using the <b>fputcsv</b> function it would look something like this. Basically just overwrite the value in the row and then continue along.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'zipcode'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'zipcode'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #990000;">fputcsv</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$output</span><span style="color: #339933;">,</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/php/zipcodes-in-csv-generation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getty Images Suing Website Owners</title>
		<link>http://www.bradino.com/news/getty-images-suing-website-owners/</link>
		<comments>http://www.bradino.com/news/getty-images-suing-website-owners/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 17:00:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.bradino.com/?p=4812</guid>
		<description><![CDATA[If I didn&#8217;t see the correspondence myself, I probably would not have believed it. Yes, Getty Images is suing website owners for using their images supposedly without paying for the rights. They have a software that crawls webpages, using an algorithm it can detect Getty images even if they have been cropped, or otherwise slightly [...]]]></description>
			<content:encoded><![CDATA[<p>If I didn&#8217;t see the correspondence myself, I probably would not have believed it. Yes, Getty Images is suing website owners for using their images supposedly without paying for the rights. They have a software that crawls webpages, using an algorithm it can detect Getty images even if they have been cropped, or otherwise slightly altered. The images need not have the Getty watermark to be detected. That&#8217;s fine so they find people using their images and then send them a cease and desist letter, right? No they are demanding upwards of 20 times the original image price, threatening legal action. For this reason I will never use Getty Images and <del datetime="2011-11-09T20:04:12+00:00">will continue to use <a href="http://www.istockphoto.com">iStockPhoto</a></del>. Turns out that <a href="http://www.zdnet.com/blog/micro-markets/istockphoto-ceo-on-getty-images-acquisition-exclusive-interview-on-one-year-anniversary/1000">Getty acquired iStock</a> photo&#8230; Anyone have other suggestions on who to use for low-cost stock photos?</p>
<p>Here is an interesting website devoted to the topic: <a href="http://extortionletterinfo.com">Getty Extortion Letter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/news/getty-images-suing-website-owners/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>2147483647</title>
		<link>http://www.bradino.com/php/2147483647/</link>
		<comments>http://www.bradino.com/php/2147483647/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 16:40:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.bradino.com/?p=4801</guid>
		<description><![CDATA[I had someone ask me the other day why they were getting 2147483647 as the value for some operation. Any time you see this number, it should be a red flag that you are hitting the ceiling of the values that can be the 4 byte integer. So here in this classic newbie mistake, grooming [...]]]></description>
			<content:encoded><![CDATA[<p>I had someone ask me the other day why they were getting <strong>2147483647</strong> as the value for some operation. Any time you see this number, it should be a red flag that you are hitting the ceiling of the values that can be the 4 byte integer.</p>
<p>So here in this classic newbie mistake, grooming a phone number by casting it to an integer.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$phone</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'6195551234'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$phone</span><span style="color: #339933;">;</span></pre></div></div>

<p>Will result in <strong>2147483647</strong>. </p>
<p>You also see <strong>2147483647</strong> sometimes in database records where the field type is INT and the value you are inserting is greater than 2147483647. Hope this helps!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/php/2147483647/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Google Analytics API</title>
		<link>http://www.bradino.com/php/google-analytics-api/</link>
		<comments>http://www.bradino.com/php/google-analytics-api/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 20:43:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.bradino.com/?p=4794</guid>
		<description><![CDATA[Unfortunately Google Analytics does not have an API yet&#8230; However I will show you a quick and dirty way to get the data you need. The idea is basically to setup an automated report from within Google Analytics, which will email a CSV file attachment, that you can download and parse with a script. For [...]]]></description>
			<content:encoded><![CDATA[<p>Unfortunately Google Analytics does not have an API yet&#8230; However I will show you a quick and dirty way to get the data you need. The idea is basically to setup an automated report from within Google Analytics, which will email a CSV file attachment, that you can download and parse with a script. For this example I will use the Zend Mail class because I love Zend Mail and it is free.</p>
<p>So the first step is to schedule the report. For this simple example we will use the default Visitors Report. So login to your Google Analytics account, click Visitors on the main left nav, then click the Email icon up at the top of the report, see screenshot below:</p>
<div id="attachment_4795" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.bradino.com/wp-content/uploads/2008/12/ga-screenshot.jpg"><img src="http://www.bradino.com/wp-content/uploads/2008/12/ga-screenshot-300x132.jpg" alt="GA Screenshot" title="ga-screenshot" width="300" height="132" class="size-medium wp-image-4795" /></a><p class="wp-caption-text">Google Analytics  Screenshot</p></div>
<p>Now let&#8217;s get to the code. First step is to connect to your POP mail server and get the new messages. Don&#8217;t forget to download the latest version of Zend at http://framework.zend.com.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">include</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Zend/Mail/Storage/Pop3.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$params</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'host'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;mail.domain.com&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'user'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;info@domain.com&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'password'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;secret&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$mail</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Mail_Storage_Pop3<span style="color: #009900;">&#40;</span><span style="color: #000088;">$params</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$num</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">countMessages</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>In a production environment, you would want some logic to verify that the number of messages is greater than 0, loop through the messages, etc but for this tutorial I have omitted these items for brevity. So next we need to download the first message and get its parts.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$parts</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$message</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">countParts</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Next we spin through the parts, looking for the attachment.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$b</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$b</span><span style="color: #339933;">&lt;=</span><span style="color: #000088;">$parts</span><span style="color: #339933;">;</span> <span style="color: #000088;">$b</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000088;">$part</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$message</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPart</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$b</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$headers</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$part</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getHeaders</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$headers</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Content-Disposition'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$headers</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'content-disposition'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></pre></div></div>

<p>Then we parse the CSV file to an array for simple looping:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$csv</span> <span style="color: #339933;">=</span> <span style="color: #990000;">base64_decode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$part</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getContent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$lines</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$csv</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$lines</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$line</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span><span style="color: #000088;">$line</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>					
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The previous code checks the email account, downloads the CSV attachment and parses it to an array. That is all going to stay the same but the matching below will change depending on your needs. For this simplistic example, I am going to get the number of visits from yesterday.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$yesterday</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'F j'</span><span style="color: #339933;">,</span><span style="color: #990000;">mktime</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'m'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'d'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$yesterday</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000088;">$visits</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;VISITS: <span style="color: #006699; font-weight: bold;">{$visits}</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>So that&#8217;s basically it. Of course in production you would probably want to write the Google Analytics data to a database or whatever, but you get the point! Hopefully Google Analytics will get an API soon, but until then, this works like a champ!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/php/google-analytics-api/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>PPC Conversion Tracking using Javascript</title>
		<link>http://www.bradino.com/javascript/ppc-conversion-tracking/</link>
		<comments>http://www.bradino.com/javascript/ppc-conversion-tracking/#comments</comments>
		<pubDate>Fri, 14 Nov 2008 17:37:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://www.bradino.com/?p=4780</guid>
		<description><![CDATA[PPC Conversion tracking (Google/Yahoo/MSN) is straightforward for simple HTML websites. You place the conversion pixel on the thank you page. But when you have conversions in Flash sites or when the page is not reloaded after a conversion in the case of an ajaxed site, firing the conversion pixel is not as simple. I created [...]]]></description>
			<content:encoded><![CDATA[<p>PPC Conversion tracking (Google/Yahoo/MSN) is straightforward for simple HTML websites. You place the conversion pixel on the thank you page. But when you have conversions in Flash sites or when the page is not reloaded after a conversion in the case of an ajaxed site, firing the conversion pixel is not as simple.</p>
<p>I created a simple javascript function that will include the tracking pixel as an iframe in the current page. All you have to do is change the url to the tracking pixel and then call the conversion function from your page or flash file.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> conversion<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> iframe <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'iframe'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	iframe.<span style="color: #660066;">style</span>.<span style="color: #660066;">width</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'0px'</span><span style="color: #339933;">;</span>
&nbsp;
	iframe.<span style="color: #660066;">style</span>.<span style="color: #660066;">height</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'0px'</span><span style="color: #339933;">;</span> 
&nbsp;
	document.<span style="color: #660066;">body</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>iframe<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
	iframe.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'http://wwww.domain.com/pixel.html'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/javascript/ppc-conversion-tracking/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Google Analytics Goals</title>
		<link>http://www.bradino.com/javascript/google-analytics-goals/</link>
		<comments>http://www.bradino.com/javascript/google-analytics-goals/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 17:07:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://www.bradino.com/?p=4760</guid>
		<description><![CDATA[Goals in Google Analytics are one of my favorite features of this amazing free web analytics software. Goals allow you to track actions and then analyze how different traffic segments convert to these actions. Common actions would be completing a lead form, downloading a brochure, clicking the link for directions, etc. Goals are usually implemented [...]]]></description>
			<content:encoded><![CDATA[<p>Goals in Google Analytics are one of my favorite features of this amazing <a href="https://www.google.com/analytics/" target="_blank">free web analytics software</a>. Goals allow you to track actions and then analyze how different traffic segments convert to these actions. Common actions would be completing a lead form, downloading a brochure, clicking the link for directions, etc. Goals are usually implemented by entering the page url where the conversion occurs (Ex: thankyou.html). So how can we implement the goal tracking on sites where the form is the same url as the thank you page, or where the click leaves the site or goes to a non-html page? These can all be done easily by selecting Exact Match as the Match Type and then inserting a fictitious url like /goal/rfi/ for the Goal URL.</p>
<p>Let&#8217;s look at the first scenario where someone completes a lead form. Often forms submit to themselves, so you can&#8217;t have the goal conversion on the thank you page because it is the same url. These type of dynamic pages can easily fire off goals we just have to do it a different way. When the form is completed successfully, we just make a javascript call in the onload. Notice the /goal/rfi/ from the Goal URL setup.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>body <span style="color: #000066;">onload</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;pageTracker._trackPageview('/goal/rfi/');&quot;</span><span style="color: #339933;">&gt;</span></pre></div></div>

<p>So what if you want to track an exit click or a non-html file download (Ex: PDF Brochure). The idea is the same, you simply call the function from the onclick event handler.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;PrettyBrochure.pdf&quot;</span> onclick<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;pageTracker._trackPageview('/goal/rfi/');&quot;</span><span style="color: #339933;">&gt;</span></pre></div></div>

<p>Be sure that you have the New Tracking Code (ga.js) not the Legacy Tracking Code (urchin.js)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/javascript/google-analytics-goals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SYLK: file format is not valid</title>
		<link>http://www.bradino.com/misc/sylk-file-format-is-not-valid/</link>
		<comments>http://www.bradino.com/misc/sylk-file-format-is-not-valid/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 16:23:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://www.bradino.com/?p=4726</guid>
		<description><![CDATA[I had a co-worker complain that she was unable to open a CSV file I was generating automatically using PHP. The error she was receiving was &#8220;SYLK: file format is not valid&#8221;. So I went to Google and searched for it and it turns out that Excel is such a POS that if the first [...]]]></description>
			<content:encoded><![CDATA[<p>I had a co-worker complain that she was unable to open a CSV file I was generating automatically using PHP. The error she was receiving was &#8220;SYLK: file format is not valid&#8221;. So I went to Google and searched for it and it turns out that Excel is such a POS that if the first two characters of the CSV file are ID (capitalized) then you will get this error. So I prepended an X to the file and that fixed it. I am fortunate enough to not use Microsoft Office for the past few years. I HIGHLY recommend <a href="http://www.openoffice.org">OpenOffice</a> and the best part is that it is FREE. <a href="http://www.openoffice.org">OpenOffice </a>can read and write the native <a href="http://www.openoffice.org">Microsoft Office</a> formats so you will not have problems shard documents with co-workers. If you are in IT you can save your company a ton in licensing by switching to <a href="http://www.openoffice.org">OpenOffice</a> and never get the ridiculous SYLK: file format is not valid error.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/misc/sylk-file-format-is-not-valid/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Manually Run Webalizer via SSH &#8211; webstatmng</title>
		<link>http://www.bradino.com/misc/manually-run-webalizer/</link>
		<comments>http://www.bradino.com/misc/manually-run-webalizer/#comments</comments>
		<pubDate>Fri, 22 Feb 2008 17:23:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://www.bradino.com/misc/manually-run-webalizer/</guid>
		<description><![CDATA[In Plesk say you have a domain bradino.com and you have not enabled webalizer. Later you need to enable it but no statistics show because it only parses the log files once per day but you want the stats right now. Here is the SSH command you can run to manually run webalizer. /usr/local/psa/admin/bin/webstatmng &#8211;calculate-rotated-statistics [...]]]></description>
			<content:encoded><![CDATA[<p>In Plesk say you have a domain bradino.com and you have not enabled webalizer. Later you need to enable it but no statistics show because it only parses the log files once per day but you want the stats right now. Here is the SSH command you can run to manually run webalizer.</p>
<p><strong>/usr/local/psa/admin/bin/webstatmng &#8211;calculate-rotated-statistics &#8211;stat-prog=webalizer &#8211;domain-name=bradino.com</strong></p>
<p>I am sure that this is different for every system, but this worked for me running Plesk 8.1 on Linux.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/misc/manually-run-webalizer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatically Login Bookmark</title>
		<link>http://www.bradino.com/misc/automatically-login-bookmark/</link>
		<comments>http://www.bradino.com/misc/automatically-login-bookmark/#comments</comments>
		<pubDate>Wed, 05 Dec 2007 19:13:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://www.bradino.com/misc/automatically-login-bookmark/</guid>
		<description><![CDATA[Here is a quick little trick to automate logging into online applications. Simply create an HTML file and put it on your desktop (or wherever you like), and then by opening this file, you can login to most applications automatically. All you have to change in the file is the url to post the form [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a quick little trick to automate logging into online applications. Simply create an HTML file and put it on your desktop (or wherever you like), and then by opening this file, you can login to most applications automatically. All you have to change in the file is the url to post the form to and the field names of the values to post. In this simple demo the form will post the variables &#8220;username&#8221; and &#8220;password&#8221; to https://www.domain.com/login.php.</p>
<p>[html]<br />
<html><br />
<head></p>
<p></head><br />
<body onload="document.loginform.submit();"><br />
Logging into Application&#8230;</p>
<form name="loginform" id="loginform" method="post"<br />
action="https://www.domain.com/login.php"><br />
<input type="hidden" name="username" value="admin"/>
<input type="hidden" name="password" value="secret"/>
</form>
<p></body><br />
</html><br />
[/html]</p>
<p><strong>Warning:</strong> This is not secure, as the password is stored in plain-text and is accessible to anyone with access to your computer. Please use with extreme caution.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/misc/automatically-login-bookmark/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Array of US States</title>
		<link>http://www.bradino.com/misc/php-array-of-us-states/</link>
		<comments>http://www.bradino.com/misc/php-array-of-us-states/#comments</comments>
		<pubDate>Mon, 03 Dec 2007 18:46:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://www.bradino.com/misc/php-array-of-us-states/</guid>
		<description><![CDATA[This simple array of states can be used to poulate a dropdown menu on a form, or in some kind of lookup from state code to name, or any loop action you desire. $states = array&#40;'AL'=&#62;&#34;Alabama&#34;, 'AK'=&#62;&#34;Alaska&#34;, 'AZ'=&#62;&#34;Arizona&#34;, 'AR'=&#62;&#34;Arkansas&#34;, 'CA'=&#62;&#34;California&#34;, 'CO'=&#62;&#34;Colorado&#34;, 'CT'=&#62;&#34;Connecticut&#34;, 'DE'=&#62;&#34;Delaware&#34;, 'DC'=&#62;&#34;District Of Columbia&#34;, 'FL'=&#62;&#34;Florida&#34;, 'GA'=&#62;&#34;Georgia&#34;, 'HI'=&#62;&#34;Hawaii&#34;, 'ID'=&#62;&#34;Idaho&#34;, 'IL'=&#62;&#34;Illinois&#34;, 'IN'=&#62;&#34;Indiana&#34;, 'IA'=&#62;&#34;Iowa&#34;, 'KS'=&#62;&#34;Kansas&#34;, 'KY'=&#62;&#34;Kentucky&#34;, [...]]]></description>
			<content:encoded><![CDATA[<p>This simple array of states can be used to poulate a dropdown menu on a form, or in some kind of lookup from state code to name, or any loop action you desire.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$states</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'AL'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Alabama&quot;</span><span style="color: #339933;">,</span>  
  			<span style="color: #0000ff;">'AK'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Alaska&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'AZ'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Arizona&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'AR'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Arkansas&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'CA'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;California&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'CO'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Colorado&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'CT'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Connecticut&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'DE'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Delaware&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'DC'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;District Of Columbia&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'FL'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Florida&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'GA'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Georgia&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'HI'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Hawaii&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'ID'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Idaho&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'IL'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Illinois&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'IN'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Indiana&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'IA'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Iowa&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'KS'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Kansas&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'KY'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Kentucky&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'LA'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Louisiana&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'ME'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Maine&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'MD'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Maryland&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'MA'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Massachusetts&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'MI'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Michigan&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'MN'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Minnesota&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'MS'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Mississippi&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'MO'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Missouri&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'MT'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Montana&quot;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'NE'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Nebraska&quot;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'NV'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Nevada&quot;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'NH'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;New Hampshire&quot;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'NJ'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;New Jersey&quot;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'NM'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;New Mexico&quot;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'NY'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;New York&quot;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'NC'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;North Carolina&quot;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'ND'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;North Dakota&quot;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'OH'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Ohio&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'OK'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Oklahoma&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'OR'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Oregon&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'PA'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Pennsylvania&quot;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'PR'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Puerto Rico&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'RI'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Rhode Island&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'SC'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;South Carolina&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'SD'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;South Dakota&quot;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'TN'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Tennessee&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'TX'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Texas&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'UT'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Utah&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'VT'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Vermont&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'VA'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Virginia&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'WA'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Washington&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'WV'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;West Virginia&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'WI'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Wisconsin&quot;</span><span style="color: #339933;">,</span>  
			<span style="color: #0000ff;">'WY'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Wyoming&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>So a simple example to populate a dropdown form menu of states you could simply spin through the array like so:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$states</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$code</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$state</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
     <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;option value=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">{$code}</span><span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #006699; font-weight: bold;">{$state}</span>&lt;/option&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/misc/php-array-of-us-states/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

