Created
July 19, 2016 21:21
-
-
Save hiltmon/d94ada6df376eef312e2d28c5c52e395 to your computer and use it in GitHub Desktop.
GAPI Old to New Certificate Based PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OLD: | |
define('ga_email','[email protected]'); | |
define('ga_password','i_aint_sayin'); | |
define('which_profile',0); // The first profile | |
define('days_to_report', 7); // No of days excluding today! | |
define('ga_title','Hiltmon.com Stats'); | |
require 'gapi.class.php'; | |
date_default_timezone_set('America/New_York'); | |
$ga = new gapi(ga_email,ga_password); | |
$ga->requestAccountData(); | |
// Run this to see available accounts | |
// foreach($ga->getResults() as $result) | |
// { | |
// echo $result . ' (' . $result->getProfileId() . ")<br />"; | |
// } | |
// And this to get the graph | |
$results = $ga->getResults(); | |
$result = $results[which_profile]; | |
$ga_profile_id = $result->getProfileId(); | |
$start_date = date("Y-m-d", strtotime('-' . days_to_report . ' days')); | |
$end_date = date("Y-m-d"); | |
... | |
NEW: | |
define('ga_title','Hiltmon.com Stats'); | |
define('days_to_report', 7); // No of days excluding today! | |
define('ga_profile_id','XXXXXXXXX'); | |
require 'gapi.class.php'; | |
date_default_timezone_set('America/New_York'); | |
$ga = new gapi('[email protected]', 'Noverse-GAPI-XXXXXXXXX.p12'); | |
$start_date = date("Y-m-d", strtotime('-' . days_to_report . ' days')); | |
$end_date = date("Y-m-d"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment