Origin - Visitor’s media

Asked

Viewed 57 times

0

I know it’s possible to get the visitor’s previous url with $_SERVER['HTTP_REFERER']; but how do I take for example the source/media that the visitor was before accessing the site?

For example, it came from: Google/Organic, Google/CPC (paid), Bing/Organic, Bing/CPC, Direct/None, facebook/referral, youtube/referral, other sites/referral, etc .

I appreciate help

  • What you call "source/media" that is not in the referrer?

  • @Bacco thanks for the contribution. I found the solution, I created an answer

1 answer

-1


I found the solution on Github: Google Analytics Cookie Parser PHP

Basically I must parse some Google Analytics cookies, for example utma and the umtz, and access the information I need

For utma

$utma->time_of_first_visit; // DateTime
$utma->time_of_last_visit; // DateTime
$utma->time_of_current_visit; // DateTime
$utma->session_count // Integer

For utmz

$utmz->timestamp; // DateTime
$utmz->session_count // Integer
$utmz->campaign_number // Integer
$utmz->source // string
$utmz->medium // string
$utmz->campaign // string
$utmz->term // string
$utmz->content // string

Browser other questions tagged

You are not signed in. Login or sign up in order to post.