22
Using the Google Analytics API to make MPP widgets for your website. HealYourChurchWebsite. com @DeanPeters Using the Google Analytics API ... to make most popular pages widgets for your website. by @DeanPeters HealYourChurchWebSite.com Slides: http://slidesha.re/gaapi2mpp Code: http://bitly.com/ga-api2mpp

Using the Google Analytics API to make most popular pages widgets for your website

Embed Size (px)

DESCRIPTION

Using the Google Analytics API to create a most popular pages widget for your website or blog using the Google Analytics API. I'll demonstrate a custom report in Google Analytics, then show how to automate the same using Perl and the Google Analytics API to create an RSS feed of the top 10 stories from my blog — which I then incorporate into the siderail of my blog using a WordPress RSS widget. Here's the link to code in GitHub: http://bitly.com/ga-api2mpp?slideshare

Citation preview

Page 1: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

Using the Google Analytics API ...

… to make most popular pages

widgets for your website.

by

@DeanPeters

HealYourChurchWebSite.com

Slides: http://slidesha.re/gaapi2mpp

Code: http://bitly.com/ga-api2mpp

Page 2: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

Intro

Who am I?

I'm the artist+geek linchpin Seth Godin warned you about.

What do I do?

I manage one of the Support Development Teams at

McClatchy Interactive.

Why am I doing this presentation?

I'm a self-admitted analytics and social media API junkie

Page 3: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

Some funs stuff I've done

FaceBook Like Button

Wrote a popular Facebook like button plugin for WordPress

Heal Your Church Website

Where I blog about my usability & API addictions

Son of Web Pages that Suck

I was a contributing author to that 2002 classic

Page 4: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

Most Popular Pages Widget

What is it?

It's usually a box on the side rail that list linked titles to the

most read stories on a website or blog

How popular is it?

You often see this widget on news media sites

Can we see some examples?

Sure

Page 5: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

Bradenton Herald

Page 6: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

USA Today

Page 7: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

Lexington Herald-Leader

Page 8: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

Most Popular Pages

Where do they get the data?

From sources such as Google Analytics & Omniture

Can I do this with my website or Blog?

Sure

Page 9: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

What you'll need

A Website or Blog

For today's example, we'll use WordPress

An Analytics Service with an API

For today's example, we'll use Google Analytics

A programming language

For today's example, we'll use Perl

Page 10: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

Google Analytics Dashboard

Standard Reporting How to filter your popular pages via GA's standard reports

Page 11: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

Google Analytics Dashboard Custom Reporting

How to create a custom report

Page 12: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

Why You Need an API

Exporting from the Dashboard ...

… is a process that is tedious and unsustainable

Using an API ...

… allows you to automate this process

Using a Programming Language ...

… let's you fine-tune the data and reports you need

Page 13: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

What is the Google API?

One of many API web services ...

… found at http://code.google.com/more/

What does it provide?

Programmatic access to Google Analytics report data &

statistics derived from the data collected on your site,

organized as dimensions and metrics.

Page 14: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

Dimensions & Metrics

You've already seen these ...

… in custom & standard reports

Dimensions ...

… are the rows of data

Metrics ...

… are columns of data in the rows

Page 15: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

Accessing the API

You'll need to be authenticated ...

… in this case we'll use a gmail id & password

You'll need the Profile ID ...

… this is NOT the UA key

You'll need to filter the data ...

… using our old friends dimensions & metrics

Page 16: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

Coding for the API

You'll need to be authenticated ...

… with Perl, we'll use Net::Google::AuthSub

You'll need to talk via your Profile ID ...

… with Perl, we'll use Net::Google::Analytics

You'll need to output the data ...

… with Perl, we'll use XML::FeedPP

Page 17: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

ga-api2mpp.pl

This is where I show you some code

Page 18: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

Limitations of the API

Authentication is often a hurdle ...

… for Google Analytics, investigate using OAuth

Be careful of quanity ...

… don't get penalized for asking for everything all the time

Don't expect miracles ...

… the quality of the data you pull is directly proportional to

to how well you've setup & configured Google Analytics

Page 19: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

Implementing the Code Crontab the program

* */12 * * * perl ga-api2mpp.pl username\@gmail.com password

Add the output to your blog ... … here's where I show you some WordPress widgetry

Page 20: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

Voilà

This is where I show you some results

Page 21: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

Take-Aways

Coding is 'easy-enough' ...

… if you let other libraries & modules do the heavy-lifting

Garbage-in/Garbage-out ...

… the API can only 'pull' what data your actively tracking

Have fun & explore...

… you'll be amazed at how many different and cool ways

you can slice-n-dice your data in a coder's context

Page 22: Using the Google Analytics API to make most popular pages widgets for your website

Using the Google Analytics APIto make MPP widgets for your website.

HealYourChurchWebsite.com@DeanPeters

Questions & Answers

On creating a Most Popular Pages widget for your website using the Google API.

by

@DeanPeters

HealYourChurchWebsite.com

Slides:http://slidesha.re/gaapi2mpp

Code: http://bitly.com/ga-api2mpp