function track($is_update = false) { $info = DMInstallHelper::getInfo(); $infoString = ''; foreach ($info as $key => $value) { if (!empty($infoString)) { $infoString .= ','; } $infoString .= "'" . $key . "' : '" . $value . "'"; } $event = $is_update ? 'DOCman Updates' : 'DOCman Installations'; echo "<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/mixpanel.js\" type=\"text/javascript\"%3E%3C/script%3E')); </script> <script type='text/javascript'> try { var mpmetrics = new MixpanelLib('0384351786a53939e8562a355ea21867'); } catch(err) { null_fn = function () {}; var mpmetrics = { track: null_fn, track_funnel: null_fn, register: null_fn, register_once: null_fn, register_funnel: null_fn }; } </script>"; echo "<script type=\"text/javascript\">mpmetrics.track('" . $event . "', {\r\n " . $infoString . "\r\n })</script>"; }