> For the complete documentation index, see [llms.txt](https://docs.adlibertas.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.adlibertas.com/data-integrations/analytics-connections/setting-user-campaigns-in-firebase.md).

# Setting User Campaigns in Firebase

<br>

![Still haven’t connected Firebase? You can do so here.](https://www.adlibertas.com/wp-content/uploads/2021/06/iSFBst.png)

One of the most popular uses for LTV reporting is measuring the performance of user acquisition campaigns. In order to track individual campaigns, you must enable the Campaign attribute to be set on the user’s device. You can do this 2 ways: Via a campaign referral link or by a post-back from your MMP of choice.

Note: Firebase will automatically track campaigns from a variety of acquisition sources, as [<mark style="color:blue;">listed here.</mark>](https://firebase.google.com/products/analytics/partners/)

{% hint style="info" %}
For iOS v. 14.5+ Firebase will require a user's permissions through ATT to track them or access IDFA. [<mark style="color:blue;">Details</mark>](https://firebase.google.com/docs/ios/supporting-ios-14).
{% endhint %}

### **Setting Campaigns Via Referral Link / Deep link**

If you’re interested in adding a custom campaign source, you’ll need to execute 3 steps:

**1. Tag all referral links with UTM parameters**

To store custom traffic, you’ll need to have your incoming campaign traffic set with the proper UTMs. To set these you can use [<mark style="color:blue;">Google Play URL Builder</mark>](https://developers.google.com/analytics/devguides/collection/android/v4/campaigns#google-play-url-builder)<mark style="color:blue;">.</mark>

**2. Fetch UTMs from the deep link in your app**

Essentially, this process will capture the campaign referral link in your app.

**3. Set Parameters as Firebase User Property**

Below is an example on Android from a deep link:

![](https://d3rv1nmzvje89q.cloudfront.net/optimized_v5/2018/05/Untitled.png)

*Image courtesy of Tatvic*

More information on this strategy [<mark style="color:blue;">available here</mark>](https://medium.com/firebase-developers/firebase-traffic-source-attribution-guide-287d7de80d76)<mark style="color:blue;">.</mark>

{% hint style="info" %}
With iOS 14.5+ Apple requires permissions to track users for the purpose of advertising ([<mark style="color:blue;">documentation</mark>](https://developer.apple.com/documentation/apptrackingtransparency)). Google lists attribution for links as [<mark style="color:blue;">unvailable for conversion events.</mark>](https://firebase.google.com/docs/ios/supporting-ios-14#affected-firebase-products)
{% endhint %}

### **Setting Campaigns Via an MMP**

Quite simply you’ll accept the campaign ID & other parameters via the MMP via a post-back, or referral ID sent to the device. Once these are set to the user’s user property ([<mark style="color:blue;">iOS</mark> ](https://firebase.google.com/docs/analytics/user-properties?platform=ios)and [<mark style="color:blue;">Android</mark>](https://firebase.google.com/docs/analytics/user-properties?platform=android))– most often the “Source”– you’ll have access to the campaign ID in Firebase.

Below is an Android example of passing an AppsFlyer install event to the Firebase Campaign attribute.

![(Generously provided by one of our customers)](/files/ifmYsRqc3HA7QCkoM7zg)

The user property is sent with each event, so AdLibertas Audience Reporting will be able to report on campaigns once they’ve been set at the Firebase User Property, even if the user-property is set later in the app’s lifecycle.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.adlibertas.com/data-integrations/analytics-connections/setting-user-campaigns-in-firebase.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
