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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-inhouse-sdk

v1.0.9

Published

A React Native module for tracking SDK functionality

Readme

React Native Inhouse Tracking SDK

A React Native module for tracking SDK functionality with install referrer support.

Installation

Using npm

npm install react-native-inhouse-sdk

Using yarn

yarn add react-native-inhouse-sdk

iOS Installation

The SDK uses CocoaPods for iOS. After installation, run:

cd ios && pod install

Android Installation

The SDK will be automatically linked via React Native's autolinking feature.

AndroidManifest.xml Configuration

Add the following receiver to your android/app/src/main/AndroidManifest.xml inside the <application> tag:

<receiver
  android:name="co.tryinhouse.android.InstallReferrerReceiver"
  android:exported="true">
  <intent-filter>
      <action android:name="com.android.vending.INSTALL_REFERRER" />
  </intent-filter>
</receiver>

This receiver is required for install referrer tracking functionality.

Intent Filters for Deep Linking

Add the following intent filters to your main activity inside the <activity> tag in android/app/src/main/AndroidManifest.xml:

<intent-filter>
    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/>
    <data android:scheme="myandroidapp"/>
</intent-filter>

<intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />

    <!-- Do not include other schemes. -->
    <data android:scheme="http" />
    <data android:scheme="https" />

    <data android:host="your-shortlink-domain.tryinhouse.co" />
</intent-filter>

These intent filters enable deep linking functionality for your app. The first filter handles custom scheme URLs (e.g., myandroidapp://), while the second filter handles HTTP/HTTPS URLs with your TryInHouse domain for App Links verification.

Manual Linking (if needed)

  1. Add the following to your android/settings.gradle:
include ':react-native-inhouse-sdk'
project(':react-native-inhouse-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-inhouse-sdk/android')
  1. Add the following to your android/app/build.gradle:
dependencies {
    implementation project(':react-native-inhouse-sdk')
}
  1. Add the following to your MainApplication.java:
import co.tryinhouse.react_native.TrackingSDKPackage;

// In the getPackages() method:
packages.add(new TrackingSDKPackage());

Usage

Basic Setup

import TrackingSDK from "react-native-inhouse-sdk";

// Initialize the SDK
await TrackingSDK.initialize(
  "your-project-id",
  "your-project-token",
  "your-shortlink-domain",
  "https://api.tryinhouse.co", // optional
  true // enable debug logging
);

Track Events

// Track app open
const result = await TrackingSDK.trackAppOpen("shortlink-url");

// Track session start
const sessionResult = await TrackingSDK.trackSessionStart("shortlink-url");

// Track short link click
const clickResult = await TrackingSDK.trackShortLinkClick(
  "shortlink-url",
  "deeplink-url"
);

Install Referrer

// Get install referrer storred in shared preferences
const referrer = await TrackingSDK.getInstallReferrer();

// Fetch install referrer (async)
const fetchedReferrer = await TrackingSDK.fetchInstallReferrer();

Event Listeners

// Add callback listener
const subscription = TrackingSDK.addCallbackListener((data) => {
  console.log("SDK Callback:", data.callbackType, data.data);
});

// Remove listener
TrackingSDK.removeCallbackListener(subscription);

// Remove all listeners
TrackingSDK.removeAllListeners();

The SDK tracks the following events, all of which send link data:

  • session_start_shortlink: Triggered when a session starts with a shortlink
  • app_open_shortlink: Triggered when the app opens via a shortlink
  • app_install_from_shortlink: Triggered when the app is installed from a shortlink

All events include link data with the following structure:

{
  "id": "string",
  "domain": "string",
  "key": "string",
  "url": "string",
  "short_link": "string",
  "title": "string",
  "description": "string",
  "image": "string",
  "utm_source": "string",
  "utm_medium": "string",
  "utm_campaign": "string",
  "utm_term": "string",
  "utm_content": "string",
  "ios": "string",
  "android": "string",
  "project_id": "string",
  "folder_id": "string",
  "playstore": "string",
  "appstore": "string",
  "deeplink_path": "string",
  "link_data": "string", // json object with custom key value pairs
  "website_link": "string",
  "refer_code": "string",
  "unique_clicks": 0,
  "app_installs": 0
}

App Lifecycle

// Call when app resumes
await TrackingSDK.onAppResume();

// Reset first install state (for testing)
await TrackingSDK.resetFirstInstall();

Configuration

The SDK automatically uses the React Native and other dependencies from your project. You can configure specific versions in your project's android/build.gradle:

ext {
    // SDK will use these versions if available
    okhttpVersion = '4.12.0'
    gsonVersion = '2.10.1'
    installReferrerVersion = '2.2'
    coroutinesVersion = '1.7.3'
    coreKtxVersion = '1.12.0'
    appcompatVersion = '1.6.1'
}

API Reference

Methods

  • initialize(projectId, projectToken, shortLinkDomain, serverUrl?, enableDebugLogging?): Initialize the SDK
  • onAppResume(): Call when app resumes
  • trackAppOpen(shortLink?): Track app open event
  • trackSessionStart(shortLink?): Track session start
  • trackShortLinkClick(shortLink, deepLink?): Track short link click
  • getInstallReferrer(): Get current install referrer
  • fetchInstallReferrer(): Fetch install referrer asynchronously
  • resetFirstInstall(): Reset first install state
  • addCallbackListener(callback): Add event listener
  • removeCallbackListener(subscription): Remove specific listener
  • removeAllListeners(): Remove all listeners

Types

  • TrackingSDKCallback: Callback data structure
  • TrackingSDKInterface: Main SDK interface

Troubleshooting

Common Issues

  1. Build errors: Make sure you have the latest React Native version
  2. Linking issues: The SDK uses autolinking, but you can manually link if needed
  3. iOS pod install: Run cd ios && pod install after installation

Debug Mode

Enable debug logging during initialization to see detailed logs:

await TrackingSDK.initialize(
  "project-id",
  "project-token",
  "shortlink-domain",
  "https://api.tryinhouse.co",
  true // enable debug logging
);

License

MIT