npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@capgo/capacitor-install-referrer

v8.1.3

Published

Capacitor plugin for reading Google Play install referrer and Apple AdServices attribution.

Readme

@capgo/capacitor-install-referrer

Capacitor plugin for install attribution. Android reads Google Play Install Referrer, and iOS uses Apple AdServices attribution tokens with optional Apple Search Ads attribution lookup.

Compatible with Capacitor 8.

Platform behavior

  • Android returns the Play install referrer string, click timestamp, install timestamp, and instant experience flag.
  • iOS returns an AdServices attribution token. Set fetchAppleAttribution to true to ask Apple for the attribution payload directly from native code.
  • iOS does not provide a generic App Store install referrer equivalent to Google Play. Apple AdServices covers Apple Search Ads attribution.
  • Web is unavailable and rejects the call.

Install

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

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);
}

Fetch the Apple attribution payload from iOS native code:

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

console.log(result.appleAttribution);

GetReferrer() is also available as a deprecated compatibility alias for apps migrating from cap-play-install-referrer.

Compatibility

| Plugin version | Capacitor compatibility | Maintained | | -------------- | ----------------------- | ---------- | | v8.. | v8.. | Yes | | v7.. | v7.. | On demand | | v6.. | v6.. | No |

API

Base API for retrieving install referrer and attribution details.

getReferrer(...)

getReferrer(options?: GetReferrerOptions | undefined) => Promise<GetReferrerResult>

Returns native install attribution details.

Android reads the Google Play Install Referrer API. iOS returns an Apple AdServices attribution token and can optionally fetch Apple's attribution payload.

| Param | Type | | ------------- | ----------------------------------------------------------------- | | options | GetReferrerOptions |

Returns: Promise<GetReferrerResult>

Since: 8.0.0


GetReferrer(...)

GetReferrer(options?: GetReferrerOptions | undefined) => Promise<GetReferrerResult>

Backward-compatible alias for plugins inspired by cap-play-install-referrer.

| Param | Type | | ------------- | ----------------------------------------------------------------- | | options | GetReferrerOptions |

Returns: Promise<GetReferrerResult>

Since: 8.0.0


getPluginVersion()

getPluginVersion() => Promise<PluginVersionResult>

Returns the platform implementation version marker.

Returns: Promise<PluginVersionResult>

Since: 8.0.0


Interfaces

GetReferrerResult

Install referrer and attribution details returned by the native platform.

| Prop | Type | Description | Since | | ---------------------------------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----- | | platform | string | Platform that produced the result. Android returns android; iOS returns ios. | 8.0.0 | | referrer | string | Android only. Raw Google Play install referrer string. | 8.0.0 | | clickTimestampSeconds | number | Android only. Client-side click timestamp in seconds. | 8.0.0 | | installBeginTimestampSeconds | number | Android only. Client-side install begin timestamp in seconds. | 8.0.0 | | googlePlayInstantParam | boolean | Android only. True when the user launched your app's instant experience. | 8.0.0 | | attributionToken | string | iOS only. Apple AdServices attribution token. Send this token to your backend, MMP, or Apple's AdServices API within its TTL. | 8.0.0 | | appleAttribution | AppleAttributionRecord | iOS only. Apple AdServices attribution payload when fetchAppleAttribution is true. | 8.0.0 |

AppleAttributionRecord

Install attribution values returned by Apple AdServices.

Apple may add fields over time, so unknown keys are preserved.

| Prop | Type | Description | Since | | ----------------- | -------------------- | --------------------------------------------------------------------- | ----- | | attribution | boolean | True when Apple found a matching Apple Search Ads attribution record. | 8.0.0 |

GetReferrerOptions

Options for reading install attribution.

| Prop | Type | Description | Default | Since | | ---------------------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- | | fetchAppleAttribution | boolean | iOS only. When true, the plugin sends the AdServices attribution token to Apple and returns the attribution payload in appleAttribution. Leave this false when you want to send attributionToken to your own backend or MMP. | false | 8.0.0 | | appleAttributionRetryCount | number | iOS only. Number of times to retry Apple's attribution endpoint after a 404 response. Apple can return 404 when the token is valid but attribution data is not ready yet. | 3 | 8.0.0 | | appleAttributionRetryDelayMs | number | iOS only. Delay between Apple attribution retries, in milliseconds. | 5000 | 8.0.0 |

PluginVersionResult

Plugin version payload.

| Prop | Type | Description | | ------------- | ------------------- | ----------------------------------------------------------- | | version | string | Version identifier returned by the platform implementation. |