Last active
December 17, 2015 01:58
-
-
Save outmost/5531902 to your computer and use it in GitHub Desktop.
Example Boomerang custom variables with PHP to get request IP and User Agent, javascript to get domain.
This file contains 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
/* http://lognormal.github.io/boomerang/doc/howtos/howto-5.html */ | |
<script type="text/javascript"> | |
BOOMR.init({ | |
beacon_url: "http://yoursite.com/path/to/beacon" | |
}); | |
var domain = location.hostname; | |
BOOMR.addVar({ | |
"ip": "<? | |
if (getenv("HTTP_CLIENT_IP")) | |
$ip = getenv("HTTP_CLIENT_IP"); | |
else if(getenv("HTTP_X_FORWARDED_FOR")) | |
$ip = getenv("HTTP_X_FORWARDED_FOR"); | |
else if(getenv("REMOTE_ADDR")) | |
$ip = getenv("REMOTE_ADDR"); | |
else | |
$ip = "UNKNOWN"; | |
echo "$ip"; | |
?>", | |
"user_agent": "<? | |
$browser_type = getenv("HTTP_USER_AGENT"); | |
echo "$browser_type"; | |
?>", | |
"domain": domain | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment