@twipla/worker
v1.4.4
Published
TWIPLA Standalone Worker
Keywords
Readme
TWIPLA Worker
Integrates with TWIPLA - The Website Intelligence Platform
Variants
The TWIPLA Worker comes in 2 variants:
full- this is the default version, including all TWIPLA worker features (polls, heatmap screenshots, autotracking previewer, etc.)core- this is the lightest version possible, containing only core functionality: visits and recordings
The interface is the same, the only exception being the fact that the core version should be imported from @twipla/worker/core.
Installation
npm install @twipla/workerUsage examples
ESM
import { LogLevel, TwiplaWorker } from '@twipla/worker';
const twiplaWorker = new TwiplaWorker({
websiteId: 'your_website_id',
logLevel: LogLevel.ERROR,
env: 'production'
});or
<script type="module">
import { TwiplaWorker, LogLevel } from 'https://cdn.jsdelivr.net/npm/@twipla/[email protected]/lib/esm/library.js';
const twiplaWorker = new TwiplaWorker({
websiteId: 'your_website_id',
logLevel: LogLevel.ERROR,
env: 'production'
});
</script>IIFE
<script src="https://cdn.jsdelivr.net/npm/@twipla/[email protected]/lib/iife/library.js"></script>
<script>
const twiplaWorker = new Twipla.TwiplaWorker({
websiteId: 'your_website_id',
logLevel: Twipla.LogLevel.ERROR,
env: 'production'
});
</script>CJS
const { TwiplaWorker, LogLevel } = require('@twipla/worker/lib/cjs/library.js');
const twiplaWorker = new TwiplaWorker({
websiteId: 'your_website_id',
logLevel: Twipla.LogLevel.ERROR,
env: 'production'
});Track a visit
// without optional parameters
twiplaWorker.run();
// with optional parameters
twiplaWorker.run({ tags: { key: 'value' } });Track an event
twiplaWorker.sendEvent('event_category', 'event_action', 'event_label', 'event_value', 'event_extra_fields')Track an ecommerce event
twiplaWorker.sendEcom('','','')