Skip to content

Instantly share code, notes, and snippets.

@jbwyme
Created February 28, 2015 01:32
Show Gist options
  • Save jbwyme/9276d76efaa671b2531a to your computer and use it in GitHub Desktop.
Save jbwyme/9276d76efaa671b2531a to your computer and use it in GitHub Desktop.
PHP super properties for utm params
// 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