404 images and assets in Rails 3.2

For folks that have come from a traditional web dev background they may think that putting an image “example.jpg” into the /assets/images folder might be accessed via a url mirroring that path e.g. “www.domain.com/assets/images/example.jpg”.  I spent 10 minutes noobishly confused until I realised that you don’t specify the /images/ part of the path in the url.  So the above example would be served up on “http://www.domain.com/assets/example.jpg” even though the image is in the images folder.  I’m using Rails 3.2.

When debugging this the server is (obviously) returning a 404 for the image file and if you try to browse to the image directly rails returns a route not defined error.

OmniAuth Google OAuth2 strategy – where to get Google Key and Secret

Having spent too much time ironically on Google searching for how to obtain a Google Key and Google Secret (for OAuth2) I decided to post this for future reference.

I’m assuming that you are implementing some Google authentication functionality with something like OmniAuth (Ruby on Rails gem).  Whether it is OmniAuth or not you’ll need to register your application with Google; obtaining a Google Key and Google Secret as well as setting a callback url.

  1. Go to https://code.google.com/apis/console, log in with your Google account and click on API Access.
  2. Create OAuth2 credentials by clicking the big blue OAuth2 button.
  3. Set the callback url and the name of your app (can be edited later)
  4. The Google Key (as it is referred to by OmniAuth) is the Client ID
  5. The Google Secret (as it is referred to by OmniAuth) is the Client Secret
  6. Use those credentials as per your documentation for implementing OAuth2 authentication.

The Google OmniAuth strategy for OAuth2 is here: https://github.com/zquestz/omniauth-google-oauth2.  Look in the examples folder for details on the rest of the implementation.

Website usability roadmap…

I found a great 3rd party app the other day that collects user feedback.  It’s called UserVoice and like other 3rd party feedback gatherers, you add it to your website by adding a few lines of javascript code.  Easy.  The great thing about this feedback tool is that your visitors get something out of it as well, as soon as they hit your ‘feedback’ button.

This is what you see:

This is what you see when you click the feedback button

This is what you see when you click the feedback button

A visitor will have pressed the feedback button because they have something on their mind.   What I like about this is that the first thing they see is what is on the mind of all the other people that have submitted feedback. A list, prioritised by a simple voting system, shows the visitor what the biggest gripes are.

If you see your own gripe there, then vote for it.  If not, lodge your feedback and it’ll be there for others to vote on when they leave their feedback.

The next nice thing about it is that if the website developers/owners decide to implement an idea that someone has left, they can indicate that the work is planned, in progress or even completed.  Instant feedback to the visitor – letting them know that yes, something is being done about it – great – we’re being listened to.

So – it provides you with great information that helps you create a development roadmap for your website – ever wondered what shall we do next to our website? Well you’ll get tons of inspiration from this.

Finally, a small word of warning, although your website should cater for the needs of your visitors – make sure that it is the segment of visitors that you want to appeal to that you are developing for.  It won’t always be possible to cater for everybody – this is where your judgement comes in and your knowledge of the goals of your website.

Google Analytics Custom Reports

dimensions New features arrive in little bursts with Google Analytics and in the last burst along with Advanced Segments was Custom Reports.  The first thing I did with GA when these arrived was play around with Advanced Segments until my list of custom segments was so unmanageable that I had to start using two logins to manage the different types of segmentation I wanted to do!

Custom Reports became a bit of a poor relation.  When it first came out I couldn’t think of a good reason to create a custom report – so I left it well alone.  After a while of using Advanced Segments I was pleased with myself as I had worked out how to follow a tagged email campaign link through to any transactions associated with it (and therefore revenue) and the products that were purchased.  This was great – the ability to see exactly what items were purchased after somebody had clicked on a specific email link in a campaign.

It was a tedious process though, you had to identify the link in the campaign that had generated revenue (taunted by the not-hyperlinked ’15 transactions’ it was associated with), then create an Advanced Segment for that link (it was tagged using utm_term, which is presented in the ‘keyword’ dimension), then apply that segment and look at the Ecommerce transactions to see which transactions (and therefore products) were associated with that link.  Long winded huh?  Especially if you wanted to investigate several revenue-generating links.

Custom Reports to the rescue!  Using Custom Reports, it is simple to set up a report that uses ‘Campaign’ as the main dimension, then drills down to the ‘keyword’ dimension, followed by ‘transaction’, followed by ‘product’.  Drop the metrics you want to see along the top, and you’ve got a drill down report that begins by listing your campaigns, and allows drill down all the way to product level.  Fantastic.

Easy to create a drill down report

Easy to create a drill down report

No more laborious Advanced Segments to create!

Google Analytics _setVar fixed to not break bounce rate

Great news!  Google have fixed the use of the _setVar method that sets the custom variable in Google Analytics – useful for recording other dimensions that you might want to segment by e.g. Premium customer VS Standard customer.

Previously, using this variable completely broke the bounce rate reporting as it counted the usage of _setVar as an ‘interaction’.  A bounce happens when the visitor only has 1 interaction with the site, so even if they only visited 1 page but the _setVar was used, it wouldn’t be counted as a bounce because pageview+setVar = 2 interactions.  The following image shows what happened to us the last time we tried to use the _setVar method…

