Skip to content

Instantly share code, notes, and snippets.

@MikSDigital
Forked from walkergv/php-UA.php
Last active August 29, 2015 14:17
Show Gist options
  • Save MikSDigital/6dcd002695e450166b35 to your computer and use it in GitHub Desktop.
Save MikSDigital/6dcd002695e450166b35 to your computer and use it in GitHub Desktop.
<?
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'http://www.google-analytics.com/collect?v=1&tid=[UA-XXXXXXXXX-1]&cid=[RANDOM_INTEGER_OR_GUID]&t=event&ec=[EVENT_CATEGORY]&ea=[EVENT_ACTION]&el=[EVENT_LABEL]',
CURLOPT_USERAGENT => 'Vanity-URL-Tracker',
));
$resp = curl_exec($curl);
curl_close($curl);
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.reddit.com/");
?>
@MikSDigital
Copy link
Author

Google analytics with 301 redirect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment