cbdw2014 - using a coldbox module to connect to the google analytics api

11

Click here to load reader

Upload: ortus-solutions-corp

Post on 25-Dec-2014

53 views

Category:

Technology


1 download

DESCRIPTION

Setup a Google Project to connect the Google Analytics API Setting up an oAuth 2.0 account Downloading and setting up the Google API jar files Adding your parameters to connect to the GA API Connect now through oAuth. Print Report

TRANSCRIPT

Page 1: CBDW2014 - Using a ColdBox Module to connect to the Google Analytics API

Get Analytics with:

By George Murphy

Page 2: CBDW2014 - Using a ColdBox Module to connect to the Google Analytics API

About Me

• Contractor

• ColdFusion since version 4.5

• Member Team ColdBox

• ColdFusion, JavaScript, and Angular JS

Page 3: CBDW2014 - Using a ColdBox Module to connect to the Google Analytics API

5

Setup CommandBox & a Google Project

4

3

2

1

Setting up an oAuth 2.0 account

Downloading Google API jar files

Add parameters to CB module

Connect through oAuth

Setup Steps for Get Analytics

Page 4: CBDW2014 - Using a ColdBox Module to connect to the Google Analytics API

What is Google Analytics

It is a service offered by Google that generates detailed statistics about a website's traffic and traffic sources and measures conversions and sales.

Page 5: CBDW2014 - Using a ColdBox Module to connect to the Google Analytics API

Download CommandBox

Unzip CommandBox

Open CMDCD to dir where CB

is unzipped

box

CD to dir where you want project

coldbox create app anal --

installColdBoxBE

Server start 52217 --force

Forgebox install javaloader

Setup CommandBox?

Page 6: CBDW2014 - Using a ColdBox Module to connect to the Google Analytics API

Let’s setup CommandBox

Page 7: CBDW2014 - Using a ColdBox Module to connect to the Google Analytics API

Setup Google Project

Setup Permissions

oAuth 2.0 Authentication

Download Google Jars

Setup ModuleConfig

Setup a Google Project

https://console.developers.google.com/project

Page 8: CBDW2014 - Using a ColdBox Module to connect to the Google Analytics API

SettingsModuleConfig.cfc settings

settings = {scope = "https://www.googleapis.com/auth/analytics.readonly",client_id = “***********.apps.googleusercontent.com",client_secret = “************",redirect_uri = "http://127.0.0.1:52217/index.cfm/ga/home/index",state = "optional"

};

routes = [{pattern="/", handler="home",action="index"},{pattern="/home/index", handler="home",action="index"},{pattern="/home/test", handler="home",action="test"},{pattern="/home/siteSelect", handler="home",action="siteSelect"},{pattern="/home/dateRange", handler="home",action="dateRange"},{pattern="/:handler/:action?"}

];

binder.map("googleService@ga").to( "#moduleMapping#.models.googleService" );binder.mapDirectory("#moduleMapping#.models");

function onLoad(){controller.getWireBox().getInstance('googleService@ga');

}

Page 9: CBDW2014 - Using a ColdBox Module to connect to the Google Analytics API

Do you have

any questions?

Page 10: CBDW2014 - Using a ColdBox Module to connect to the Google Analytics API

Resources

• CommandBox Downloadhttp://www.ortussolutions.com/products/commandbox

• Google Projecthttps://console.developers.google.com/project

• Sample Codehttps://github.com/murpg/coldbox-module-google-analytics-api

Page 11: CBDW2014 - Using a ColdBox Module to connect to the Google Analytics API

George Murphy

[email protected]

Contact me