Eventvisor

Workflow

Projects

An Eventvisor project is ideally a separate repository from your application(s), where you manage various entities like events, attributes, and destinations.

Creating a project

The easiest way is to use the Eventvisor CLI through npx (Node.js).

Create a new project directory first:

Command
$ mkdir my-project
$ cd my-project

And inside the newly created directory, initialize an Eventvisor project:

Command
$ npx @eventvisor/cli init

The default scaffold uses YAML. You can also start from a complete reference project:

npx @eventvisor/cli init --project=demo
npx @eventvisor/cli init --project=no-environments
npx @eventvisor/cli init --project=environments
npx @eventvisor/cli init --project=test-environments

Reference projects

The public repository contains several projects that can be explored directly or used by eventvisor init:

ProjectPurpose
project-demoE-commerce storefront and checkout example with Targets, routing, transforms, effects, and matrix tests
project-no-environmentsSmall standalone starter without Sets
project-environmentsDevelopment, staging, and production modeled as Sets
project-test-environmentsEnvironment-specific routing and matrix test examples
project-ymlYAML definitions
project-jsonJSON definitions
project-monorepoIndependently configured projects in an npm workspace

project-1 is the larger internal conformance project. It is useful when looking for advanced definitions, but project-demo is the better learning-oriented starting point.

Installation

Afterwards, install the dependencies:

Command
$ npm install

Platform agnostic usage

While Eventvisor CLI itself depends on Node.js, your applications do not need to.

The idea is that an Eventvisor project will generate datafiles (static JSON files), which will later be consumed by applications using SDKs in different programming languages which do not need to have any ties to Node.js in any way.

The JavaScript SDK covers browser, Node.js, React, and React Native applications. The Java SDK supports JVM applications using the same runtime contract.

Directory structure

Command
$ tree .
.
├── attributes/
│   ├── country.yml
│   ├── deviceId.yml
│   └── userId.yml
├── datafiles/ (generated later)
│   ├── eventvisor-web.json
│   └── eventvisor-storefront.json
├── destinations
│   └── browser.yml
├── events
│   └── pageView.yml
├── eventvisor.config.js
├── package.json
├── schemas
│   └── identifier.yml
├── targets
│   └── storefront.yml
└── tests
├── destinations
│   └── browser.spec.yml
└── events
└── pageView.spec.yml

Project configuration

  • eventvisor.config.js: contains your project configuration. Learn more in Configuration page.

Building blocks

These are the directories where you will be defining all the building blocks for managing the project:

  • attributes/: contains all your attribute definitions
  • destinations/: contains all your destination definitions
  • events/: contains all your event definitions
  • effects/: contains all your effect definitions
  • schemas/: contains reusable Schema definitions shared by events and attributes
  • targets/: contains dependency-aware Target selections for focused datafiles
  • tests/: contains all your test specs against your attributes, events, destinations, and effects

Output

  • datafiles/: contains all your generated datafiles, which are meant to be consumed by SDKs in your applications

Git repository

While it is intended that an Eventvisor project should be hosted in a separate standalone Git repository, it is not a strict requirement.

Command
$ git init
$ git add .
$ git commit -m "Initial commit"

You can still use the CLI to manage your project without a Git repository, or as part of your larger application codebase (think a monorepo setup).

However, it is highly recommended to use a standalone Git repository to keep track of your changes and collaborate with others. Keeping it separate from your application codebase allows you to your configuration changes from your application code deployments.

Multiple projects

If you wish to have multiple Eventvisor projects in a single Git repository, refer to the guide in monorepo page.

Previous
Diagnostics