> [!NOTE]
> **Note:** Firebase Dynamic Links is *deprecated* and should not be used in new projects. The service will be shutting down soon. Follow the [migration guide](https://firebase.google.com/support/dynamic-links-faq.md.txt#how_should_i_migrate_from_the_service) and see the [Dynamic Links Deprecation FAQ](https://firebase.google.com/support/dynamic-links-faq.md.txt) for more information.

To help you gauge the effectiveness of your promotions and campaigns,
Firebase Dynamic Links provides several ways to view analytics data and integrate
with analytics tools.

Firebase Dynamic Links records events related to your Dynamic Links' performance,
including events that happen outside of your apps, such as the number of times
someone clicks on one of your short Dynamic Links. This data can be viewed in the
Dynamic Links section of the Firebase console and retrieved using a REST API.

Dynamic Links also work with [Google Analytics](https://firebase.google.com/docs/analytics.md.txt).
Google Analytics provides detailed statistics for events that happen in
your app, such as when someone opens your app by clicking a Dynamic Link. This data
can be viewed in the Analytics section of the Firebase console.

The following table summarizes the features of these two analytics options:

|   | Firebase Dynamic Links analytics | Google Analytics |
| Events tracked | - App first-open - App re-open - Clicks - Redirects - App installs | - App first-open - App re-open - App updates |
| Data access | - Firebase console (Dynamic Links section) - REST API | - Firebase console (Analytics section) - BigQuery export |
| Custom campaign attribution (`utm_` parameters) | No | Yes |
|---|---|---|

Both analytics options track in-app events that web-based tracking tools often
miss. For example, when a Dynamic Link is opened on iOS as a Universal Link, the link
is opened directly by the app, bypassing web analytics; these events are
correctly tracked by both Firebase Dynamic Links analytics and
Google Analytics.

> [!NOTE]
> **Note:** If you use Firebase Dynamic Links analytics or Google Analytics to track Dynamic Link usage, do not wrap your Dynamic Links in custom URLs, such as those created by link shortening services. By doing so, you prevent Firebase from accurately tracking your links.

## Firebase Dynamic Links analytics

Firebase Dynamic Links tracks the number of times each of your short Dynamic Links have
been clicked, as well as the number of times a click resulted in a redirect, app
install, app first-open, or app re-open. You can view these statistics in the
Firebase console or retrieve them with a REST API.

| Event | Description | Firebase console | REST API |
|---|---|---|---|
| CLICK | Count of any click on a Dynamic Link, irrespective to how it is handled and its destinations | Yes | Yes |
| REDIRECT | Count of attempts to redirect users, either to the App Store or Play Store to install or update the app, or to some other destination |   | Yes |
| APP_INSTALL | Count of actual installs (only supported by the Play Store) |   | Yes |
| APP_FIRST_OPEN | Count of first-opens after an install | Yes | Yes |
| APP_RE_OPEN | Number of times the Dynamic Link caused an app to be re-opened | Yes | Yes |

### Firebase console

In the [Firebase console](https://console.firebase.google.com/), you can view event counts
for each short Dynamic Link you created in the console.

![](https://firebase.google.com/static/docs/dynamic-links/images/fdl-analytics.png)

### REST API

To get event counts for any of your short Dynamic Links, whether you created the link
in the console or programmatically, you can use the
[Dynamic Links Analytics REST API](https://firebase.google.com/docs/reference/dynamic-links/analytics.md.txt).

An API call looks like the following example HTTP request:

```
GET https://firebasedynamiclinks.googleapis.com/v1/https%3A%2F%2Fexample.page.link%2FwXYz/linkStats?durationDays=7

Authorization: Bearer ya29.Abc123...
```

The response to a request is a JSON object like the following:

    {
      "linkEventStats": [
        {
          "platform": "ANDROID",
          "count": "123",
          "event": "CLICK"
        },
        {
          "platform": "IOS",
          "count": "123",
          "event": "CLICK"
        },
        {
          "platform": "DESKTOP",
          "count": "456",
          "event": "CLICK"
        },
        {
          "platform": "ANDROID",
          "count": "99",
          "event": "APP_INSTALL"
        },
        {
          "platform": "ANDROID",
          "count": "42",
          "event": "APP_FIRST_OPEN"
        },

        ...

      ]
    }

## Google Analytics

You can also use Google Analytics in your app to track the performance of
your Dynamic Links. The following Analytics events are automatically logged when
you open a short or long Dynamic Link in your app.

| Analytics events ||
|---|---|
| dynamic_link_first_open | Logged when a user opens the app for the first time via a Dynamic Link. |
| dynamic_link_app_open | Logged when a user re-opens the app via a Dynamic Link. |
| dynamic_link_app_update | Logged when the app is updated to a new version via a Dynamic Link. Android only. |

You can then view the logged data in the Analytics section of the
[Firebase console](https://console.firebase.google.com/).

![Dynamic Links events in <span class=](https://firebase.google.com/static/docs/dynamic-links/images/analytics.png)Google Analytics" class="screenshot"\>

If you mark Dynamic Link events as conversions, you can see how your Dynamic Links are
performing on the Attribution page.

### Google Analytics and Apple App Analytics campaign parameters

You use Dynamic Links with your existing Google Analytics custom campaigns and iTunes
Connect App Analytics campaigns by specifying campaign parameters when you
[create a Dynamic Link](https://firebase.google.com/docs/dynamic-links/create-links.md.txt). When a user opens a
Dynamic Link with campaign parameters specified, the campaign parameters are passed
on to Google Analytics or the App Store.

By adding these tracking parameters to your Dynamic Links, Google Analytics and
iTunes Connect can treat them like any other campaign it's measuring attribution
reporting for, and you can view conversion events not just by the ad campaigns
responsible for bringing in those users, but also by which Dynamic Links might have
brought them in.

The following parameters are passed to Google Analytics: `utm_source`,
`utm_medium`, `utm_campaign`, `utm_term`, `utm_content`.

The following parameters are passed to the App Store: `at`, `ct`, `mt`, `pt`