# How to connect Batch to Piano Analytics

Piano Analytics is an advanced analytics platform that enables you to:

* Collect and leverage high-quality data across your websites and applications
* Use a powerful and flexible platform to improve your performance
* Integrate with a rich ecosystem of partners, including Batch

***

## A. Track Web Push notifications

Track web push notification opens in Piano Analytics by adding tracking parameters to your deep links.

{% stepper %}
{% step %}
**Use AT or UTM Parameters in Deep Links**

**AT parameters:**\
Add `at_medium` and `at_campaign` parameters directly to your deep links or in the payload. Follow Piano Analytics [documentation](https://developers.atinternet-solutions.com/piano-analytics/data-collection/how-to-send-events/marketing-campaigns) for formatting and parameter usage.

**UTM parameters:**\
Use UTM parameters if you configure Piano Analytics to recognize them. Refer to the Piano Analytics [documentation](https://developers.atinternet-solutions.com/piano-analytics/data-collection/how-to-send-events/marketing-campaigns#utm-management) for configuration steps.
{% endstep %}

{% step %}
**Add Parameters to Your Deep Link**

Append your tracking parameters to the push campaign deep link. For example:

```plaintext
https://mywebsite.com/item?at_medium=batchPush&at_campaign=new_offer
```

{% hint style="info" %}
AT parameters must be under 250 characters and must not include special characters. Refer to the Piano Analytics [documentation](https://developers.atinternet-solutions.com/piano-analytics/data-collection/how-to-send-events/collection-api#limits) for formatting rules.
{% endhint %}

After implementation, Piano Analytics will track users who open the notification. The source of their visit will reflect the value of the `at_medium` parameter.
{% endstep %}
{% endstepper %}

***

## B. Track Push and In-App Messages

Use Batch's Piano Analytics event dispatcher to send campaign data from your mobile app to Piano Analytics.

{% hint style="info" %}
Event dispatchers are available starting from Batch SDK version 1.19.
{% endhint %}

{% stepper %}
{% step %}
**Install the Piano Analytics Dispatcher**

Install the dispatcher for Android or iOS. Refer to the technical documentation to configure the dispatcher in your mobile app ([Android](https://doc.batch.com/developer/sdk/android/event-dispatchers#piano-analytics) / [iOS](https://doc.batch.com/developer/sdk/ios/event-dispatchers#piano-analytics)).

The dispatcher extracts AT or UTM parameters from the campaign and sends the data to Piano Analytics.
{% endstep %}

{% step %}
**Understand Piano Analytics Traffic Attribution**

Piano Analytics uses the first detected campaign per session as the **Traffic Source**. However, Batch can trigger multiple campaigns during a single session.

To support this behavior, Batch dispatches campaign data to:

* The **Marketing Campaign** module
* The **On-site Ads** module

**Marketing Campaign module:**\
Only the first campaign detected during a session appears as the official traffic source in the Piano Analytics dashboard. Other campaigns appear as event properties.

View this data in:

* `Traffic Sources > Marketing Sources`
* `Content > Pages`

**On-site Ads module:**\
This module tracks ad impressions and clicks per campaign. It ensures visibility for all campaigns triggered during a session.

View this data in:

* `Content > On-site Ads > Publisher Campaigns`
  {% endstep %}

{% step %}
**Create and Use AT or UTM Parameters**

Define your AT or UTM parameters in Piano Analytics. Reuse the parameter created in Section A.1. Associate this parameter with your campaign.

{% endstep %}

{% step %}
**Link Your Batch Campaign**

**Push campaigns:**\
The dispatcher extracts the AT or UTM parameter from:

* The deeplink URL
* The custom payload

If both are present, the dispatcher prioritizes the parameter in the custom payload.

{% hint style="info" %}
AT parameters must be under 250 characters and must not include special characters. Refer to Piano Analytics [documentation](https://developers.atinternet-solutions.com/piano-analytics/data-collection/how-to-send-events/collection-api#limits) for formatting rules.
{% endhint %}

**In-App and Mobile Landing campaigns:**\
The dispatcher extracts the AT or UTM parameter from:

* The deeplink URL
* The **Tracking ID** field in the campaign settings

After linking, Piano Analytics tracks all events related to your Batch push or In-App campaigns.
{% endstep %}
{% endstepper %}

## C. Tracking Email Messages

Track email opens in Piano Analytics by adding tracking parameters to your deep links.

{% stepper %}
{% step %}
**Use AT or UTM Parameters in Deep Links**

**AT parameters:**\
Add `at_medium` and `at_campaign` parameters directly to your deep links. Follow Piano Analytics [documentation](https://developers.atinternet-solutions.com/piano-analytics/data-collection/how-to-send-events/marketing-campaigns) for formatting and parameter usage.

**UTM parameters:**\
Use UTM parameters if you configure Piano Analytics to recognize them. Refer to the Piano Analytics [documentation](https://developers.atinternet-solutions.com/piano-analytics/data-collection/how-to-send-events/marketing-campaigns#utm-management) for configuration steps.
{% endstep %}

{% step %}
**Add Parameters to Your Deep Link**

Add your tracking parameters to the deep link used in your email campaign. For example:

```plaintext
https://mywebsite.com/item?at_medium=batchPush&at_campaign=new_offer
```

{% hint style="info" %}
AT parameters must be under 250 characters and must not include special characters. Refer to the Piano Analytics [documentation](https://developers.atinternet-solutions.com/piano-analytics/data-collection/how-to-send-events/collection-api#limits) for formatting rules.
{% endhint %}

After implementation, Piano Analytics will track users who open the email. The source of their visit will reflect the value of the `at_medium` parameter.
{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.batch.com/integrations/analytics/how-to-connect-batch-to-piano-analytics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
