Getting full list of contacts from Hubspot API - php

Hubspot's API allows you retrieve a list of contacts, however it only allows a max of 100 per call.
I do that with this call:
$contacts_batch1 = $contacts->get_all_contacts(array( 'count' => '100'));
And then if I want to get the next 100 I do this:
$offset1 = $contacts_batch1->{'vid-offset'};
$contacts_batch2 = $contacts->get_all_contacts(array('count' => '100', 'vidOffset'=>$offset1));
I am trying to get all the contacts without having to create a new variable each time I want the next 100. My first question would be how would I go about getting the vid-offset of the last set, and then how would I put that as a parameter into the next variable automatically.

Here's an example of getting all contacts into one array using HubSpot's API.
<?php
require "haPiHP/class.contacts.php";
require "haPiHP/class.exception.php";
define("HUBSPOT_API_KEY", "<YOUR API KEY HERE>");
$contacts = new HubSpot_Contacts(HUBSPOT_API_KEY);
$all_contacts = array();
do
{
$params = array("count" => 100);
if (isset($vidOffset))
{
$params["vidOffset"] = $vidOffset;
}
echo "count=" . $params["count"] . (isset($params["vidOffset"]) ? ", vidOffset=" . $params["vidOffset"] : "") . "\n";
$some_contacts = $contacts->get_all_contacts($params);
if ($some_contacts !== NULL)
{
$all_contacts = array_merge($all_contacts, $some_contacts->contacts);
}
else
{
break;
}
$vidOffset = $some_contacts->{'vid-offset'};
} while ($some_contacts->{'has-more'});
echo "Received " . count($all_contacts) . " contacts.\n";
?>

Related

How can I get the clients information that access an exact page?

