Created
August 15, 2011 07:33
-
-
Save tordans/1145854 to your computer and use it in GitHub Desktop.
Script to track secondary domain redirects.
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
<?php | |
// Usage: | |
// - Configure your secondary domain to open this file/folder. | |
// - The file will redirect to your primary domain with tracking prameters (Google Analytics used below) | |
// - Optional: Use those tracking parameters in your primary domain's index-file to set an additional tracking-snippet. See example for details. This step is necessary for stayscout since we use eTracker which does not support campaign-tracking by URL but only by calling a script after the page has been rendered. | |
// Example: | |
// http://staiscout.de -> redirects to https://stayscout.de/?utm_source=tippfehlerdomain&utm_medium=staiscout-de and adds this JS+jQuery-code at the end of the body-tag for etracker: | |
// <!-- Tippfehlerdomain-Tracking --> | |
// <script type='text/javascript'> | |
// $(function() { ET_Event.eventStart('Tippfehlerdomain', '', 'staiscout-de', ''); }); | |
// </script> | |
header("Location: http://stayscout.de/?utm_source=tippfehlerdomain&utm_medium=" . str_replace(".", "-", $_SERVER["HTTP_HOST"]),TRUE,301); | |
// Help: 301 Moved Permanently - http://us3.php.net/manual/de/function.header.php#78470 | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment