Skip to main content
Export router exposure data to your analytics platforms to measure the impact of different routes and variants on your KPIs.
Importing data from your analytics platforms is coming soon!

Mixpanel

Export router exposure data to your existing Mixpanel project for product analytics. When a user is exposed to a router, it is sent as an event to your Mixpanel project, including details on router, route, and variant — so you can build dashboards and analyze routing performance in Mixpanel.
1

Find your Mixpanel Project ID

In Mixpanel, navigate to Settings > Project Settings. In the Overview tab, find and copy your Project ID.
2

Create a service account

In Project Settings, go to the Service Accounts tab. Click Add Service Account.Type in the name of your new service account. Click the + button to create your new service account. Set the Project Role to Admin or Owner. Set Expires to Never.Click Add and copy the username and secret — you will not be able to view the secret again.
3

Configure the integration in Portal

In Portal, navigate to Data & Metrics and click Add Integration, then select Mixpanel. Enter the following:
FieldValue
Project IDYour Mixpanel project ID from Step 1
Service Account UsernameThe service account username from the Step 2
Service Account SecretThe service account secret from Step 2
Toggle Export to Mixpanel to on, then click Enable.
4

Make a request to your router

Now call the Chat Completions API with your router, populating the Mixpanel Distinct ID that corresponds to the user who this request is for in the user field when making the request:
curl --request POST \
  --url https://api.inworld.ai/v1/chat/completions \
  --header 'Authorization: Basic <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "inworld/my-router",
    "messages": [{"role": "user", "content": "Hello"}],
    "user": "<mixpanel-distinct-id>"
  }'
The router exposure data will match the user to the Mixpanel Distinct ID when creating events in Mixpanel, so you can tie the specific request to the right user.
5

View events in Mixpanel

The router exposure data will flow to your Mixpanel project automatically (data will sync every ~8 hours). You will see an event for each router, route, and variant that a user was exposed to every hour.Each event will include:
  • alias_id - This is your router’s id
  • route_id - This is the route that the user was routed to
  • variant_id - This is the variant that the user was exposed to
  • Time - This is time of the most recent event in the hourly time bucket in which the user was exposed to this router, route, and variant
The Distinct ID of the event will be what was passed in the user field of the request.
6

Analyze your data

Now you can use this event exposure data to understand how different routes and variants impact your metrics.We recommend creating a Borrowed Event Property. To do so, create a Custom Event Property and select Computed > Borrow Property. Select the Route Exposure event and alias_id, route_id, or variant_id based on what property you want to analyze your data by.borrow-event.gifNow you can use the property in any Breakdown of a report to see how your metrics trend based on the router, route, or variant that the user was exposed to.

BigQuery

Export router exposure data to your existing BigQuery project for product analytics. When a user is exposed to a router, it is sent as an event to your BigQuery project, including details on router, route, and variant — so you can analyze routing performance directly from BigQuery.
1

Create a BigQuery dataset

Create a BigQuery dataset in your GCP project to store router data.
2

Create a service account

Create a service account with BigQuery Data Editor permissions.
3

Configure the integration in Portal

In Portal, navigate to Data & Metrics and click Add Integration, then select BigQuery. Enter the following:
FieldValue
Project IDYour GCP project ID
Dataset IDYour dataset ID from Step 1
Service Account EmailThe service account email from the Step 2
Toggle Export to BigQuery` to on, then click Enable.
4

Make a request to your router

Now call the Chat Completions API with your route, populating the a unique user id corresponds to the user who this request is for in the user field when making the request. The router exposure data will include the user in the data export, so you can tie the specific request to the right user.
curl --request POST \
  --url https://api.inworld.ai/v1/chat/completions \
  --header 'Authorization: Basic <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "inworld/my-router",
    "messages": [{"role": "user", "content": "Hello"}],
    "user": "<mixpanel-distinct-id>"
  }'
5

Analyze your data BigQuery

The router exposure data will flow to your BigQuery project automatically (data will sync every ~8 hours). You will see an event for each router, route, and variant that a user was exposed to every hour.Each event will include:
  • alias_id - This is your router’s id
  • route_id - This is the route that the user was routed to
  • variant_id - This is the variant that the user was exposed to
  • user_id - The user that was exposed to thie router, route, and variant
  • time - This is time of the most recent event in the hourly time bucket in which the user was exposed to this router, route, and variant
You can use this data in conjunction with your existing metrics to understand how your metrics trend based on the router, route, or variant that the user was exposed to.