How To Use It

You'll see this screen. Pardon the over heavy legal disclaimers, I'm just covering my arse. I have no intention of using this app to mine data, but other's GA apps might, so I would be wary giving access to Google Analytics for other webapps, especially now its possible to add users via the management API.

Click the "GA Authentication" link. It'll take you to the Google account screen, where you say its ok to use the data (if it is), and copy-paste the token it then displays.

This token allows the app (but not me) process your data. Go back to the app and paste the token in the box.

Wait about 10 seconds, depending on how many accounts you have in your Google Analytics.

Sometimes you may see "Bad Request" which means the app is bad, and the GA call has errored. If you hard reload the page (on Firefox this is SHIFT + RELOAD), you need to reauthenticate starting from step 2 above. Sorry.

You should now see a table of your GA Views on the "GA View Table" tab. You can search and browse the table, and choose the account and profile ID you want to work with via the left hand drop downs. Example using Sanne's Copenhagenish blog:

If you click on "Charts" tab in the middle, you should see some Google Charts of your Visits and PageViews. Just place holders for now.

If you click on the "Forecasts" tab you should see some forecasting of your visits data. If it doesn't show, make sure the date range to the far left covers 70 days (say 1st Dec 2013 to 20th Feb 2014).

The Forecast is based on Holt-Winters exponential smoothing to try and model seasonality. The red line is your actual data, the blue the model's guess including 70 days into the future. The green area is the margin of error to 50% confidence, and the Time axis shows number of months. To be improved.

Under the forecast model is a decomposition of the visits time series. Top graph is the actual data, second is the trend without seasonal, third graph the 31 data seasonal trend and the forth graph is the random everything else.

In the last "Data Table" tab you can see the top 1000 rows of data.

That's it for now, but I'll be doing more in the future with some more exciting uses of GA data, including clustering, unsupervised learning, multinomial regression and sexy stuff like that.

Update 24th Feb

I've now added a bit of segmentation, with SEO and Referral data available trended, forecasted and decomposed.

Enter your email address to get email alerts about new posts on this site.
Unsubscribe anytime.

Email address is invalid.

6 responses

I've been doing a very similar project to this and love web app setup. Would you mind sharing your code for the creation of ggplot2 graphics using Holt-Winters forecasting? I've been unable to get ggplot2 to interface with ts or Holt-Winter objects.

—
LinMod

Hi LinMod - sure I found it on the web myself from somewhere, but here is a Gist of it for your own use.
https://gist.github.com/MarkEdmondson1234/3190f...
ggplot doesn't handle time series, so you have to turn the dates into characters or numeric. I changed the function to add some config options at the top, and to return a list of things you may need, so the plot itself is found by:
myHWplot

—
Mark Edmondson

This is amazing work on how Shiny can leverage the GA API to pull data.
Any chance you putting this project on Github? I am building a similar project and curious on how you are pulling the data (i am using rga from Skardhamar).
Thanks

—
Chris Keune

Dear Chris, thank you for your kind words.
I have toyed with putting at least the GA connector to Shiny up on github, the problem is its a very messy hacked version as I needed to tweak the rga functions to support authentication through the browser. It also involved stripping out the nice method style of rga functions and making them all Shiny reactive functions, so as soon as you update rga it all breaks. I'll take another look and see if it can be made upgrade friendly.
In the meantime though I have met up with rga's author, Bror, as we are both living in Copenhagen, and perhaps with his support we can add a fork to rga to support Shiny? I'll mention it next time we have a coffee.
I look back at this app now and see it as very alpha, once my current project is done I plan to come back and move this to using ggvis, improve the stats etc, so watch this space!
Yours sincerely,
Mark

—
Mark Edmondson

Hi,
I am unable to found the GA authentication code link on the landing page. Its showing the Please visit the link but the link is not there.
Can you please help me on the same?
Thanks

—
Ritesh

Dear Ritesh, thanks for dropping by :)
I just tried the app and it was working ok for me, perhaps send a screenshot to one of my accounts above? And we're talking about this one, right? https://mark.shinyapps.io/GA_timeseries/ - not the one I just did: https://mark.shinyapps.io/ga-effect/
I'm going to upgrade the authentication method soon as I've learnt a much smoother way as used in the new app since this older app 12 months ago :)

Mark Edmondson

Views on this blog are entirely my own and do not reflect my employers. Content may also be unbelievably true, or exaggerated falsehoods. Its written for friends, so if I don't know you please act as a potential friend :) Any trolling or spamming will be punishable by death.
Contact: mark [at] markedmondson.me