SpreeConf 2014
Feb 26 - 27 New York, NY
Learn More

Archive for June, 2013

Tracking E-commerce With Google Analytics

Google Analytics comes with support for tracking e-commerce right out of the box. All you need to do is some basic configuration and your website will be ready to start gathering data on transactions and items sold. Spree even takes care of adding all the necessary JavaScript and makes the setup as simple as pasting a tracking ID into the Admin section of your store.

  • Google analytics may not work if you are running your app on localhost. See the section titled Testing on localhost here . To get around this try pow if you are using a Mac. Otherwise, it should work fine in production.

Set Up

The first thing you will need to do is set up a Google Analytics account if you do not already have one. Once you have an account you will need to enable e-commerce tracking for your website. This can be accomplished by logging into Google Analytics and following these steps.

1. Click Admin at the top of any screen in Analytics.
2. Use the menu in the Profile column to select the profile you want.
3. Click Profile Settings.
4. Under the Ecommerce Settings section, select Yes, an Ecommerce Site/App.
5. Click Apply.

Now that e-commerce tracking is enabled, it is time to configure your Spree store. Lets start by grabbing the tracking ID inside of Google Analytics. This can be found by clicking on Admin in the top right, and then the Tracking Info tab. The ID will be in the form UA-XXXXXXXX-X. Now go into the Admin section of your Spree store and click on the Configuration tab followed by the Analytics Trackers link at the bottom of the right side navigation. Click on the link to create a new tracker and enter your Google Analytics ID.

  • In older versions of Spree the Configuration screen will look different, however the functionality is all still supported.


Your store is now ready to start tracking e-commerce through Google Analytics. To test that everything is working, walk through the ordering process. Add an item to the cart, click Checkout, and make sure you get all the way to the order confirmation page. Once that is complete, go to Google Analytics and click on the reporting tab. On the left side navigation click on conversions, e-commerce, and then overview. You will see a page similar to the one below outlining some data gathered from your store.

  • Make sure the date filter is set to the current day on your report! The data from your store may not show up in real time. Sometimes you will have to wait a few minutes before you see a transaction.


If you wait for a couple of minutes and still do not see a transaction inside Google Analytics, check to see if these two conditions were met.

  • On the order confirmation page in your Spree store, make sure the Google Analytics JavaScript is present. It should be located at the bottom of the page source and begin with

var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);

If the Javascript is not present, be sure you are still including the spree/shared/google_analytics partial in your application layout.

  • Use the developer tools in your browser to inspect the Spree order confirmation page. On the network tab make sure there is a _utm.gif resource at the bottom of the page. If you do not see that than your data is not being sent to Analytics and is most likely a problem related to using localhost as mentioned previously.

That’s all there is to it. Please leave a comment with any questions or problems. Enjoy!

Developer Spotlight - Dana Jones

We’re kicking off our “Developer Spotlight” series with a feature on Spree open source contributor, Dana Jones. Dana began working with Spree a few months ago by contributing to the Spree Guides. Since then she’s made 45 commits to the Spree Guides and has become a well known member of the Spree community. I had the pleasure of meeting Dana in person at SpreeConf in May. Here’s a picture of the two of us on SpreeConf - Day 1. Dana is on the left.

How did you get started as a programmer?

My first interaction with web programming was a long time ago – around 2000. I was a new mother and a quilter at the time. Some of my quilting friends had trouble finding sites that were selling the particular quilting products they were looking for. So, I made a site that recommended where to find quilting materials. That site was written first in pure HTML, then later refactored into .NET/C#. In 2007, I wrote my first application in Ruby on Rails - a shopping cart for some of the quilt stores who were by then my advertising clients. I freelanced from then until 2011, working on a variety of projects, all in Rails. In 2011, I decided to take a break from programming and focused on trying to launch a new craft business called Hey Betty Studio, which failed spectacularly. I have four kids who generate a lot of expenses so in 2013 I decided to return to programming.

How did you find out about Spree?

Ryan Bigg introduced me to Spree when I came back from my hiatus. I had known him from the #rubyonrails IRC channel from years past. When I came back to the community, I asked him for suggestions of a small project to start making open-source contributions to. He mentioned Spree. Maybe next time, I should define “small” a little better.

Why did you decide to contribute to the Spree Guides?

Spree is an enormous project and it’s a lot to take in. I decided that working on the documentation for Spree was a good way to familiarize myself with the project. Early on in my career I used to work as a technical writer so I felt comfortable working with documentation and I see a lot of value in it. It was also a good way for me to build my resume on GitHub, learn some new tools, and get to know members of the Spree community.

Have you contributed to any Spree extensions?

I contributed to the spree_wishlist translations. The spree_wishlist extension allows store visitors to add a product to a wishlist that they can then review and purchase at a later time. The translation piece of the extension allows you to display the text in different languages. I contributed to the French translation for the wishlist.

This was just the beginning for me. I’m eager to make more non-documentation commits. I’m trying to figure out the best place to fit into the gem to make useful contributions, and have already made a few commits to Spree core.

You gave your first lightning talk at SpreeConf, correct?

Yes, some of the folks in the Spree IRC chat room talked me into it. I discussed the value of documentation and of learning software by documenting it for other people. I was nervous, but I’m really happy that I did it and can check that item off my list. The community was amazingly supportive and encouraging, which has been my experience of Spree users from the beginning.

What do you have planned next to continue improving your programming skills?

I try to spend at least one day a week just doing technical reading. It’s tough in this business of constant changes, but I think it’s important to keep up on trends and developments, plus to get fresh perspectives and ideas on solving coding problems. I’m also planning to continue moving Spree’s user documentation forward, which can only make me a better consumer of the code. There will always be new things to learn and try in software development, so at least I never have to worry about getting bored.

Look for more valuable contributions to the Spree project from Dana in the months to come. Check out her GitHub profile and follow her on Twitter.

New Spree Releases to Address Jirafe Issues

As many of you already know, the Spree dashboard (which is powered by Jirafe) has been experiencing outages and other technical problems the past several days. Yesterday, the Jirafe team decide to temporarily shutdown their service for a few weeks while they finish deploying their 2.0 version of the service. This decision was made by Jirafe and without advance consultation with Spree. While we were aware that Jirafe was working on a new version of the service, we had no advance warning of the shutdown.

In some cases the outages have been preventing people from logging into their admin. Given the issues we have been experiencing with Jirafe the past few weeks, our team decided to pull the Jirafe functionality from Spree and issue new emergency patch releases to address the problem. If you are having problems with Jirafe we recommend that you update to one of the following patch releases: 2.0.3, 1.3.3, 1.2.5.

We spoke to the Jirafe team after we received reports of our users getting emails about the shut down. Apparently, the current system has been completely overwhelmed and they reached the difficult conclusion that it was going to be impossible to stand it back up again. We share your frustration at the suddeness of this decision and we apologize for any inconvenience this may cause. The Jirafe team has an excellent product and we’re looking forward to seeing the new version. When Jirafe comes back online again, it will be as an optional extension for Spree and not something that affects the rest of the admin functionality. In the meantime we are working on several alternatives to address your reporting needs.

We’ll have more updates for you shortly.