Skip to content

Instantly share code, notes, and snippets.

@kohiomobz
Last active August 9, 2016 06:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kohiomobz/7598c0df81582f5ff4cc to your computer and use it in GitHub Desktop.
Save kohiomobz/7598c0df81582f5ff4cc to your computer and use it in GitHub Desktop.
Keeping Production Data Clear
var productionHost = 'Your production Domain'; /* www.mixpanel.com */
var devToken = 'Development Token';
var prodToken = 'Production Token';
/* If the hostname is anything other than your production domain, initialize the Mixpanel library with your Development Token */
if (window.location.hostname.toLowerCase().search(productionHost) < 0) {
mixpanel.init(devToken);
} else {
mixpanel.init(prodToken);
}
@phivk
Copy link

phivk commented Jul 31, 2014

that should be "window.location.hostname" with lowercase "n"

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