Ejemplo n.º 1
0
echo "* total sites : " . $site_details_length . " *" . "\n";
echo "*******************" . "\n";
/**
 * Query the Analytics data.
 * date, source, medium,channel_grouping, device_category, landing_page_path, sessions,
 * transactions, transaction_revenue, page_views, bounces, session_duration, hits, total_events,
 * unique_events, users, entrances, exits
 */
$num = 1;
for ($i = 0; $i < $site_details_length; $i++) {
    $detail = $site_details[$i];
    echo $detail->name . "\n";
    $packaged_data = ReturnedAnalytics::extractAnalytics($analytics, $detail->analytics_profile);
    $analytics_site = "analytics_site" . $num++;
    // echo $analytics_site . "\n";
    /**
     * Instance ReturnedAnalyticsOne Object via tranform method.
     */
    ReturnedAnalytics::transform($packaged_data, $analytics_site);
}
echo "NOTE: To output data to terminal or save to database you will need to uncomment those options in the src/ReturnedAnalytics.php on line 358 or 361. \n";
/**
 * Confirms that each site has be iterated through.
 */
if ($num - $site_details_length === 1) {
    // all the sites have been iterated through.
} else {
    trigger_error('All of the sites have not been iterated through.', E_USER_NOTICE);
    error_log($today . "All of the sites have not been iterated through \n", 3, __DIR__ . "/../../log/error.log");
    exit;
}