open-index/open-npm huggingface dataset:
npm package: @r2u/analytics
Description: Real-time data processing analytics
Latest version: 4.3.3

# 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

```javascript
// 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' }
})