Introducing: SFAnalytics

Posted by graeme Thu, 06 May 2010 07:37:37 GMT

I wrote some god awful code recently to provide Google Analytics functionality for en e-commerce site we've been working on. For those of you are unaware of Google Analytic's e-commerce extended features, you can basically add transactions and line items to orders and record them in Analytics for conversion monitoring purposes.

As I mentioned I wasn't very happy with the way the code had turned out, so I had immediately decided that it needed refactoring. Ideally I wanted to simply add helpers to the view to generate the analytics code to insert. As we currently manage a number of ecommerce sites I decided I might as well make it re-usable. So I decided to write my first Ruby Gem.

SFAnalytics is available on rubygems.org, and the source code is of course on GitHub.

The gem provides three helpers:

  • analytics_generate('UA-1234567-8') - Generates the analytics Javascript to be included in the page. It uses the new asyncronous version provided by analytics.
  • analytics_add_item(item_hash) - Adds a line item to the Analytics request. Should be called before analytics_generate.
  • analytics_add_transaction(transaction_hash) - Adds the transaction details to the Analytics request. Again this should be called before generate.

I'd imagine that there are a number of things I can do with this gem in the future, so if you have any ideas please let me know, or even better fork and a submit merge request!

Posted in ,  | no comments | no trackbacks

New Rails Project

Posted by graeme Tue, 27 Apr 2010 22:28:14 GMT

So I said I'd try and document the processes I go through writing the new scout site, so I'll start with the initial project setup here.

Firstly we setup a new rails project.

rails scouts2

Then we initialise a git repository and add it to a Github one we setup earlier.

cd scouts2
git init
git add .
git commit -m "Initial rails app"

git remote add origin git@github.com:graemel/1hgscouts.git
git push origin master

Cool, now we get bundler up and running by editing creating a Gemfile and editing it.

bundle init

Source code for the Gemfile. Then we run the bundle install and lock the bundle.

bundle install
bundle lock

Then we need to setup capistrano.

capify .

Then add the Capfile with a gitub setup.

Update the database config as required, save it all, commit and push. That's it, we have an empty project setup ready to start work on tomorrow. You can of course deploy the empty project to the live server if you want using:

cap deploy

I'll certainly have missed something but it's an iterative project.

Tags , , ,  | no comments | no trackbacks

Scouts Website

Posted by graeme Mon, 26 Apr 2010 22:40:39 GMT

1st Hazel Grove Scout Group

I've been putting off rewriting the Scouts website for some time now, but the time has finally come to sort it out. I got something up and running when I first started looking at RoR, but a couple of months of playing and I already dislike what I've done so I'm starting from scratch.

I'm going to set it up on Github with CI(Hudson), Capistrano, RSpec, Cucumber and anything else I come across that will help me build up more experience.

I intend to document my workings here, hopefully someone will point out when I'm heading in the wrong direction and set me right.

Tags , , , , ,  | no comments | no trackbacks

New Blogging Platform

Posted by graeme Sun, 25 Apr 2010 22:56:26 GMT

 

After a bit of fishing around I've decided to switch blogging platforms from Wordpress. This is a Rails based platform called Typo. I chose to make the switch for no other reason than to have a play with another RoR app. Hopefully I'll get to writing some new plugins for it soon.

On other news, we held a Rails3 weekender at work. We created a product reviewing system that can be hooked into any website with unique products. Reviews can be administrated through the site we created and displayed on any client website.

Main problem we discovered in Rails3 lived in the dynamic_form plugin, that seems to be a little buggy in beta3. Showing deprication warnings when using error_messages_for or error_messages, saying you should use it as a plugin. Nice considereing the  error message is coming from the installed plugin.

Eiter way we had a good weekend and produced something that should be quite useful.

Posted in ,  | Tags , ,  | no comments | no trackbacks

Flaky Server

Posted by Graeme Sat, 20 Mar 2010 19:10:38 GMT

Apologies all for the flakiness of the site recently. The new server seemed to be  having a few issues! I’ve tracked it down (I think) to the google analytics Wordpress plugin I was  using. I’ve removed it for the time being, and now hopefully all manner of things shall be well.

Posted in  | Tags , ,  | no comments

New Job - New Server

Posted by Graeme Thu, 18 Mar 2010 11:26:46 GMT

Sorry I’ve not posted for a while, been really busy at work (MEN) working on the new site, however next Friday is my last day here. I’m leaving for pastures new. I’m soon to be the new development manager for Set Fire Media.

I’ll be working mainly with RoR but still a bit of Perl - as a result I’ve been playing with Rails for a couple of weeks now, and all I can conclude is that RoR might as well be Catalyst with Moose and a different templating front end. You can certainly see where the ideas have crossed over!

With regards to the new server, this is now a new server running Cherokee rather than Apache, so we’ll see how things go!

Posted in  | Tags , ,  | no comments

Is this the death of Perl?

Posted by Graeme Wed, 10 Feb 2010 17:24:44 GMT

Sensationalist title I know but I work, at least for the minute, for a newspaper company that’s just been bought out. Now I’m fairly sure that our new corporate overlords will have no requirement for two web development departments. Meaning at least one of us is for the chop and they are the larger company buying the smaller one, so centralising to their own resources seems likely to be the way they’ll go.

We have a strong development team here, with a great work ethic, who all love working with modern (enlightened) Perl. However only a cursory look at the Jobs market around our location shows us that there aren’t very many openings for experienced Perl developers. Sure there are some around London, but outside of the big bad city there seems to be very few and for most of us relocating simply isn’t an option due to family commitments.

So being that we’re all competent developers switching to a different language isn’t a massive issue to us from a technical point of view but we’ve given some of the best years of our lives to Perl and the community surrounding it. Abandoning it, even only on a professional level, seems like it’s almost more gut-wrenching than the likely ensuing redundancies.

So is this the death of Perl for me/us? Perhaps and it’s gutting.

Posted in , ,  | Tags ,  | 6 comments

New per.ly blogger

Posted by Graeme Thu, 29 Oct 2009 15:00:54 GMT

Welcome to Mark, soon to be blogging on per.ly. Mark currently works primarily in PHP, but is slowly learning to love the Perl. Hopefully he’ll get to converting his site to Catalyst soon!

On another note, thanks to everyone who showed up for the NWE.pm tech meet last night. I thougt it went well.

Posted in ,  | 2 comments

Northwest England Perl Mongers - Meet #6

Posted by Graeme Thu, 02 Jul 2009 13:28:56 GMT

Just a quick one to welcome mdk to per.ly and shout about the NWE.pm meet that we hosted at work. Anyway it was great and Mark has posted a full write-up.

I promise to post something more fulfilling soon, honest.

Posted in  | Tags  | 1 comment

Next northwestengland.pm meet

Posted by Graeme Thu, 04 Jun 2009 09:29:15 GMT

The next Northwest England Perl Mongers meet is going to be a technical meet on 1st July. Everyone attending is invited to deliver a lightning talk relating to anything you think we’ll be interested in. Lightning talks should be about 5 minutes long.

We will be meeting at MEN Media’s headquarters on Deansgate in Manchester but the powers that be would like an attendees list before hand so please drop a line on the mailing list or let us know in #northwestengland.pm on irc.perl.org.

Oh yeah, and we need to think of a talk subject for Matt Trout to talk about, as he volunteered to talk about a subject of our choosing.

Posted in  | Tags , , , , ,  | 1 comment

Pages

Categories

Archives

Uploads from ka052000 (flickr)

IMG_3837
Yummy
Lexie Lings
Lexie Lings