event-tracking.js 328 B

12345678910111213
  1. import { postJSON } from './fetch-json'
  2. export function send(category, action, label, value) {
  3. if (typeof window.ga === 'function') {
  4. window.ga('send', 'event', category, action, label, value)
  5. }
  6. }
  7. export function sendMB(key, body = {}) {
  8. postJSON(`/event/${key}`, { body }).catch(() => {
  9. // ignore errors
  10. })
  11. }