I know it's possible to get the previous url of the visitor with
$ _SERVER ['HTTP_REFERER'];
but how do I get the source/medium that the visitor was before accessing the site?
For example if the visitor came from: Google/Organic, Google/CPC (paid), Bing/Organic, Bing/CPC, Direct/none, facebook/referral, youtube/referral, otherSites.com/referral, etc.
Thanks