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
| mpmetrics.register({"account type": "pro", "ad" : "pepsi"}, "events"); |
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
| mpmetrics.register(properties, type, days); | |
| Required: | |
| @properties: A dictionary of properties in the usual format. {"key" : "value", "key2", "value2"} | |
| Optional: | |
| @type: The type of event to register these properties for | |
| "all": All data (DEFAULT) | |
| "events": Only events | |
| "funnels": Only funnels |
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
| mpmetrics.track('button click', {"user type": "noob", "gender": "male", "account type": "premium"}); |
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
| mpmetrics.track('button click'); |
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
| <script type="text/javascript"> | |
| function create_account() { | |
| ... | |
| mpmetrics.register({"account type": "premium"}); | |
| } | |
| </script> |
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
| <script type="text/javascript" src="http://mixpanel.com/site_media/js/api/mpmetrics.js"></script> | |
| <script type="text/javascript"> | |
| try { | |
| mpmetrics.init("YOUR_TOKEN"); | |
| mpmetrics.register({"user type": "noob", "gender": "male"}); | |
| } catch(err) {} | |
| </script> |
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
| require 'rubygems' | |
| require 'base64' | |
| require 'json' | |
| require 'active_support' | |
| # Adapted from the Python code here: http://mixpanel.com/api/docs/code/ | |
| class MixPanel | |
| # A simple function for asynchronously logging to the mixpanel.com API. | |
| # This function requires `curl`. |
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
| # This isn't perfect for high traffic sites, if you need something more production ready | |
| # please tell us or stay tuned as we will open it up shortly. | |
| import subprocess | |
| import base64 | |
| import simplejson | |
| def track(event, properties=None): | |
| """ | |
| A simple function for asynchronously logging to the mixpanel.com API. |
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 | |
| /* | |
| If you wish to do metric logging from your backend, the best method of doing this is to do it in | |
| a non-blocking way. This will let your pages continue to execute at about the same speed while | |
| logging metric data in the background. Please note: If you're on a shared host, you may be limited | |
| in logging metric data with a background process. | |
| Feel free to modify this code to your own environments liking | |
| */ | |
| class MetricsTracker { | |
| public $token; |
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
| <!-- First include the script: --> | |
| <script type="text/javascript"> | |
| var mp_protocol = (("https:" == document.location.protocol) ? "https://" : "http://"); | |
| document.write(unescape("%3Cscript src='" + mp_protocol + "api.mixpanel.com/site_media/js/api/mpmetrics.js' | |
| type='text/javascript'%3E%3C/script%3E")); | |
| </script> | |
| <!-- Initialize it with your project token --> | |
| <script type="text/javascript"> | |
| try { mpmetrics.init("YOUR_TOKEN");} catch(err) {} |