4Ps Marketing

Using Google Analytics to Capture Votes

I recently spoke about Interactive Analytics at our Digital EDGEucation seminar this year. The underlying theme of my presentation was how important it is for brands to be able to understand what they are measuring and the key touch points along a user journey.

As always, I was keen to understand my audience, so I decided to make the session a bit more interactive by asking for votes on certain questions. I could then use both Real Time Analytics and a special dashboard to monitor their responses.

This post explains how I created the voting system and custom dashboard to review the data collected.

Step 1 – The Voting System

The first part of the process was to create a mechanism whereby people were able to vote. I decided that a web page would be the best way to do this, ideally one that could be used on a phone or tablet. If you are not familiar with HTML, then I would recommend using the W3 Schools tutorial.

To get off the ground quickly, I used Twitter Bootstrap. This is an HTML framework providing responsive layouts, CSS and widgets, which can save you a lot of time.

I also created a new Google Analytics account to record the data. Although I could have used the 4Ps Marketing account, I decided to use a different one in order to isolate the traffic.

The page I created [https://bit.ly/devote1] was quite simple. It had a question and a series of buttons:

The page itself was tracked in Google Analytics, but I needed a way of collecting the user vote.

I added a “doVote” piece of Javascript on each button. Javascript is a language that runs client side and allows a developer to interact with elements on the page. My function fired when the user clicked a button (the onclick) event.  The click sent three parameters (pieces of information). These parameters were the question (parameter c), the answer (parameter v) and, as I had six questions, the next page (parameter nPage).

In my function, I sent data to Analytics in the three ways detailed below. Realistically, you will only need to use one of these methods and unless you are using Universal Analytics, you should not use line A.

A – Universal Analytics allows us to send an event. This had the category vote, the action containing the question and the value of whatever the user had voted. The page argument tells Universal Analytics which page the user was on when they voted.

B – Google Analytics allows you to send “virtual” page views. These show up as pages, although they may not actually exist. These can be good for some things, PDF views for example, but they could also affect bounce rate and increase the average number of pages per visit. If you are using “virtual” page views, ensure that you understand the implications. In my function, I sent a page view, which was /slide-deck/what-analytics-package-do-you-use/ANSWER. The BLUE part would be different depending upon the answer the user had selected (the value of v) and the GREEN part would change depending upon the page the user was on. I hard coded it but you could read document.location to make the code dynamic.

C – Google Analytics allows you to send events. When the user clicked a button, I sent an event with a Category of Vote, an Action of the question (the value of c) and a value of what the user had clicked (the value of v).

After voting, I used jQuery (a Javascript framework) to remove the buttons and replace them with a link to the next page.

Step 2 – The Dashboard

After creating a simple mechanism for voting, you ideally want a way to report on the data. As I used both virtual page views and event tracking, I could use either of these in my dashboard. For simplicity’s sake, I chose to use page views.

Creating a dashboard in Analytics is relatively straightforward; you click to create a new dashboard, select Blank Canvas, give it a name and you have an empty dashboard.

It is possible to add widgets to this dashboard. On creating an empty dashboard, Google Analytics will pop up the Add Widget box.

I wanted to report a user’s responses, so I chose to display a pie chart showing the Unique Pageviews grouped by Page. Remember that each vote, in essence, would have its own URL).

I then added a filter with a Regular Expression – ^/slide-deck/what-analytics-package-do-you-use/ – to only include pages for the first question, then saved the widget.

It is also possible to use events. Rather than Unique Pageviews, I would use Unique Events and instead of grouping by the Page, I would group by the Event Label. The filter would then be the Event Action matching the question.

This produces a pie chart, as illustrated below.

One of the advantages of using Google Analytics is that we can, to a certain degree, use other dimensions to see which devices users used to vote.

This shows that the majority of my audience used an Apple device.

The Results

In my presentation, I asked some specific question relating to Analytics. The results were as follows:

1 – What Analytics Package do you use?

77% – Google Analytics
19% – Site Catalyst
4% – None

2 – Are you aware of the Measurement Protocol?

78% – No
22% – Yes

3 – Do you know what Dimensions and Metrics are?

76% – Yes
24% – No

4 – Have you exported data from your Analytics package?

71% – Yes
29% – No

5 – Are you aware of Attribution?

68% – Yes
32% – No

6 – Have you heard of Universal Analytics?

57% – Yes
43% – No

Conclusion

Google Analytics provides a flexible framework that can be adapted to many purposes. The Measurement Protocol and Universal Analytics take this one step further and enable integration into other processes, both on and offline.

4Ps isn’t just another SEO agency. To discuss how analytics and tracking are evolving together in order to keep pace with new developments in user interaction and cross device habits, give us a call on +44 (0)207 607 5650 for a no-obligation coffee and chat about data, marketing and user behaviour across all inbound channels. How could a 4Ps analytics consultant help your business to grow?