UNPKG

@mailbiz/javascript-tracker

Version:
72 lines (49 loc) 2.18 kB
# Mailbiz JavaScript Tracker [![npm version][npm-image]][npm-url] [![License][license-image]](LICENSE) Add Mailbiz Tracking to your website via a tag solution. ## Maintainer quick start Part of the Mailbiz JavaScript Tracker monorepo. Build with [Node.js](https://nodejs.org/en/) (12 LTS or 14 LTS) and [Rush](https://rushjs.io/). ### Setup repository ```bash npm install -g @microsoft/rush git clone https://github.com/Mailbiz/Mailbiz.Tracker.Javascript.git rush update ``` ## Select your version This repository creates two versions of the tracker. The fully featured `tracker.js` contains the majority of the plugins included within this repository for a complete tracking experience. ## Installation Add the tag to your website or Tag Management solution: ```html <script type="text/javascript" async=1> ;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalMBZNamespace=p.GlobalMBZNamespace||[]; p.GlobalMBZNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments) };p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1; n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","{{URL to tracker.js}}","mbtrack")); </script> <script> window.mbtrack('newTracker', 'sp', collector_endpoint, { appId: 'my-app', eventMethod: 'post', contexts: { performanceTiming: true, }, }); </script> ``` We advise you host `tracker.js` yourself, and rename it. However if you'd like use a CDN, you'll find the tracker on jsDelivr, unpkg and cdnjs. ## Usage ```js window.mbtrack('enableLinkClickTracking'); window.mbtrack('trackPageView', { title: 'My Title' }); ``` ## Copyright and license Licensed and distributed under the [BSD 3-Clause License](LICENSE) ([An OSI Approved License][osi]). Copyright (c) 2022 Mailbiz. All rights reserved. [npm-url]: https://www.npmjs.com/package/@mailbiz/browser-tracker [npm-image]: https://img.shields.io/npm/v/@mailbiz/browser-tracker [docs]: https://docs.mbtrackanalytics.com/docs/collecting-data/collecting-from-own-applications/javascript-tracker/ [osi]: https://opensource.org/licenses/BSD-3-Clause [license-image]: https://img.shields.io/npm/l/@mailbiz/javascript-tracker