@r2u/analytics
TypeScript icon, indicating that this package has built-in type declarations

4.3.3 • Public • Published

Analytics

Real-time data processing analytics

Based on https://www.youtube.com/watch?v=2SX0yZ902_Y

Events

  • click: user clicked on the viewer;
  • like: thumbs up on feedback;
  • dislike: thumbs down on feedback;
  • fallback: user doesn't have a compatible device;
  • impression: call-to-action appeared on the screen;
  • interaction_duration: time spent interacting with either viewer, AR or customizer;
  • page_view: SDK loaded;
  • product_page_view: product page was initialized;
  • session_start: SDK loaded.

Deprecated

  • ar_session_duration: AR session duration;

Example

// initalize
const analytics = new Analytics({
  dataLayerIntegration: true,
  gcpAnalyticsUrl: 'https://www.foobar.com.br',
})
// set dimension values
analytics.set('sku', 'RE000001')
// send event that triggers at most once per session
analytics.send({
  event: analytics.events.impression,
  data: { [analytics.dimensions.placement]: 'ar_viewer' },
  scope: 'session'
})
// send event that triggers every time
analytics.send({
  event: analytics.events.click,
  data: { [analytics.dimensions.placement]: 'ar_viewer' }
})

Dependencies (5)

Dev Dependencies (30)

Package Sidebar

Install

npm i @r2u/analytics

Weekly Downloads

46

Version

4.3.3

License

none

Unpacked Size

19.4 kB

Total Files

10

Last publish

Collaborators

  • joseborinr2u
  • aviggiano