Created
August 21, 2013 16:38
-
-
Save underdown/6296854 to your computer and use it in GitHub Desktop.
include distinct analytics tags by referrer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $allowed_host = 'd3cream.com'; | |
| $host = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST); | |
| if(substr($host, 0 - strlen($allowed_host)) == $allowed_host) { | |
| include('analytics-d3.php'); | |
| } else { | |
| include('analytics.php'); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is pretty dangerous unless you control the referrer you are checking. Referrer sniffing is fraught with peril. (https etc)