Using the Itly CLI

Setting Up Itly

Itly is Iteratively’s command line app. It works hand-in-hand with the Iteratively web app and enables developers to quickly and correctly instrument tracking code in their apps.

If you haven't already, install Node.js from nodejs.org/en/download/ or your favorite package manager (e.g. brew install node). Itly requires v8.2.0+ to work correctly.

Step 1: Install Itly

Please contact us to get access to the package.

Step 2: Log into Itly

Now that you have Itly installed, log in by running:

itly init

You'll be redirected to the browser and automatically logged in or prompted to enter your credentials. Itly will store your device-specific credentials in ~/.itlyrc.

Step 3: Pull down your Tracking Plan

Now that you’ve completed the Itly setup, you’re ready to pull down your tracking plan. Your tracking plan is defined in the Iteratively web application and pulled into your project’s code base in the form of type-safe auto-generated code. All code is stored in a single, human-readable file and imported/included as needed.

itly pull {source-name}

The pull command takes one argument: the name of the source that defines your project. For example, a source name might be ios, android, web, or backend. Sources are associated with a tracking plan and define a scope for the analytics events. The events tagged to a particular source will appear in the auto-generated code. Those that haven’t been tagged will not. This ensures that your event is tracked consistently on all the sources it’s applicable to.

The pull command will also tell you what, if anything, has changed since the last time you pulled your team's analytics spec. The changes are your automatically created TODO for getting your analytics tracking plan up-to-date.

As your project progresses, you and your team will inevitably make changes to your tracking plan. Iteratively will notify you when those changes are made and when you’re ready, you can pull down the changes and incorporate them into your project.

Step 4: Instrument your Product

Once you have pulled down the latest tracking plan, learn how to instrument your product by Interacting with the SDK.

Step 5: Verify the Instrumentation

To make sure you’re tracking all the events needed, and that you’re tracking those events correctly, Itly can lint your source code and warn you about any errors. For example, Itly can tell if you’ve forgotten to track any required events, or if you’re not passing along all required properties.

itly verify

The verify command will scan your source code for tracking calls and compare the results to what's expected per your team's tracking plan. If the command reports all green, you're all good!

You can configure your CI pipeline to automatically run the verify command at check-in so you never miss another analytics bug again.

Tracking Status

Iteratively can generate reports that can summarize the status of your analytics instrumentation. The reports serve as a one-stop-shop for understanding progress made, adherence to the tracking plan, and issues that will cause analytics data reliability or consistency problems downstream.

  • A red cross indicates the event is not yet instrumented for a given Source.
  • A green checkmark indicates the event has been instrumented for a given Source.

Hovering over the checkmark shows the exact location or locations in the source code the event is currently instrumented in.


Itly CLI Commands

itly init

Log into Iteratively and initialize your workspace.

USAGE
$ itly init

The init command logs you into your Iteratively account. It's the first command you'll run after installing Itly on your computer. You only need to run the command once.

itly pull

Pull down the latest tracking plan and generate a tracking library.

USAGE
$ itly pull <source>
OPTIONS
--path=path
EXAMPLES
$ itly pull web

Run this command in the root folder of your project. For example:

  • Browser & Node.js: the folder with your package.json
  • iOS: the folder with your Info.plist
  • Android: the folder with your {project-name}.iml

By default, your tracking library will be placed in:

PlatformDefault location
Browser./src/itly
Node.js./src/itly
iOS./Itly
Android./app/src/main/java/io/itly

To override the default location, pass the --path argument. Itly will remember your custom location and use it going forward.

itly pull web --path ./src/analytics

itly verify

Verify (lint) your source code for analytics.

USAGE
$ itly verify
OPTIONS
-u, --update=update update the tracking status online
-t, --token=token personal API token to authenticate with
EXAMPLES
$ itly verify
$ itly verify -u -t $ITLY_KEY

Run this command in the root folder of your project. The command will scan your source files, locate all calls to the Itly tracking library, and let you know which events are being tracked, and which have yet to be instrumented.

Include --update to update your company's tracking plan online and share the latest analytics implementation status with your team. Your teammates will be able to tell when events were first implemented, the last time they've been detected in the source code, and where exactly in the source code they are tracked.

itly export

Download a tracking plan from your workspace.

USAGE
$ itly export [<source>] [-f <path>] [-t <token>]
OPTIONS
-f, --file=file [default: schema.json] file path to export to
-t, --token=token personal API token to authenticate with
EXAMPLES
$ itly export ios
$ itly export -f schema.json

The export command exports your team's tracking plan into a JSON file (schema.json by default). Your team's event, context, identify, group, and page schemas will be included. Each item's schema is represented in the JSON Schema format.

itly import

Upload a tracking plan into your workspace.

USAGE
$ itly import [<path>]
OPTIONS
-f, --file=file [default: schema.json] file path to import from
-t, --token=token personal API token to authenticate with
EXAMPLES
$ itly import ios
$ itly import -f schema.json

The import command imports a tracking plan from a JSON file (schema.json by default) into your Iteratively account. Your team's online tracking plan will be updated to match.

For more details, visit Importing & Exporting.

itly help

Display help for Itly.

USAGE
$ itly help [command]

itly info

Display information about the Itly environment.

USAGE
$ itly info

The info command displays information about the currently logged in user.