<?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>JONIS.NO</title>
	<atom:link href="http://jonis.no/feed" rel="self" type="application/rss+xml" />
	<link>http://jonis.no</link>
	<description>Random ramblings from a frustrated man.</description>
	<lastBuildDate>Thu, 10 Jun 2010 09:34:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Passing variables to setTimeout without curly brackets</title>
		<link>http://jonis.no/passing-variables-to-settimeout-without-curly-brackets</link>
		<comments>http://jonis.no/passing-variables-to-settimeout-without-curly-brackets#comments</comments>
		<pubDate>Tue, 08 Jun 2010 11:28:28 +0000</pubDate>
		<dc:creator>Jonis</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[passing variables]]></category>
		<category><![CDATA[setTimeout]]></category>

		<guid isPermaLink="false">http://jonis.no/?p=27</guid>
		<description><![CDATA[So, google analytics eh? Should be a piece of piss really. But.. What if you can&#8217;d properly edit the code? We&#8217;re stuck to a CMS where you have very limited access to the code. We can edit between the &#60;body&#62; and the &#60;/body&#62; tag and we can also edit the stylesheets. So, here I am, [...]]]></description>
			<content:encoded><![CDATA[<p>So, google analytics eh? Should be a piece of piss really. But.. What if you can&#8217;d properly edit the code? We&#8217;re stuck to a CMS where you have very limited access to the code. We can edit between the <span style="color: #0000ff;">&lt;body&gt;</span> and the <span style="color: #0000ff;">&lt;/body&gt;</span> tag and we can also edit the stylesheets. So, here I am, trying to track our checkout process, seeing as every single checkout page comes up as index.html due to what is obviously VERY VERY clever programming.</p>
<p>So I came up with a small snippet to send a trackEvent to Google analytics(this is my first time really ever touching javascript). Code follows here.</p>
<p><span style="color: #0000ff;">&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
function functionName(eventName) {<br />
pageTracker._trackEvent(&#8216;Checkout&#8217;,eventName);<br />
}<br />
&lt;/script&gt;</span></p>
<p><span style="color: #0000ff;"><span style="color: #000000;">Now! This would be all fine and dandy, the CMS offers a page text editor which in theory will allow you to stick a bit of code in there; It does have a view source button, so you can stick bits of code in there. So you know, unless the CMS strips out curly brackets we&#8217;ll be OK. What? Did I hear that right? Yes, the CMS does in fact strip out curly brackets. What a retarded load of bollocks.</span></span></p>
<p>So, Seeing as it strips out curly brackets(but NOTHING else) from the default page text I had to resort to finding another route. The solution I arrived at in the end is not elegant, but it works and it does what I need it to do. The code above gets put at the end of the footer and the function gets called with a two second timeout the only place where I was allowed to insert code.</p>
<p><span style="color: #0000ff;">&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
setTimeout(&#8220;functionName(&#8216;eventName&#8217;)&#8221;, 2000);<br />
&lt;/script&gt;</span><br />
I have however in hindsight realized that for my purposes creating a faux pageview and then set up a goal with a funnel is better for what I need to do. So that will be my next task.</p>
]]></content:encoded>
			<wfw:commentRss>http://jonis.no/passing-variables-to-settimeout-without-curly-brackets/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
