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

@sameerarora/react-native-install-referrer

v0.1.0

Published

React Native Turbo Module for Google Play Install Referrer API

Readme

react-native-install-referrer

Exposes the Google Play Install Referrer API to React Native via a Turbo Module. Retrieve UTM attribution data, click/install timestamps, and instant-experience status directly from Play Store at runtime.

iOS — Not supported by Google Play. All methods resolve with null on iOS.


Installation

npm install @sameerarora/react-native-install-referrer

Android

No manual linking needed (auto-linked). The library adds com.android.installreferrer:installreferrer:2.2 to your Android build automatically.

Make sure Google Play Store is installed on the test device — the API is backed by a Play Store service.

iOS

No additional setup needed. All methods return null on iOS. Always null-check before using results.


Usage

import {
  getInstallReferrer,
  getReferrerDetails,
  parseReferrer,
} from '@sameerarora/react-native-install-referrer';

// Raw referrer string
const referrer = await getInstallReferrer();
// e.g. "utm_source=google&utm_medium=cpc&utm_campaign=launch"

// Full details (Android only)
const details = await getReferrerDetails();
// {
//   referrer: 'utm_source=google&utm_medium=cpc',
//   clickTimestamp: 1700000000000,   // ms since epoch
//   installTimestamp: 1700000010000, // ms since epoch
//   instantExperience: false,
// }

// Parse UTM parameters from the referrer string
const utm = parseReferrer(referrer ?? '');
// { utm_source: 'google', utm_medium: 'cpc', utm_campaign: 'launch' }

API Reference

getInstallReferrer(): Promise<string | null>

Returns the raw install referrer string from Google Play.

  • Android — Resolves with the referrer string. Returns "" if no referrer was set.
  • iOS — Resolves with null.
  • Throws — Rejects with a standardized error code on failure (see Error Codes).

Result is cached after the first successful call — subsequent calls return immediately without a native round-trip.


getReferrerDetails(): Promise<ReferrerDetails | null>

Returns full referrer details including timestamps and instant-experience flag.

type ReferrerDetails = {
  referrer: string;
  clickTimestamp: number;    // Unix timestamp in milliseconds
  installTimestamp: number;  // Unix timestamp in milliseconds
  instantExperience: boolean;
};
  • Android — Resolves with the full details object.
  • iOS — Resolves with null.
  • Throws — Rejects with a standardized error code on failure.

Result is cached after the first successful call.


parseReferrer(referrer: string): Record<string, string>

Parses a URL-encoded referrer string into a plain key/value object. Handles percent-encoding and +-as-space.

parseReferrer('utm_source=google&utm_medium=cpc&utm_campaign=Q4+launch');
// → { utm_source: 'google', utm_medium: 'cpc', utm_campaign: 'Q4 launch' }

Error Codes

When a native call fails the Promise is rejected. The error code will be one of:

| Code | Cause | |---|---| | SERVICE_UNAVAILABLE | Play Store is not installed, or the referrer service disconnected | | FEATURE_NOT_SUPPORTED | The installed Play Store version does not support the Install Referrer API | | UNKNOWN_ERROR | An unexpected response code was returned |

try {
  const referrer = await getInstallReferrer();
} catch (e: any) {
  if (e.code === 'SERVICE_UNAVAILABLE') {
    // Sideloaded APK or non-Play device — handle gracefully
  }
}

Android Notes

  • The referrer string is available for 90 days after installation.
  • Sideloaded APKs (not installed via Play Store) will return an empty referrer string.
  • Requires Google Play Store to be installed on the device.
  • The native API returns timestamps in seconds — this library converts them to milliseconds so new Date(clickTimestamp) works directly.

iOS Limitation

Google Play Install Referrer is an Android-only API. All methods in this library resolve with null on iOS. For iOS install attribution, refer to SKAdNetwork or a third-party attribution SDK.


License

MIT