_setVar destroyed our bounce rate metric!

_setVar destroyed our bounce rate metric!

Google Analytics Advanced Segments: fuzzy understanding

Something is bugging me.  A respected web analytics expert, blog writer and Google Analytics evangelist Avinash Kaushik has disturbed my equilibrium on the subject of Advanced Segmentation in this post.

To cut a long blog-comment-ping-pong game short, I drilled down to a single fact/assumption that underpinned his analysis which I’m not 100% sure about.   The assertion is most easily explained with an example:

1. A visit to the website occurs 30 days ago from a ppc campaign “randomCampaign”.  You can set up an advanced segment to constrain your reports by “Campaign=randomCampaign” so you can see visits to the website from this campaign.  All good stuff.
2. Now imagine that the same visitor decides to visit your website again, but this time as he knows the url he types it into his browser and for this visit is therefore “direct”.
3. In a couple of days we run a report on Google Analytics constrained by the “randomCampaign” segment for a time-span of say, 5 days.

Underpinning the methodology Avinash is using, he is expecting that the report in step 3. includes the visit that occurred in step 2., despite that visit being a “direct” visit and not a “randomCampaign” visit.

My understanding is that the segmentation will act on the visits that occurred in that time-period and the dimension that is being segmented by must apply to those visits, not previous visits outside the date range.

Now we don’t seem to agree on this, but luckily it is something we can test.  So starting today, I’ll begin an experiment to test the above and I’ll report my findings here in a week or so…

==================================

Couple of days later…

So here is the quick test I ran:

1. I cleared all the cookies from my browser.
2. I visited my website from a referral: gatest.somewhere.com.  I made sure I knew which page I visited.
3. The next day, I went to the website again, but this time I typed the URL directly.

My original thinking was that visit in step 2. would be a source=referral, and the visit in step 3. is a source=direct.  Wrong wrong wrong!!

Despite the visit in step 3. being a ‘direct’ visit, GA is clearly reporting the source for both visits as the original source that is associated with me.  This explains why when you set up an Advanced Segment, say for this example where ‘source = gatest.somewhere.com’, both visits in steps 2 and 3 will appear in your segmented reports.  Which validates Avinash (surprise surprise) and forces me to accept a whole new paradigm…

So in summary: when you view the ‘direct’ report in GA, the visits that are registered may or may not have been ‘direct’ – only their very original visit to the website was ‘direct’…  This applies to any of the source dimensions – which poses several interesting questions…

Edit: further clarification here at Justin’s Epikone blog on how GA tracks bookmark visits.

Premium version of Google Analytics

Before you get excited, no, there isn’t a premium version of Google Analytics yet.

Edit (29/09/11): They released it yesterday: and according to a couple of sources, it’s going to cost about $150k per year. 

But I sincerely hope that they are working on one – I’ve mentioned before that it’ll be great news if Google release a version of Google Analytics that you have to pay for.

So here I’m beginning to compile a list of the things that I come across every day that I wish is in Google Analytics, and would be happy to pay for:

In no particular order…

  • Advanced Segmentation: I would love for AS to be enabled for Goal Funnels…
  • “This report is based on sampled data.  Learn more.”  I would really like to not see this message.  It means that the numbers I’m looking at are not the real numbers.  Even if it took a little longer for the report to run, I’d like the ability to see the complete picture and not their “sampled data”.
  • Data backup.   One day it might happen – someone with administrator access on my account accidentally (or maliciously – eek!) deletes my GA account.  Disaster!!!
  • Retrospective filters.  You apply a filter and it acts on your data retrospectively Implemented with Advanced Segmentation.  Thanks!
  • Multiple dimensions.  At the moment you can set a ‘user defined’ variable, but you cannot add several custom dimensions that you can use to slice and dice your data
  • Annotation.  Like the charts you see on Google Finance or Google Trends, I’d like to be able to annotate my charts with significant events that I know of that might explain certain trends etc.  Done!
  • More AdWords integration.  Sometimes there are campaigns and AdGroups that you see in analytics that confuse you – which ad is that again?  To be able to click through to see the ad text and other details would be nice
  • On charts overlay profiles (or segments as they might be called) – so if you have multiple profiles set up for a single website with each profile having a different filter applied (you might have one that shows organic search only and another with paid search only), I’d like to be able to take any chart and add data to it from another profile.  So you’d get a data series for each profile you added. Implemented with Advanced Segmentation
  • Related to the previous one – it would help enormously if you could duplicate a profile from an existing profile – that way you don’t have to set up your goals etc all over again… Implemented with Advanced Segmentation
  • Ecommerce transactions.  These are a must for any website that sells stuff online.  When you look at a particular report, you can click the Ecommerce tab and see the revenue associated with that referral source, or region etc.  It even tells you the number of transactions that are associated with that record.  What I’d *love* to be able to do is then click on the ‘transactions’ value, to arrive at the list of those transactions so I can identify the products purchased.  I will then be able to quickly ask the question: “what do people that come from X tend to buy the most”.  Instead what I have to do now is set up an Advanced Segment constraining the report by X in order to see what the transactions were, and whilst this works, it is a very time-consuming process.