CBDW2014 - Using a ColdBox Module to connect to the Google Analytics API
Click here to load reader
-
Upload
ortus-solutions-corp -
Category
Technology
-
view
53 -
download
1
description
Transcript of CBDW2014 - Using a ColdBox Module to connect to the Google Analytics API
![Page 1: CBDW2014 - Using a ColdBox Module to connect to the Google Analytics API](https://reader038.fdocuments.us/reader038/viewer/2022100500/549c1f41ac7959b02a8b464f/html5/thumbnails/1.jpg)
Get Analytics with:
By George Murphy
![Page 2: CBDW2014 - Using a ColdBox Module to connect to the Google Analytics API](https://reader038.fdocuments.us/reader038/viewer/2022100500/549c1f41ac7959b02a8b464f/html5/thumbnails/2.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022100500/549c1f41ac7959b02a8b464f/html5/thumbnails/3.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022100500/549c1f41ac7959b02a8b464f/html5/thumbnails/4.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022100500/549c1f41ac7959b02a8b464f/html5/thumbnails/5.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022100500/549c1f41ac7959b02a8b464f/html5/thumbnails/6.jpg)
Let’s setup CommandBox
![Page 7: CBDW2014 - Using a ColdBox Module to connect to the Google Analytics API](https://reader038.fdocuments.us/reader038/viewer/2022100500/549c1f41ac7959b02a8b464f/html5/thumbnails/7.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022100500/549c1f41ac7959b02a8b464f/html5/thumbnails/8.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022100500/549c1f41ac7959b02a8b464f/html5/thumbnails/9.jpg)
Do you have
any questions?
![Page 10: CBDW2014 - Using a ColdBox Module to connect to the Google Analytics API](https://reader038.fdocuments.us/reader038/viewer/2022100500/549c1f41ac7959b02a8b464f/html5/thumbnails/10.jpg)
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