In my company we decided to use Google Analytics to get some intersting metrics about visitors, entrance channels etc ...
I created a goal which is "triggered" when a visitor submit the contact form, everything work perfectly well and I even created a segment to preview the difference between people who use the form and the others.
Using the PHP API, i have my own dashboard table giving me some details about each session, one by one, with :
Below a screenshot from my dashboard, with a visitor who went to my website thought the homepage (first row), then submit the contact form (second row).
My own datas table from GA PHP API
But.. i do not manage to link those datas with my goal ! I tried metrics like :
(https://developers.google.com/analytics/devguides/reporting/core/dimsmets)
Whatever the metric I test (last column in my screnshot), the metric = 0 but I see completed goals in my Google Analytics dashboard for some of those sessions.
Is there something wrong ? Thanks for your help ;)
EDIT 01/10 - Below is my PHP code :
$optParams = array(
'dimensions' => 'ga:dimension3, ga:pagePath, ga:date, ga:adMatchedQuery, ga:hour',
'sort' => '-ga:date, -ga:hour',
//'filters' => 'ga:medium==organic',
'max-results' => '99999');
return $analytics->data_ga->get(
'ga:' . $profileId,
'30daysAgo',
'today',
'ga:pageviews, ga:goal2Completions ',
$optParams);
And this is one row from the result :
array(7) {
[0]=>
string(12) "John Cena" // ga:dimension3
[1]=>
string(32) "/financial-expertise.php" // ga:pagePath
[2]=>
string(8) "20170110" // ga:date
[3]=>
string(9) "(not set)" // ga:adMatchedQuery
[4]=>
string(2) "12" // ga:hour
[5]=>
string(1) "1" // ga:pageviews
[6]=>
string(1) "0" // ga:goal2Completions ??
}
As you would see, the key "6" is related to the "ga:goal2Completions" metrics and in the above array, I guess it should be at least "1" ?
OK after hours of research .. no solution. So I have edited my goal to be equal to an event and then change my report to extract event. That works. Thx for your help!