Information:
I'm working on a phone-tracking project that uses the Google Analytics measurement protocol, that should do the following when finished:
- Add a event/hit to a goal in Google Analytics (predefined category/action)
- Add a conversion in Google Adwords
I'm Using the library:
Everything is setup according to php-ga-measurement-protocol, and it seems to be working - i can add event/hit to a goal in Google Analytics, without any problems.
But the problems comes when i'm asking Google Adwords to import the data(goals) from Google Analytics - it doesnt add any conversions - it says every hit just comes from "Direct/non".
Code:
$analytics = new TheIconic\Tracking\GoogleAnalytics\Analytics(true);
$analytics->setProtocolVersion('1')
->setHitType('event')
->setTrackingId($sGoogleAnalyticID)
->setClientId($sClientID)
->setEventCategory('MyEventCategory')
->setEventAction('MyAction')
->setEventValue(1)
->sendEvent();
I figured it made sense, since i'm not adding the UTM data, so i tried setting the UTM data on the $analytics object as seen below:
$analytics = new TheIconic\Tracking\GoogleAnalytics\Analytics(true);
$analytics->setProtocolVersion('1')
->setHitType('event')
->setTrackingId($sGoogleAnalyticID)
->setClientId($sClientID)
->setEventCategory('MyEventCategory')
->setEventAction('MyAction')
->setEventValue(1)
->setCampaignName($sUtmCampaign) //&utm_campaign=[xxxxx] - para name value is taken from
->setCampaignSource($sUtmSource) //&utm_source=[xxxxx] - para name value is taken from
->setCampaignMedium($sUtmMedium) //&utm_medium=[xxxxx] - para name value is taken from
->setCampaignContent($sUtmContent) //&utm_content=[xxxxx] - para name value is taken from
->sendEvent();
The Questsions:
- am i missing some parameter's?
- am i using the right values for the right parameter's?
- am i using the right lib, or should i use something else?
- should i even work with the goals in Google Analytics or should i use a Google Adwords API?
- is their a easier way to do it?
I would appreciate any help or if someone could point me in the right direction - i have used countless hours googling and trying stuff.