Skip to main content

MixPanel Tracking

https://mixpanel.com/

MixPanel Tracking Code

Installation

The easiest way to install the MixPanel library is to load it from their CDN. Add this code snippet before the closing </head> tag in your HTML: Source: https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript

// Paste this right before your closing head tag
<script type="text/javascript">
(function (f, b) { if (!b.__SV) { var e, g, i, h; window.mixpanel = b; b._i = []; b.init = function (e, f, c) { function g(a, d) { var b = d.split("."); 2 == b.length && ((a = a[b[0]]), (d = b[1])); a[d] = function () { a.push([d].concat(Array.prototype.slice.call(arguments, 0))); }; } var a = b; "undefined" !== typeof c ? (a = b[c] = []) : (c = "mixpanel"); a.people = a.people || []; a.toString = function (a) { var d = "mixpanel"; "mixpanel" !== c && (d += "." + c); a || (d += " (stub)"); return d; }; a.people.toString = function () { return a.toString(1) + ".people (stub)"; }; i = "disable time_event track track_pageview track_links track_forms track_with_groups add_group set_group remove_group register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking start_batch_senders people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user people.remove".split( " "); for (h = 0; h < i.length; h++) g(a, i[h]); var j = "set set_once union unset remove delete".split(" "); a.get_group = function () { function b(c) { d[c] = function () { call2_args = arguments; call2 = [c].concat(Array.prototype.slice.call(call2_args, 0)); a.push([e, call2]); }; } for ( var d = {}, e = ["get_group"].concat( Array.prototype.slice.call(arguments, 0)), c = 0; c < j.length; c++) b(j[c]); return d; }; b._i.push([e, f, c]); }; b.__SV = 1.2; e = f.createElement("script"); e.type = "text/javascript"; e.async = !0; e.src = "undefined" !== typeof MIXPANEL_CUSTOM_LIB_URL ? MIXPANEL_CUSTOM_LIB_URL : "file:" === f.location.protocol && "//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//) ? "https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js" : "//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js"; g = f.getElementsByTagName("script")[0]; g.parentNode.insertBefore(e, g); } })(document, window.mixpanel || []);
</script>

Code

var app = new unda.App("shed-root", {
customer: "webshed"
});

// Use submitted form data here or trigger conversion.
app.addEventListener("form:submit", function(data) {
console.info(data);
});

// Initialize MixPanel
mixpanel.init('YOUR_PROJECT_TOKEN', {autocapture: true});

// Track events
app.on("track", function(e) {
mixpanel.track(e.event, e.props);
});

Events

The following events can be tracked with MixPanel:

EventDescriptionProperties
loadedFired when the app is loaded-
fn:loadFired when a function to load data is called-
fn:loadFromJsonFired when loading from JSON data-
btn:saveFired when save button is clicked-
btn:newFired when new button is clicked-
btn:loadFired when load button is clicked-
btn:printPdfFired when print PDF button is clicked-
btn:exportImageFired when export image button is clicked-
btn:fullScreenFired when full screen button is clicked-
btn:view:EditFired when switching to Edit view-
btn:view:PlanFired when switching to Plan view-
btn:view:FloorFired when switching to Floor view-
btn:shareFired when share button is clicked-
btn:zoom inFired when zoom in button is clicked-
btn:zoom outFired when zoom out button is clicked-
btn:quote:submitFired when quote submit button is clicked-
btn:quote:shareFired when quote share button is clicked-
btn:main:tabFired when a main tab is selected{tab: string} - Available tabs: Size, Awnings, Walls, Extras, Mezzanine, Colours, Objects & Quotes
btn:animationMode:OpenFired when animation mode is set to Open-
btn:animationMode:CloseFired when animation mode is set to Close-