Eventvisor

Use cases

Routing

Tracked events can be routed conditionally to multiple different destinations based on conditions in Eventvisor.

Challenges

It is not uncommon that some applications may use multiple third-party analytics services or own custom backend services for tracking events serving different purposes.

For example, a web application may have these events:

EventIntended destination
page_viewGA4
button_clickGoogle Tag Manager
experiment_activationOptimizely
image_load_errorSentry or Datadog

It can grow out of hand pretty quickly, especially for a fast evolving application with a lot of events involving multiple teams.

Eventvisor destinations

When using Eventvisor, we can define these destinations in a central place.

For example, we can define a destination called ga4 which will be used to track all the page_view events:

destinations/ga4.yml
description: GA4
tags:
- web
transport: ga4
conditions:
- source: eventName
operator: equals
value: page_view

We can also define a destination called gtm for Google Tag Manager which will be used to track all the button_click events:

destinations/gtm.yml
description: Google Tag Manager
tags:
- web
transport: gtm
conditions:
- source: eventName
operator: equals
value: button_click

Setting up transports

In our application, when initializing the SDK, we can set up the right modules so that destinations can use them as transports.

Install them first:

Command
$ npm install --save @eventvisor/module-ga4 @eventvisor/module-gtm

And then set them up when initializing the SDK:

your-app/index.js
import { createInstance } from "@eventvisor/sdk";
import { createGA4Module } from "@eventvisor/module-ga4";
import { createGTMModule } from "@eventvisor/module-gtm";
const eventvisor = createInstance({
datafile: { ... },
modules: [
createGA4Module(),
createGTMModule(),
],
});

Here, we set up two modules:

Learn more in modules page, so you can also create your own custom integrations with other first or third-party services.

Tracking events

Now it's just a matter of tracking the events from anywhere in the application, and the SDK will automatically handle the conditions and routing for you:

eventvisor.track("page_view", {
url: "https://www.example.com",
});

This will be routed to GA4 automatically.

Previous
Governance