Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

A PHP library for reading a website visitor's referral source information (e.g. what ad campaign, keywords a user clicked to come to my website) from their Google Analytics cookie.

License

RJMetrics/referral-grabber-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

referral-grabber-php

DEPRECATED: this library does not work with installs of Google Analytics using "Universal Analytics"

A PHP library for reading a website visitor's referral source information (e.g. what ad campaign, keywords a user clicked to come to my website) from their Google Analytics cookie. Useful for saving this information when, for example, a new user signs up on your website, to later analyze your customer acquisition channels.

Usage

The Google Analytics tracking script must be installed on the site making the request. See the documentation for more information on the proper installation of Google Analytics.

Include ReferralGrabber.php in your PHP code, and then call $data = ReferralGrabber::parseGoogleCookie($_COOKIE['__utmz']);

The returned $data array will be a map of the keys source, medium, term, content, campaign, gclid and their respective values.

Recommendations

Save all of these referrer parameters in your users table. See our blog post about building a killer marketing dashboard using this data at http://blog.rjmetrics.com/?p=855.

Acknowlegements

Thanks to Justin Cutroni for laying the groundwork for this code here http://cutroni.com/blog/2009/03/18/updated-integrating-google-analytics-with-a-crm/.

Terms

See LICENSE file for terms of using this library.

RJMetrics retains creative control, spin-off rights, and theme park approval for Mr. Referral Grabber, Baby Referral Grabber, and any other Referral Grabber family character that might eminate therefrom.

About

A PHP library for reading a website visitor's referral source information (e.g. what ad campaign, keywords a user clicked to come to my website) from their Google Analytics cookie.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages