• About
  • Pricing
  • FAQ
  • Docs
  • Login
  • Try Avo for free
  • About
  • Pricing
  • FAQ
  • Docs
  • Login
  • Try Avo for free

Data Validation

Table of Contents

Generating the custom tracking libraries

  • To get the code generated libraries you use the Avo CLI or copy the file from the Implement tab in the Avo UI
  • The libraries are constructed based on the event definitions in the web app,¬†that support the PM / analytics manager in defining consistent data structures.
  • Each development platform and programming language generate its own tracking library
    • For example iOS:Swift, iOS:Objective-C, Android:Kotlin, Web:React, etc.
  • The code generated libraries contain a function per each event, and the function performs data validation based on the event structure definition.
    • For example: A "Cart Updated" event with an "Item Count" property, would generate a function with the following signature in Swift:
      • cartUpdated(itemCount: Int)

To get started see our quickstart page.

Validating without code changes

For applications that already have tracking in place, Avo supports validation by providing a validateAvoEvent function. The function uses the custom generated tracking libraries to validate the existing event calls.

Follow these steps to get started:

  • Step 1: Enable the validateAvoEvent function in your desired source
    1. Go to the Connections tab in Avo
    2. Select the source you want to use the function in
    3. Turn on "Event validation function"
  • Step 2: Generate an Avo.js file with the validateAvoEvent function enabled.
  • Step 3: Import Avo where your analytics calls are passed through:
    const Avo = require('./Avo');
  • Step 4: Call Avo.validateAvoEvent with name of event and the event properties:
    if (ENVIRONMENT == 'dev') {
      // The validateAvoEvent should only be called in development
      Avo.validateAvoEvent({eventName, eventProperties, env: ENVIRONMENT});

Now all your analytics calls will be validated against the tracking plan defined in your Avo workspace and will feed the Avo health dashboard with reports about unexpected/invalid events and properties.

How Avo validates

  • For dynamically typed languages, the generated code runs validation when the function gets called, and logs warnings or errors if the data doesn't match the correct structure.
  • For statically typed languages, much of the validation happens on compile time, while value limitations¬†which cannot be expressed through type systems, yield runtime logs or warnings
    • For example limitations such as "this int should range between 1 and 5".
  • Validation logs and warnings are by default only sent in the development environment, not in production.
  • Strict mode validation can be enabled in development, which throws errors instead of logging them.

Get in touch if you want to learn more about Avo's data validation.