Type safe code, unit tests and CI
Avo in the CI

Avo in CI/CD

The Avo CLI includes a command, avo status , which you can use ad-hoc or run in your CI to monitor that all expected analytics events are in fact implemented in your code.

What is avo status ?

When you implement your analytics events with Avo Codegen, aka the type-safe analytics wrappers, you can run avo status to check where in your code base the analytics calls are made, or if they are missing.

How does avo status work?

  • avo status runs through your code base, searches for instances Avo Codegen, and returns an error if there is no found instance of one or more of the analytics events that are marked as "Implement with Codegen" for this code base.
  • avo status searches in the folder where it's invoked and in the children subfolders. It requires Avo to be initialized in that folder, i.e. your avo.json file should be there.
  • It validates tracking calls implemented with Avo Codegen, aka the Avo generated type-safe analytics wrappers.
  • It will error if no instance of the event is found in your code. This means two things:
    1. It will not error if one tracking call instance is removed for a specific event, but there are still some tracking calls for this event remaining
    2. It will not error if the tracking call remains in a dead code path
> avo status
info Currently on branch 'main'
└─ java android (musicplayerexample/src/main/java/sh/avo/Avo.java)
   ├─ appOpened
     └─ used in musicplayerexample/src/main/java/app/avo/musicplayerexample/MusicPlayerExampleApplication.kt: 1 time
   ├─ login
     └─  no usage found
   ├─ logout
     └─  no usage found
   ├─ pause
     └─ used in musicplayerexample/src/main/java/app/avo/musicplayerexample/ExampleMusicPlayerActivity.kt: 1 time
   ├─ play
     └─ used in musicplayerexample/src/main/java/app/avo/musicplayerexample/ExampleMusicPlayerActivity.kt: 3 times
   ├─ playNextTrack
     └─ used in musicplayerexample/src/main/java/app/avo/musicplayerexample/ExampleMusicPlayerActivity.kt: 1 time
   └─ playPreviousTrack
      └─ used in musicplayerexample/src/main/java/app/avo/musicplayerexample/ExampleMusicPlayerActivity.kt: 1 time
info 5 of 7 events seen in code
error 2 missing events
└─ java android (musicplayerexample/src/main/java/sh/avo/Avo.java)
   ├─ login: no usage found
   └─ logout: no usage found

Get in touch if you want to learn more about how Avo prevents analytics errors.

Integrating Avo with my CI

💡 Why would I add Avo to my CI/CD?

Adding avo status to your CI/CD enables you to regression monitor your implementation (i.e. confirm you haven't accidentally refactored out an analytics trigger), as well as confirm that you've implemented every analytics event that should be implemented for a specific analytics release in a specific codebase.

Example: setting up avo status in GitHub Actions

Add this script to .github/workflows/avo_status.yml . It will take care of installing the Avo CLI and running the avo status check on your codebase every time new changes are pushed.

name: Avo Status
on: push
    runs-on: ubuntu-latest
        node-version: [16.x]
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
          node-version: ${{ matrix.node-version }}
      - name: Install Avo CLI
        run: npm install -g avo
      - name: Avo status
        run: avo status