---
title: "Decrypt the Meta Install Referrer on Android | Appy"
description: "Read Facebook and Instagram campaign, ad set and ad for Android installs: the content provider query, AES-256-GCM decryption code and the field mapping."
source: "https://appy.to/blog/meta-install-referrer-decryption"
---

[← Back to Blog](https://appy.to/blog)

Guide

# How to Decrypt the Meta Install Referrer on Android

Facebook and Instagram can tell your app which campaign, ad set and ad brought an install, views included. The data is encrypted with a key only you have.

Appy•October 15, 2026•4 min read

Summarize with[ChatGPT](https://chatgpt.com/?q=Summarize%20this%20page%20and%20list%20its%20key%20points%3A%20https%3A%2F%2Fappy.to%2Fblog%2Fmeta-install-referrer-decryption) [Claude](https://claude.ai/new?q=Summarize%20this%20page%20and%20list%20its%20key%20points%3A%20https%3A%2F%2Fappy.to%2Fblog%2Fmeta-install-referrer-decryption) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20this%20page%20and%20list%20its%20key%20points%3A%20https%3A%2F%2Fappy.to%2Fblog%2Fmeta-install-referrer-decryption)

Short answer

## How do I decrypt the Meta Install Referrer on Android?

Read the Meta Install Referrer in your app on first launch, then decrypt it on your server with AES-256-GCM and the 64-character hex key from Meta for Developers, under App settings › Basic › Android. The decrypted data names the campaign, ad set and ad behind the install, for taps and views alike.

Key takeaways

-   Never ship the decryption key in your app; anyone who unpacks the APK could read it.
-   The field names are one level off: campaign\_group is the campaign, campaign is the ad set and adgroup is the ad.
-   Without the three queries entries in the manifest, Android 11 and later returns nothing.

The Google Play Install Referrer only carries Meta ad taps that install in the same session. The Meta Install Referrer covers the rest: the Facebook, Instagram and Facebook Lite apps keep the ad your user saw or tapped and hand it to your app.

### Play Install Referrer

-   Same-session taps
-   Encrypted Meta data
-   Also carries Google Ads clicks

### Meta Install Referrer

-   Taps, views and earlier sessions
-   Same encryption, same key
-   Tells you tap or view

## Before you start

01

### An Android app-install campaign

On Facebook, Instagram or Audience Network.

02

### Your Facebook App ID

The one your ads run under.

03

### The decryption key

Meta for Developers › App settings › Basic › Android. Admin access needed.

## 1\. Read it on first launch

AndroidManifest.xml

```
<queries>
<package android:name="com.facebook.katana" />
<package android:name="com.instagram.android" />
<package android:name="com.facebook.lite" />
</queries>
```

Kotlin

```
val providers = listOf(
"com.facebook.katana.provider.InstallReferrerProvider",
"com.instagram.contentprovider.InstallReferrerProvider",
"com.facebook.lite.provider.InstallReferrerProvider",
)

fun readMetaReferrer(context: Context, facebookAppId: String): String? {
for (authority in providers) {
val uri = Uri.parse("content://$authority/$facebookAppId")
runCatching { context.contentResolver.query(uri, null, null, null, null) }
.getOrNull()?.use { cursor ->
if (cursor.moveToFirst()) {
return cursor.getString(cursor.getColumnIndexOrThrow("install_referrer"))
}
}
}
return null
}
```

Without the queries entries, Android 11+ returns nothing.

## 2\. Decrypt it on your server

Never ship the key in your app. Anyone who unpacks the APK could read it.

Node.js

```
import crypto from 'node:crypto';

export function decryptMetaReferrer(installReferrer, keyHex) {
const {utm_content} = JSON.parse(installReferrer);
const {source} = typeof utm_content === 'string' ? JSON.parse(utm_content) : utm_content;
const sealed = Buffer.from(source.data, 'hex');
const decipher = crypto.createDecipheriv('aes-256-gcm', Buffer.from(keyHex, 'hex'), Buffer.from(source.nonce, 'hex'));
decipher.setAuthTag(sealed.subarray(-16));
return JSON.parse(Buffer.concat([decipher.update(sealed.subarray(0, -16)), decipher.final()]).toString());
}
```

AES-256-GCM, hex data and nonce, the 16-byte tag at the end, a 64-character key.

## The field names are one level off

campaign\_groupcampaignadgroup

1.  campaign\_group

Campaign

What Ads Manager calls the campaign.

2.  campaign

Ad set

Not the campaign.

3.  adgroup

Ad

The creative people saw.


Adjust and AppsFlyer map the fields the same way.

## When it comes back empty

Situation

What happens

Fix

No queries in the manifest

What happens: Empty result

Fix: Add the three packages

Wrong App ID

What happens: Empty result

Fix: Use your ads’ App ID

Key not 64 characters

What happens: Nothing decrypts

Fix: Copy it again

Old Meta app on the phone

What happens: No provider

Fix: Facebook 428, Instagram 296+

Android only. Meta has no per-install referrer on iOS.

## With Appy, paste the key once

On the Enterprise plan you add the key in the dashboard and your App ID in the SDK. Decryption happens on Appy’s servers.

First launch

Android, Appy SDK

-   Tapped your Appy linkCredited to the link
-   Meta ad, tap or viewCampaign, ad set, ad
-   Google Ads clickCredited to Google Ads
-   None of theseOrganic

The key is stored encrypted and never shown again.

## Read next

-   [Apple Ads attribution without an MMPThe iOS side.](https://appy.to/blog/apple-ads-attribution-without-mmp)
-   [Install postbacks and webhooksSend installs to a network or your server.](https://appy.to/blog/app-install-postbacks-webhooks)
-   [Ad networks in the docsEvery field, for developers.](https://appy.to/docs/ad-networks)

## Questions

### Where is the decryption key?

Meta for Developers, App settings › Basic, in the Android section.

### Which encryption does Meta use?

AES-256-GCM with a 64-character hex key.

### Does it include view-through installs?

Yes. The is\_ct column is 0 for a view and 1 for a tap.

### Is campaign\_name the campaign?

No, it is the ad set. The campaign is campaign\_group\_name.

## Continue exploring

Guide

Nov 13, 2026

7 min read

### How to Test the Google Play Install Referrer on a Real Device

A build from Android Studio never has an install referrer. How to get a real one with an encoded Play URL, an internal testing track and a Kotlin read on first launch.

android

install referrer

google play

attribution

[Read article](https://appy.to/blog/test-google-play-install-referrer)

Guide

Oct 21, 2026

8 min read

### How to Measure App Installs Without Fingerprinting

Apple doesn’t allow fingerprinting even when users agree to tracking, and EU regulators treat IP-based tracking as access to the device. What still measures installs with proof on iPhone and Android, and a plan that never has to guess.

attribution

fingerprinting

privacy

install attribution

[Read article](https://appy.to/blog/measure-app-installs-without-fingerprinting)

Guide

Aug 14, 2026

11 min read

### Deferred Deep Linking Without an SDK: How It Works

You can carry link intent across an app install without embedding an attribution SDK. What actually survives the store boundary on Android and iOS, what breaks, and what each workaround costs in privacy.

deferred deep linking

install referrer

ios

android

[Read article](https://appy.to/blog/deferred-deep-linking-without-sdk)

Looking for something else? Browse all topics on [the blog](https://appy.to/blog).

## Meta installs next to every link and QR code

Paste your key once and Appy credits Facebook and Instagram installs to the campaign, ad set and ad.

[Talk to sales](mailto:sales@appy.to?subject=Appy%20Enterprise%20ad%20networks) [Read the docs](https://appy.to/docs/ad-networks)
