Created
February 28, 2015 01:32
-
-
Save jbwyme/9276d76efaa671b2531a to your computer and use it in GitHub Desktop.
PHP super properties for utm params
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
// assuming you have already imported the Mixpanel PHP library | |
$mp = Mixpanel::getInstance("MIXPANEL_PROJECT_TOKEN"); | |
// register every utm parameter as a super property | |
foreach($_GET as $param => $param_val) { | |
if (strstr($param, 'utm_') === 0) { | |
$mp->register($param, $param_val); | |
} | |
} | |
// track an event which will have the utm params as properties | |
$mp->track("button clicked"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment