Skip to main content

Install Referrer Capacitor plugin

Read Google Play install referrer data and Apple AdServices attribution from Capacitor

Install

bun add @capgo/capacitor-install-referrer bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-install-referrer
  • pnpm add @capgo/capacitor-install-referrer
  • yarn add @capgo/capacitor-install-referrer

Guide

How to use Install Referrer in Capacitor

Test on device

Download the Capgo app, then scan the QR code.

Install Referrer plugin preview QR code

Using @capgo/capacitor-install-referrer

@capgo/capacitor-install-referrer reads install attribution signals in Capacitor apps.

Use it when you need Google Play Install Referrer data on Android and Apple AdServices attribution tokens on iOS through one API.

Install

bun add @capgo/capacitor-install-referrer
bunx cap sync

What This Plugin Exposes

  • getReferrer returns install attribution details for Android or iOS.
  • GetReferrer is a deprecated compatibility alias for migration from cap-play-install-referrer.
  • Android returns the Play referrer string, click timestamp, install timestamp, and instant app flag.
  • iOS returns an AdServices attribution token and can optionally fetch Apple's attribution payload.

Example Usage

import { InstallReferrer } from '@capgo/capacitor-install-referrer';

const result = await InstallReferrer.getReferrer();

if (result.platform === 'android') {
  console.log(result.referrer);
}

if (result.platform === 'ios') {
  console.log(result.attributionToken);
}

Apple Attribution Payload

const result = await InstallReferrer.getReferrer({
  fetchAppleAttribution: true,
  appleAttributionRetryCount: 3,
  appleAttributionRetryDelayMs: 5000,
});

console.log(result.appleAttribution);

Platform Notes

Android uses the Google Play Install Referrer service and requires a Play Store install for real referrer data. iOS uses Apple AdServices because Apple does not provide a generic App Store install referrer equivalent.

Full Reference

Keep going from Using @capgo/capacitor-install-referrer

If you are using Using @capgo/capacitor-install-referrer to plan native plugin work, connect it with @capgo/capacitor-install-referrer for the implementation detail in @capgo/capacitor-install-referrer, Getting Started for the implementation detail in Getting Started, Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, and Adding or Updating Plugins for the implementation detail in Adding or Updating Plugins.

FAQ

Install Referrer plugin FAQ

How do I install the Install Referrer plugin in a Capacitor app?

Run "bun add @capgo/capacitor-install-referrer" (or "npm install @capgo/capacitor-install-referrer"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-install-referrer" in your app code.

Does @capgo/capacitor-install-referrer work with React, Vue and Angular?

Yes. Install Referrer is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-install-referrer support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-install-referrer free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-install-referrer/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses Install Referrer without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship Install Referrer changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo