Blog Entry

Nov 28, 2009

Sneak Past Analytics Code While Developing

Let’s face it.  All too often, I end up working on living code; I work really hard and finally deploy a site, but it’s never truly done.  And when I’m working in a live server environment (and even when I’m not), I tend to make tons of incremental edits with lots of saves in between.  Why?  Well, because no matter how careful I am, it’s inevitable that these big sausage fingers will end up hitting the "=" key one too many times and make whole sections of a website disappear.

But with the constant slew of saving and tweaking comes the annoying fact that each page refresh pings your client’s analytic tracking code.  No, it’s not that big of a deal. But if you’re like me, it can be annoying — especially since it’s not uncommon to have loaded a hundred pages or more during the period of development.  It skews data and is just plain stinky.

So how do we stop this?  It’s easy, and I take no credit for the fix since a vegetable could figure it out.  Simply use an IF statement with ExpressionEngine’s conditional {logged_out} variable, like so:


{if logged_out}
<!—Insert your tracking code here.—>
{/if}

Note: If your ExpressionEngine site allows users to log in and interact as a user, you won’t want to use this code. Instead, you would want to bypass the tracking code only when logged in as a Super Admin.  The code for this is very similar to above, but uses a different conditional variable:


{if group_id != ‘1’}
<!—Insert your tracking code here.—>
{/if}

Keep in mind that this code isn’t just handy for analytic tracking code — it will show or hide anything your little heart desires.  Be creative.  Hope this helps!


Syndicate

 

Comments

I’ve been thinking about 000-025  redoing Bitmanic for nearly a year now. But up until a couple weeks ago, I hadn’t done a damn thing about it.  I had all sorts of worthwhile ideas and concepts, and had even wireframed and sketched everything out.  db2 certification dumps  “It will be perfect!,” I thought.  But when the hell was it going to get done?!Jump to two weeks ago.  I was sick of waiting.  I couldn’t keep pushing it off, so I pulled the plug and forced myself to work on a new iteration.  Some would call this sloppy or unprofessional, and maybe it is.  But it worked.  Two days later, I had ExpressionEngine installed, five weblogs configured, and a styled homepage.  Since the previous version of Bitmanic was mcse exams  a static one-page site, I had already achieved more in two days than I had in a year.

Page 1 of 1 pages

Leave A Comment