So, I have this code, which is from a plug-in that I want to create:
<?php
declare(strict_types = 1);
use Ubnt\UcrmPluginSdk\Service\UcrmApi;
use Ubnt\UcrmPluginSdk\Service\UcrmSecurity;
use Ubnt\UcrmPluginSdk\Security\PermissionNames;
chdir(__DIR__);
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/main.php';
$fullAddress = isset($_GET['fullAddress']) ? $_GET['fullAddress'] : '';
$firstName = isset($_GET['firstName']) ? $_GET['firstName'] : '';
$lastName = isset($_GET['lastName']) ? $_GET['lastName'] : '';
// GET collection of clients
$clients = UCRMAPIAccess::doRequest('clients') ?: [];
//echo sprintf('Found %d clients.', count($clients)) . PHP_EOL;
// GET the client data that access the 'Contract' page
foreach($clients as $client) {
$response = UCRMAPIAccess::doRequest(
sprintf('clients/%d', $client['id']),
'GET',
[
'fullAddress' => $fullAddress,
'firstName' => $firstName,
'lastName' => $lastName,
]
);
if($response !== null) {
echo sprintf('The following details are for client number: <b>%d</b>', $client['id']);
echo '<ul>';
echo sprintf('<li>%d</li>', $client['id']);
echo sprintf('<li>%s</li>', $client['fullAddress']);
echo sprintf('<li>%s</li>', $client['firstName'] . ' ' . $client['lastName']);
echo '</ul>';
} else {
echo sprintf('There was an error retrieving data from client: %d.', $client['id']) . PHP_EOL;
}
}
echo 'Done.' . PHP_EOL;
For now, if I run this code and I click on the plug-in's page I get this:
What I am trying to is: I want to recieve only the client's information that access the page.
So, I am logged as a client (each client have access to that page named Contract) and when I click on Contract page I want to get my client information, not of all clients.
I've tried to modify :
$clients = UCRMAPIAccess::doRequest('clients') ?: []; > UCRMAPIAccess::doRequest(sprintf('clients/%d', $client['id']) and remove the foreach, but then I got an error that $client is not defined.
Since the $clients variable is an array that contains a list of all the clients that have accessed that page, as you're getting the collection here:
$clients = UCRMAPIAccess::doRequest('clients') ?: [];
And I believe you're trying to get the one client that just accessed the page, since you said:
"when I click on Contract page I want to get my client information, not of all clients"
Then I believe you can filter the $clients array for a single client that matches an id, ONLY if you know the id of the client you're looking for.
For example:
$clients = UCRMAPIAccess::doRequest('clients') ?: [];
$you = (object) array('firstName' => 'foo', 'lastName' => 'bar', 'id' => 1);
$meInClients = array_filter($clients, function($k) {
// filter by key
}, ARRAY_FILTER_USE_KEY)
$clients[meInClients]
But in this case it seems your program doesn't know what user to look for, so a filter or search might not work here. What you want to do is get the last user who JUST visited that page, naturally that user would be the last in the array.
So:
$clients = UCRMAPIAccess::doRequest('clients') ?: [];
$whoJustVisitedPage = $clients[count($clients) - 1]
So this might work.
UPDATE:
When you access the page as John Doe and go to that page, ( the $clientsWhoVisitedPage array now becomes $clientsWhoVisitedPage + YOU (currently authenticated user a.k.a the last person who viewed the page) What you can do in this case is first to filter the $client array so it doesn't contain the currently authenticated user. Then get the last user in the new array.
Like so:
$me = $security->getUser();
$clientsExceptMe = array_filter($clients, function($client, $x) {
return $client->id != $me->id;
}, ARRAY_FILTER_USE_BOTH));
$lastPageVisitor = $clientsExceptMe[count($clientsExceptMe) - 1]
lastPageVisitor should now give you the last person that visited that page that isn't the currently authenticated user.
I don't know the code of UCRMAPIAccess::doRequest, so I can not help you with this aproach although is the rigth one. (Search Doc about this Class/Method)
As a really shit solution, you can do something like this ...
$fullAddress = isset($_GET['fullAddress']) ? $_GET['fullAddress'] : '';
$firstName = isset($_GET['firstName']) ? $_GET['firstName'] : '';
$lastName = isset($_GET['lastName']) ? $_GET['lastName'] : '';
// GET collection of clients
$clients = UCRMAPIAccess::doRequest('clients') ?: [];
//echo sprintf('Found %d clients.', count($clients)) . PHP_EOL;
// GET the client data that access the 'Contract' page
foreach($clients as $client) {
$response = UCRMAPIAccess::doRequest(
sprintf('clients/%d', $client['id']),
'GET',
[
'fullAddress' => $fullAddress,
'firstName' => $firstName,
'lastName' => $lastName,
]
);
if($response !== null
&& $firstName == $client['firstName']
&& $lastName == $client['lastName']
&& $fullAddress == $client['fullAddress']
) {
echo sprintf('The following details are for client number: <b>%d</b>', $client['id']);
echo '<ul>';
echo sprintf('<li>%d</li>', $client['id']);
echo sprintf('<li>%s</li>', $client['fullAddress']);
echo sprintf('<li>%s</li>', $client['firstName'] . ' ' . $client['lastName']);
echo '</ul>';
}
}
echo 'Done.' . PHP_EOL;

Authorize.Net API limit 1000 results. How to overcome it?

On my website we keep transactions as pending and capture them when we ship (often we need to change amounts/cancel and it makes it easier accounting wise to work like that).
When we are ready to ship, we match all specified orders (with specified order status) with the invoice#/order id in authorize.
the issue is that the authorize.net API only allows for 1000 transaction limit so when using their GetUnsettledTransactionListRequest function it is missing transactions that are unsettled passed that amount.
I am able to set the paging limit to 1000 and I can also set the offset to 1000 (or 999 not sure which yet) so I think what I need to do is something like check if the array storing the results size is 1000 and if so get the next 1000 results to store in the array. But about about the next loop do I have to manually say 3000, 4000, 5000 (we don't have that many transactions but still).
here is my current code:
function getUnsettledTransactionList()
{
//get orders that are in the exp status
$orders_pending_query = tep_db_query("select orders_id as invoice_number from " . TABLE_ORDERS . " where orders_status = '15' order by invoice_number");
$orders_pending = array();
while ($row = mysqli_fetch_array($orders_pending_query, MYSQLI_ASSOC)) {
$orders_pending[] = $row;
}
/* Create a merchantAuthenticationType object with authentication details
retrieved from the constants file */
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
$merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
$merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
// Set the transaction's refId
$refId = 'ref' . time();
$request = new AnetAPI\GetUnsettledTransactionListRequest();
$request->setMerchantAuthentication($merchantAuthentication);
$controller = new AnetController\GetUnsettledTransactionListController($request);
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::PRODUCTION);
$transactionArray = array();
$resulttrans = array();
if (($response != null) && ($response->getMessages()->getResultCode() == "Ok")) {
if (null != $response->getTransactions()) {
foreach ($response->getTransactions() as $tx) {
$transactionArray[] = array(
'transaction_id' => $tx->getTransId(),
'invoice_number' => $tx->getInvoiceNumber()
);
// echo "TransactionID: " . $tx->getTransId() . "order ID:" . $tx->getInvoiceNumber() . "Amount:" . $tx->getSettleAmount() . "<br/>";
}
//match the array column by invoice mumber to find all the transaction ids for cards to capture
$invoiceNumbers = array_column($orders_pending, "invoice_number");
$result = array_filter($transactionArray, function ($x) use ($invoiceNumbers) {
return in_array($x["invoice_number"], $invoiceNumbers);
});
$resulttrans = array_column($result, "transaction_id");
print_r($resulttrans);
} else {
echo "No unsettled transactions for the merchant." . "\n";
}
} else {
echo "ERROR : Invalid response\n";
$errorMessages = $response->getMessages()->getMessage();
echo "Response : " . $errorMessages[0]->getCode() . " " . $errorMessages[0]->getText() . "\n";
}
return $resulttrans;
}
GetUnsettledTransactionListRequest offers the ability to page the results. So you after you process the first 1,000 results you can request the next 1,000 results.
I don't use the Authnet SDK but it looks like you can use AnetAPI\PagingType() to handle the paging for you:
$pagenum = 1;
$transactionArray = array();
do {
// ...code truncated...
$request = new AnetAPI\GetUnsettledTransactionListRequest();
$request->setMerchantAuthentication($merchantAuthentication);
// Paging code
$paging = new AnetAPI\PagingType();
$paging->setLimit("1000");
$paging->setOffset($pagenum);
$request->setPaging($paging);
$controller = new AnetController\GetUnsettledTransactionListController($request);
// ...code truncated...
$numResults = (int) $response->getTotalNumInResultSet();
// ...code truncated...
$pagenum++;
} while ($numResults === 1000);
The JSON would resemble this:
{
"getUnsettledTransactionListRequest": {
"merchantAuthentication": {
"name": "",
"transactionKey": ""
},
"paging": {
"limit": "1000",
"offset": "1"
}
}
}

Pagination with google ads api in php

I am trying to do the pagination with google-ads-php at the bottom of my page in php, so I get through my ads, like PREVIOUS 1,2,3 NEXT
So this is my code:
public function runExample(GoogleAdsClient $googleAdsClient, int $customerId)
{
$googleAdsServiceClient = $googleAdsClient->getGoogleAdsServiceClient();
// Creates a query that retrieves all ads.
$query = "SELECT campaign.name, ad_group.name, "
. "ad_group_ad.ad.responsive_display_ad.marketing_images, "
. "ad_group_ad.ad.app_ad.images, ad_group_ad.ad.app_ad.youtube_videos, "
. "ad_group_ad.ad.responsive_display_ad.youtube_videos, ad_group_ad.ad.local_ad.videos, "
. "ad_group_ad.ad.video_responsive_ad.videos, ad_group_ad.ad.video_ad.media_file, "
. "ad_group_ad.ad.app_engagement_ad.images, ad_group_ad.ad.app_engagement_ad.videos, "
. "ad_group_ad.ad.display_upload_ad.media_bundle, ad_group_ad.ad.gmail_ad.product_images, "
. "ad_group_ad.ad.gmail_ad.product_videos, ad_group_ad.ad.gmail_ad.teaser.logo_image, "
. "ad_group_ad.ad.image_ad.image_url, ad_group_ad.ad.legacy_responsive_display_ad.square_marketing_image, "
. "ad_group_ad.ad.local_ad.marketing_images, ad_group_ad.ad.responsive_display_ad.logo_images, "
. "ad_group_ad.ad.responsive_display_ad.square_logo_images, "
. "ad_group_ad.ad.responsive_display_ad.square_marketing_images, "
. "ad_group_ad.ad.responsive_display_ad.youtube_videos, "
. "metrics.impressions, campaign.campaign_budget, campaign.status, "
. "campaign.start_date, campaign.end_date, metrics.all_conversions, "
. "metrics.average_cost, ad_group_ad.ad.type, ad_group_ad.ad.id, "
. "campaign.campaign_budget, metrics.cost_micros, ad_group_ad.status, metrics.impressions "
. "FROM ad_group_ad "
. "WHERE segments.date >= '{$this->from}' AND segments.date <= '{$this->to}' "
. "ORDER BY campaign.name ASC";
// Issues a search stream request.
/** #var GoogleAdsServerStreamDecorator $stream */
$stream = $googleAdsServiceClient->search($customerId, $query, ['pageSize' => 10]);
$ads = [];
foreach ($stream->iterateAllElements() as $googleAdsRow) {
dump($googleAdsRow->serializeToJsonString());
/** #var GoogleAdsRow $googleAdsRow */
$ads[] = json_decode($googleAdsRow->serializeToJsonString(), true);
}
As you see the pageSize is set to 10, so it will be 23 pages, because I have 230 ads.
How can I do the pagination, now the $stream returns all ads in one response. How can return only 10 ads, and then when user click for example second page button, it will return the next 10 ads, and so on?
Thanks in advance!
here is how it can be done in Python though -
import sys
from google.ads.googleads.client import GoogleAdsClient
from google.ads.googleads.errors import GoogleAdsException
client = GoogleAdsClient.load_from_storage()
ga_service = client.get_service("GoogleAdsService")
search_request = client.get_type("SearchGoogleAdsRequest")
try:
search_request.query = QUERY_STRING
search_request.customer_id = CUSOMER_ID
search_request.page_size = PAGE_SIZE
df = pd.DataFrame()
while True:
response = ga_service.search(search_request)
dictobj = MessageToDict(response._pb)
df = df.append(pd.json_normalize(dictobj,record_path=['results']))
if response.next_page_token == '':
break
else:
search_request.page_token = response.next_page_token
except GoogleAdsException as ex:
print(ex)
To achieve pagination, you may slightly change the display.
Say, if you want to display 10 records per page, so for the 2nd page, it will be
records 11 to 20.
So , to display page 2, you may revising the part :
foreach ($stream->iterateAllElements() as $googleAdsRow) {
dump($googleAdsRow->serializeToJsonString());
/** #var GoogleAdsRow $googleAdsRow */
$ads[] = json_decode($googleAdsRow->serializeToJsonString(), true);
}
to
$index=0;
foreach ($stream->iterateAllElements() as $googleAdsRow) {
$index++;
if ($index >=11 && $index <=20) {
dump($googleAdsRow->serializeToJsonString());
/** #var GoogleAdsRow $googleAdsRow */
$ads[] = json_decode($googleAdsRow->serializeToJsonString(), true);
}
}
Please see whether the above works, and if so, you may amend the codes to show the data according to page number
Google Ads API provides native pagination that as of now is not very well documented. However, you can only paginate by "next" and "previous" pages.
Here is a working example on keywords since that's the use case most people probably get stuck upon.
$googleAdsServiceClient = $googleAdsClient->getGoogleAdsServiceClient();
$query =
'SELECT ad_group.id, '
. 'ad_group_criterion.type, '
. 'ad_group_criterion.criterion_id, '
. 'ad_group_criterion.keyword.text, '
. 'ad_group_criterion.keyword.match_type '
. 'FROM ad_group_criterion '
. 'WHERE ad_group_criterion.type = KEYWORD';
// Get the stream
$stream = $googleAdsServiceClient->search($customerId, $query, ['pageSize' => 1000]);
// Get the first page
$page = $stream->getPage();
foreach ($page->getIterator() as $googleAdsRow) {
// Iterating over the first page of 1000 keywords.
}
// Get the next page token
$nextPageToken = $page->getNextPageToken();
// Get the second page
$page = $stream->getPage();
$stream = $googleAdsServiceClient->search($customerId, $query, ['pageSize' => 1000, 'pageToken' => $nextPageToken]);
foreach ($page->getIterator() as $googleAdsRow) {
// Iterating over the second page of 1000 keywords.
}
Note that you have to use search() and not searchStream() and iterator of the actual page instead of iterateAllElements()

How to get attribute values of an object stored in $_SESSION?

I have this code that store a "student" object in $_SESSION:
if(isset($_POST["name"]) && isset($_POST["note"]) && isset($_POST["year"]))
{
$nom = $_POST["name"];
$note = $_POST["note"];
$session = $_POST["year"];
$vec = array("name" => $name, "note" => $note, "year" => $year);
$_SESSION["students"][] = $vec;
echo "The student has been added.<br><br>";
}
Then I have this code in another page:
function calculateAverage()
{
$av = 0;
$count = 0;
foreach($_SESSION['students'] as $student)
{
$av = $av + $student["note"];
$count = $count + 1;
}
return $av / $count;
}
function bestNote()
{
//$best = array_search(max())
return $best;
}
function worstNote()
{
$worst = min(array_search(["note"], $_SESSION['students']));
return $worst;
}
if(isset($_SESSION['students']))
{
echo "The average note of the group is = " . calculateAverage() . "\n";
echo "The one with the best note is " . bestNote()["name"] . " is " . hauteNote()["note"] . " points.\n";
echo "The one with the worst note is " . worstNote()["name"] . " with " . basseNote()["note"] . " points.\n";
}
As you can see, it is not finished. What I want to do is to be able to get the note of a student that is stored in $_SESSION["students"]. How can I do this?
Thanks for answers.
you can access the stored values within a nested array like so:
$studentNote = $_SESSION["students"][YourActiveStudent]["note"];
However, you are currently not adding but overwriting data. Use array_push() to add data to an array (your students).
And when adding a student to the array, make sure to give it a name to make it associative so you can simply "call a student":
$_SESSION["students"][$nom] = $vec;
this way, if the $nom was "Max", you could say
$_SESSION["students"]["Max"]["note"]
to get Max's note (BTW, I assume you are talking about grades or marks, rather than notes?)

PHP- Google Api getting goal completed amount

Im using this code from google api
I am getting all of the goals names and number
But I cant see a way to get the goal completed amount
This is what I get:
Account ID = xxx
Web Property ID = xxx
Internal Web Property ID = xxx
Profile ID = xxx
Goal Number = 1
Goal Name = Open User (MT Register)
Goal Value = 0
Goal Active = 1
Goal Type = URL_DESTINATION
Created = 2012-07-22T10:20:02.183Z
Updated = 2012-08-15T12:43:06.045Z
Goal URL = /04_thankyou.php
Case Sensitive =
Match Type = REGEX
First Step Required = 1
Destination Goal Steps
Step Number = 1
Step Name = abc
Step URL = /01_insert_phone.php
Step Number = 2
Step Name = abcd
Step URL = /02_progress.step
Step Number = 3
Step Name = abcde
Step URL = /03_insert_pincode.php
This is the code:
function getEventDetailsHtml(&$details) {
$html = '<h4>Event Goal</h4><pre>' .
'Use Event Value = ' . $details->getUseEventValue();
// Get all the event goal conditions.
$conditions = $details->getEventConditions();
foreach ($conditions as &$condition) {
$html .= "Event Type = $condition->getEventType()";
$eventType = $condition->getType();
if ($condition->getType() == 'VALUE') {
// Process VALUE.
$html .= "Comparison Type = $condition->getComparisonType()" .
"Comparison Value = $condition->getComparisonValue()";
} else {
// Process CATEGORY, ACTION, LABEL.
$html .= "Match Type = $condition->getMatchType()" .
"Expression = $condition->getExpression()";
}
}
return $html . '</pre>';
}
function getVisitNumPagesDetailsHtml(&$details) {
$html = '<h4>Visit Num Pages Goal</h4>';
$html .= <<<HTML
<pre>
Comparison Type = {$details->getComparisonType()}
Comparison Value = {$details->getComparisonValue()}
</pre>
HTML;
return $html;
}
function getVisitTimeOnSiteDetailsHtml(&$details) {
$html = '<h4>Visit Time On Site Goal</h4>';
$html .= <<<HTML
<pre>
Comparison Type = {$details->getComparisonType()}
Comparison Value = {$details->getComparisonValue()}
</pre>
HTML;
return $html;
}
function getUrlDestinationDetailsHtml(&$details) {
$html .= <<<HTML
<pre>
Goal URL = {$details->getUrl()}
Case Sensitive = {$details->getCaseSensitive()}
Match Type = {$details->getMatchType()}
First Step Required = {$details->getFirstStepRequired()}
</pre>
HTML;
$html .= '<h4>Destination Goal Steps</h4>';
$steps = $details->getSteps();
if (count($steps) == 0) {
$html .= '<p>No Steps Configured</p>';
} else {
foreach ($steps as &$step) {
$html .= <<<HTML
<pre>
Step Number = {$step->getNumber()}
Step Name = {$step->getName()}
Step URL = {$step->getUrl()}
</pre>
HTML;
}
}
return $html;
}
require_once 'google_api.php';
if (isset($_SESSION['token'])) {
$client->setAccessToken($_SESSION['token']);
}
if (!$client->getAccessToken()) {
$authUrl = $client->createAuthUrl();
print "<a class='login' href='$authUrl'>Connect Me!</a>";
} else {
$analytics = new Google_AnalyticsService($client);
try {
$goals = $analytics->management_goals
->listManagementGoals('25788360',
'UA-25788360-20',
'~all');
} catch (Exception $e) {
print 'There was a general API error '
. $e->getCode() . ':' . $e->getMessage();
}
$html = '';
$items = $goals->getItems();
foreach ($items as &$goal) {
$html .= "
<pre>
Account ID = {$goal->getAccountId()}
Web Property ID = {$goal->getWebPropertyId()}
Internal Web Property ID = {$goal->getInternalWebPropertyId()}
Profile ID = {$goal->getProfileId()}
Goal Number = {$goal->getId()}
Goal Name = {$goal->getName()}
Goal Value = {$goal->getValue()}
Goal Active = {$goal->getActive()}
Goal Type = {$goal->getType()}
Created = {$goal->getCreated()}
Updated = {$goal->getUpdated()}
</pre>";
// Now get the HTML for the type of goal.
switch($goal->getType()) {
case 'URL_DESTINATION':
$html .= getUrlDestinationDetailsHtml(
$goal->getUrlDestinationDetails());
break;
case 'VISIT_TIME_ON_SITE':
$html .= getVisitTimeOnSiteDetailsHtml(
$goal->getVisitTimeOnSiteDetails());
break;
case 'VISIT_NUM_PAGES':
$html .= getVisitNumPagesDetailsHtml(
$goal->getVisitNumPagesDetails());
break;
case 'EVENT':
$html .= getEventDetailsHtml(
$goal->getEventDetails());
break;
}
echo $html;
}
It seems like you are using the Management API. This is meant for management purposes only. Getting and setting goals.
If you want data from goals as well you want to be looking at the Core Reporting API.
The available data for goals can be found here:
https://developers.google.com/analytics/devguides/reporting/core/dimsmets/goalconversions
The implementation guide can be found here:
https://developers.google.com/analytics/devguides/reporting/core/v3/coreDevguide
I did not provide a full implementation example seeing that you already know how to setup the use of a Google API.
Good luck with you quest!
EDIT:
Added an example on how to use it:
<?php
$client = new apiAnalyticsService();
function queryCoreReportingApi() {
$optParams = array( //OPTINAL SETTINGS
'dimensions' => '', //A comma-separated list of Multi-Channel Funnels dimensions. E.g., 'mcf:source,mcf:medium'. (string)
'sort' => '', //A comma-separated list of dimensions or metrics that determine the sort order for the Analytics data. (string)
'filters' => '', //A comma-separated list of dimension or metric filters to be applied to the Analytics data. (string)
'start-index' => '', //An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter. (integer, 1+)
'fields' => '', //Selector specifying which fields to include in a partial response.
'max-results' => '25'); //The maximum number of entries to include in this feed. (integer)
return $service->data_mcf->get(
$id, //Unique table ID for retrieving Analytics data. Table ID is of the form ga:XXXX, where XXXX is the Analytics profile ID. (string)
'2010-01-01', //Start date for fetching Analytics data. All requests should specify a start date formatted as YYYY-MM-DD. (string)
'2010-01-15', //End date for fetching Analytics data. All requests should specify an end date formatted as YYYY-MM-DD. (string)
'ga:totalConversions', //A comma-separated list of Multi-Channel Funnels metrics. E.g., 'mcf:totalConversions,mcf:totalConversionValue'. At least one metric must be specified. (string)
$optParams);
}

Categories