Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

pressly/metrixjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

metrix.js

Install

$ yarn

Development

$ make run

This will start the metrix debug application at ./src/debug running on http://localhost:4000/

Usage

// Pressly app version in the form ':platform-:version' - for example,
//
//    blue suede: 'webapp-v4.6.0'
// native mobile: 'mobile-v5.0.0'
//         embed: 'embed-v2.0.0'
let APP_VERSION = 'webapp-v4.6.0'

// Metrix is thet tracker that will send events to the Pressly API (SERVER_HOST).
let PMX
if (__SSR__) {
  PMX = new MetrixNoop(SERVER_HOST, APP_VERSION)
}else {
  PMX = new Metrix(SERVER_HOST, APP_VERSION)
}
window.PMX = PMX

// Track events in your application, in the form: event(MODULE, EVENT, PAYLOAD)
// See src/proto.js for a list of supported modules and events.
PMX.track.event('HUB', 'VIEW', { hub_id:1 })
PMX.track.event('HUB_SPOTLIGHT', 'VIEW', { hub_id:1, post_id:1 })

Distribution build

$ make dist

see distribution build at dist/metrix.js