Add Custom Events

omnimetrix® allows you to capture different types of events and user interactions to gain valuable insights about user behavior.

event-tracking.html

omnimetrix('Purchase Completed', {
  meta: {
    product_id: 'ABC123',
    amount: '49.99'
  }
});

Basic Installation

Getting Started

To begin using omnimetrix® event tracking on your website, add the following script tag to your HTML document's <head> section:

<script defer src="https://track.omnimetrix.io/YOUR_IDENTIFICATION_CODE/pa.js"
  id="omnimetrixjs"
  data-code="YOUR_IDENTIFICATION_CODE"></script>

Replace YOUR_IDENTIFICATION_CODE with the unique identifier provided by omnimetrix® for your account.

Event Tracking Methods

Method 1: Using the Global omnimetrix() Function

After the script is loaded, a global omnimetrix() function becomes available for use in your code:

omnimetrix('User Signed Up');

omnimetrix('Purchase Completed', {
  meta: {
    product_id: 'ABC123',
    amount: '49.99',
    currency: 'USD'
  }
});

omnimetrix('Video Watched', {
  duration: 245,
  meta: {
    video_id: 'XYZ789',
    category: 'Tutorial'
  }
});

Method 2: Using HTML Attributes

Add event tracking directly to HTML elements using data attributes:

<button data-omnimetrix-event="Button Clicked">Click Me</button>

<button
  data-omnimetrix-event="Download Started"
  data-omnimetrix-meta-file_type="PDF"
  data-omnimetrix-meta-file_name="user_manual">
  Download Manual
</button>

You can also use the shortened syntax without the "data-" prefix for cleaner HTML.

Method 3: Using CSS Classes

Track events using CSS classes for a less intrusive approach:

<button class="btn omnimetrix-event=Button+Clicked">Click Me</button>
<a class="link omnimetrix-event=Resource+Downloaded omnimetrix-meta-type=PDF">
  Download Resource
</a>

Note: When using CSS classes, spaces in event names or metadata values should be replaced with + symbols.

Automatic Event Tracking

Page Views

Page views are tracked automatically when a user loads a page. This includes both initial page loads and navigation via the History API.

To disable automatic page view tracking:

<script defer src="https://track.omnimetrix.io/YOUR_IDENTIFICATION_CODE/pa.js"
  id="omnimetrixjs"
  data-code="YOUR_IDENTIFICATION_CODE"
  data-disable-page-views></script>

Outbound Links & File Downloads

Clicks on links that lead outside your domain are automatically tracked with the event name "Outbound Link Click". File downloads (PDF, ZIP, DOCX, etc.) are tracked as "File Download" events.

To customize event names or add file extensions:

data-outbound-link-event-name="External Navigation"
data-download-event-name="Resource Downloaded"
data-download-extensions="epub,mobi,azw3"

Use data-disable-outbound-links or data-disable-downloads to disable these features.

Advanced Configuration

Privacy Features

omnimetrix® provides several options to enhance user privacy:

data-disable-query
data-disable-referrer
data-disable-resolution

Ignoring & Redacting Elements

To prevent tracking on specific elements or redact sensitive information:

<div class="omnimetrix-ignore">
  <button>Private Button</button>
</div>

<div data-omnimetrix-redact>
  <p>Sensitive info: 123-456-7890</p>
</div>

Password, email, and telephone input fields are automatically redacted.

Session Tracking & Development

omnimetrix® sends periodic heartbeat signals to track user sessions (default: 60 seconds).

data-interval-ms="30000"
data-enable-sessions="false"
data-dev

By default, tracking is disabled on localhost. Use data-dev to enable during development.

Need help? Contact us at [email protected]
Free Early Access Limited to the first 250 Applicants

Get Early Access

Apply to get early access.