Inside Mixpanel

Javascript Library updated, mpmetrics.js is now deprecated

Suhail Doshi

We would like to inform everyone that we’ve updated our Javascript client
library in favor of a new architectural design that became more necessary. The
primary change is that we need to change the way developers use the actual
mpmetrics object, many customers of ours also use widgets provided by
companies like Uservoice.com and because of the current implementation and due
to the fact that Uservoice is a customer of ours, the mpmetrics object gets
overriden and cuts off your metrics.

The change is simple, we now require developers to instantiate a brand-new
object called MixpanelLib which you can set to a variable called mpmetrics:

<script type="text/javascript">
try { var mpmetrics = new MixpanelLib("YOUR_TOKEN"); } catch(err) {}
</script>

You can download or source the new Javascript library at: http://api.mixpanel
.com/site_media/js/api/mixpanel.js

That’s it, really simple. You can continue to call mpmetrics like you always
have. We’re working with Uservoice to rename their variable mpmetrics to
something else so it does not conflict. This allows you to continue to inline
our javascript without overriding some one elses mpmetrics object and in the
future allows you to use multiple projects to log data to much more easily as
well.

If you have any questions or concerns, please email us at
support@mixpanel.com.

Get the latest from Mixpanel
This field is required.