campaignAnalytics(string apikey, string cid)
Retrieve the Google Analytics data we've collected for this campaign. Note, requires Google Analytics Add-on to be installed and configured.
| Section | Campaign Stats |
|---|
| Parameters | mcapi_campaignAnalytics.php|
|---|---|
| apikey | a valid API Key for your user account. Get by visiting your API dashboard |
| cid | the campaign id to pull bounces for (can be gathered using campaigns()) |
| Returns | |
|---|---|
| array | analytics we've collected for the passed campaign. |
| Returned Fields | integer | visits | number of visits | integer | pages | number of page views | integer | new_visits | new visits recorded | integer | bounces | vistors who "bounced" from your site | double | time_on_site | the total time visitors spent on your sites | integer | goal_conversions | number of goals converted | double | goal_value | value of conversion in dollars | double | revenue | revenue generated by campaign | integer | transactions | number of transactions tracked | integer | ecomm_conversions | number Ecommerce transactions tracked | array | goals | an array containing goal names and number of conversions |
|---|
[1] mcapi_campaignAnalytics.php
<?php /** This Example shows how to retrieve Analytics data collected for a campaign with some basic error checking. **/ require_once 'inc/MCAPI.class.php'; require_once 'inc/config.inc.php'; //contains apikey $stats = $api->campaignAnalytics($campaignId); if ($api->errorCode){ } else { if ($stat['goals']){ foreach($stat['goals'] as $goal){ } } } ?>