Skip to main content
DATALYR integrates with RevenueCat in two ways: receiving webhook events for subscription analytics and revenue attribution, and pushing attribution data from your mobile app into RevenueCat via the SDK.

What Gets Tracked

Webhook Events (RevenueCat to DATALYR)

When a subscription event occurs in RevenueCat, DATALYR receives the webhook and maps it to a standardized event.
RevenueCat EventDATALYR EventHas Revenue
INITIAL_PURCHASEsubscription_startedYes
RENEWALsubscription_renewedYes
NON_RENEWING_PURCHASEpurchaseYes
CANCELLATIONsubscription_cancelledNo
UNCANCELLATIONsubscription_reactivatedNo
EXPIRATIONsubscription_expiredNo
BILLING_ISSUEbilling_failedNo
PRODUCT_CHANGEsubscription_changedNo
SUBSCRIPTION_PAUSEDsubscription_pausedNo
SUBSCRIPTION_EXTENDEDsubscription_extendedNo
TRANSFERsubscription_transferredNo
REFUND_REVERSEDrefund_reversedYes

Attribution Data (DATALYR to RevenueCat)

The DATALYR mobile SDK provides a getRevenueCatAttributes() method that returns attribution data formatted for RevenueCat’s setAttributes() API. This pushes your marketing attribution into RevenueCat so you can segment subscribers by acquisition source. Reserved attributes ($ prefix):
KeyDescription
$datalyrIdDATALYR visitor ID
$mediaSourceAcquisition source (maps from utm_source)
$campaignCampaign name (maps from utm_campaign)
$adGroupAd group or adset identifier
$adAd identifier
$keywordSearch keyword
$idfaiOS Identifier for Advertisers
$gpsAdIdGoogle Advertising ID (Android)
$attConsentStatusATT status: notDetermined, restricted, denied, or authorized
Custom attributes:
KeyDescription
utm_sourceUTM source parameter
utm_mediumUTM medium parameter
utm_campaignUTM campaign parameter
utm_termUTM term parameter
utm_contentUTM content parameter
lyrDATALYR tracking link ID
fbclidMeta click ID
gclidGoogle click ID
ttclidTikTok click ID
wbraidGoogle wbraid parameter
gbraidGoogle gbraid parameter
networkAd network name
creative_idCreative identifier
Only non-empty values are included. The method returns a flat Record<string, string> dictionary.
RevenueCat uses $-prefixed keys for reserved attributes. These map to RevenueCat’s built-in subscriber attribute fields. Custom attributes (without $ prefix) are stored as custom subscriber attributes.

Setup

1. Connect RevenueCat in DATALYR

  1. Go to Settings -> Integrations in DATALYR
  2. Click “Connect” next to RevenueCat
  3. Enter your RevenueCat Project ID
  4. Copy the generated webhook URL

2. Configure Webhook in RevenueCat

  1. Go to your RevenueCat Dashboard -> Project Settings -> Integrations
  2. Select “Webhooks”
  3. Add a new webhook URL
  4. Paste the DATALYR webhook URL
  5. Under “Events to send”, select all event types
  6. Save

3. Push Attribution to RevenueCat (Mobile SDK)

After initializing the DATALYR mobile SDK, call getRevenueCatAttributes() and pass the result to RevenueCat’s setAttributes(). React Native:
import { Datalyr } from '@datalyr/react-native';
import Purchases from 'react-native-purchases';

// After DATALYR SDK is initialized and user has been identified
const attrs = Datalyr.getRevenueCatAttributes();
Purchases.setAttributes(attrs);
iOS Swift:
import DatalyrSDK
import RevenueCat

// After DATALYR SDK is initialized and user has been identified
let attrs = DatalyrSDK.shared.getRevenueCatAttributes()
Purchases.shared.attribution.setAttributes(attrs)
Call getRevenueCatAttributes() after the DATALYR SDK has finished initialization and attribution data is available. If you call it before the SDK resolves attribution, the returned dictionary may be empty.

How Attribution Works

DATALYR uses multi-tier identity resolution to attribute RevenueCat subscription events to marketing sources.

Attribution Flow

Step 1: User Clicks Ad
User clicks a Google ad
DATALYR web SDK captures: gclid, utm_source=google, utm_medium=cpc
Stores in visitor profile
Step 2: User Installs App
User installs your app
DATALYR mobile SDK initializes
Attribution data captured via web-to-app matching
Step 3: Push Attribution to RevenueCat
Your app calls:
const attrs = Datalyr.getRevenueCatAttributes();
Purchases.setAttributes(attrs);

This passes $datalyrId (visitor ID) and attribution data to RevenueCat
Step 4: User Identifies
User signs up with email: [email protected]

Your app calls:
Datalyr.identify('user_456', { email: '[email protected]' });

RevenueCat subscriber attribute set:
Purchases.setAttributes({ $email: '[email protected]' });

DATALYR links the mobile visitor to the original web visitor
Step 5: User Subscribes via RevenueCat
User purchases subscription through RevenueCat paywall
RevenueCat sends webhook to DATALYR
Webhook includes subscriber_attributes with $datalyrId and $email
Step 6: DATALYR Resolves Attribution
DATALYR receives the webhook
Looks up visitor by $datalyrId from subscriber_attributes (fastest, most accurate)
Falls back to email lookup if $datalyrId not found
Finds match with gclid from Step 1
Links subscription_started event to the Google ad click
Step 7: Conversion Postback
DATALYR sends conversion to Google Ads API
Includes: gclid, conversion_action, value=$9.99
Google attributes the conversion to the original ad

Identity Resolution Order

DATALYR resolves identity in this order for each RevenueCat webhook:
  1. Visitor ID lookup — Checks subscriber_attributes.$datalyrId (set automatically by getRevenueCatAttributes()). This is the most accurate method because it directly matches the DATALYR visitor.
  2. Email lookup — Searches subscriber_attributes.$email (also checks email, Email, $Email) against identified visitors
  3. Aliases lookup — Iterates through the aliases array in the webhook payload, skipping RevenueCat anonymous IDs (those starting with $RCAnonymousID:), and searches each alias as a user ID
If none resolve, the event is still ingested but without marketing attribution.

Requirements for Attribution

  • The user must have been tracked by the DATALYR web or mobile SDK before the subscription event
  • For best results, call getRevenueCatAttributes() and pass the result to Purchases.setAttributes() — this ensures the $datalyrId is available for direct visitor matching
  • Alternatively, the user must have been identified with an email that matches the $email subscriber attribute in RevenueCat
  • The subscription event must be within the attribution window (default 30 days)
For the highest attribution accuracy, always call getRevenueCatAttributes() after the DATALYR SDK is initialized and pass the result to RevenueCat. This sets the $datalyrId which enables direct visitor matching without relying on email.

Conversion Postbacks

When a RevenueCat subscription event matches a conversion rule, DATALYR sends the conversion to the relevant ad platform server-side.

How Postbacks Work

  1. RevenueCat sends a webhook (e.g., INITIAL_PURCHASE)
  2. DATALYR maps it to subscription_started
  3. DATALYR resolves the user’s attribution (fbclid, gclid, ttclid)
  4. If a conversion rule matches subscription_started, DATALYR sends a postback:
    • Meta: Conversions API (CAPI) with fbclid, fbp, fbc
    • Google: Google Ads Conversion API with gclid
    • TikTok: TikTok Events API with ttclid

Supported Platforms

PlatformClick IDAPI
Meta (Facebook/Instagram)fbclidConversions API (CAPI)
Google Adsgclid, wbraid, gbraidGoogle Ads API
TikTok AdsttclidTikTok Events API

Setting Up Postbacks

  1. Go to Settings -> Connections in DATALYR
  2. Connect your ad platform (Meta, Google, or TikTok)
  3. Create a conversion rule:
    • Trigger event: subscription_started (or any mapped event)
    • Platform: Select the target ad platform
    • Platform event name: The event name the platform expects (e.g., Purchase for Meta)
    • Value: Use event revenue or set a fixed value
See Conversion Rules for detailed configuration.

Revenue Tracking

Gross Revenue

DATALYR captures the price field from the RevenueCat webhook payload. RevenueCat converts all prices to USD. Revenue events: INITIAL_PURCHASE, RENEWAL, NON_RENEWING_PURCHASE, REFUND_REVERSED.

Net Revenue

DATALYR calculates net revenue by deducting both platform commission and tax:
net_revenue = price * (1 - tax_percentage) * (1 - commission_percentage)

Commission Rates

RevenueCat provides the commission_percentage directly in the webhook payload. This value reflects the actual commission rate applied by the app store, including whether the developer is enrolled in the Apple Small Business Program or Google Play’s reduced service fee.
StoreStandard CommissionReduced Commission
Apple App Store30%15% (Small Business Program)
Google Play Store30%15% (first $1M USD/year)

Trial Conversions

RevenueCat includes an is_trial_conversion field in the webhook payload. DATALYR stores this as a flag on the event. Filter subscription events in your dashboard or API queries to see how many subscriptions converted from free trials.

Refund Reversals

The REFUND_REVERSED event fires when a previously refunded transaction is reversed (the customer’s refund is taken back). This is a revenue event in DATALYR, and the revenue value represents the amount restored.

Store Platforms

DATALYR maps RevenueCat store identifiers to platform types:
StorePlatform
APP_STOREios
MAC_APP_STOREmacos
PLAY_STOREandroid
AMAZONamazon
STRIPEweb
ROKUroku
RC_BILLINGweb
PADDLEweb

Event Data

Each processed event includes enriched metadata:
  • subscription_id — Original transaction ID
  • product_id — RevenueCat product identifier
  • platform — Store name (APP_STORE, PLAY_STORE, etc.)
  • platform_type — Normalized platform (ios, android, web, macos, amazon, roku)
  • app_id — RevenueCat app ID
  • period_type — Subscription period (NORMAL, TRIAL, INTRO, PROMOTIONAL)
  • gross_revenue — Full price in USD
  • net_revenue — After commission and tax
  • commission_rate — Applied commission percentage
  • tax_percentage — Applied tax percentage
  • is_trial_conversion — Whether this converted from a trial
  • experiment_id — RevenueCat Experiments ID (if the user is in an experiment)
  • presented_offering_id — RevenueCat offering ID shown to the user (for offering attribution)
  • app_user_id — RevenueCat app user ID
  • original_app_user_id — Original app user ID
  • aliases — Array of all user ID aliases

RevenueCat Experiments

If you use RevenueCat Experiments for paywall A/B testing, the experiment_id field is included in the event data. You can use this to correlate DATALYR attribution data with RevenueCat experiment results.

Deduplication

DATALYR deduplicates RevenueCat webhook events using a composite key of the original transaction ID and event type. If RevenueCat retries a webhook, DATALYR detects the duplicate and skips processing. Deduplication keys expire after seven days.

Troubleshooting

Webhook Events Not Appearing

Check the following:
  1. The webhook URL in RevenueCat matches the URL generated in DATALYR Settings -> Integrations
  2. Your RevenueCat Project ID is correct in DATALYR
  3. All event types are selected in the RevenueCat webhook configuration
  4. The webhook is active (not paused) in RevenueCat
Verify in DATALYR:
  • Go to Event Stream in the DATALYR dashboard
  • Filter by source: revenuecat
  • Check if events appear after a test purchase
Check RevenueCat webhook logs:
  • In RevenueCat Dashboard -> Project Settings -> Integrations -> Webhooks
  • View recent webhook deliveries and response codes
  • A 200 response from DATALYR means the webhook was received

Events Not Attributed

Check the following:
  1. You are calling getRevenueCatAttributes() and passing the result to Purchases.setAttributes() — this sets the $datalyrId for direct visitor matching
  2. If not using getRevenueCatAttributes(), the $email subscriber attribute must be set in RevenueCat for the user
  3. The same email was used when calling identify() in the DATALYR SDK
  4. The user was tracked by DATALYR before the subscription event
  5. The attribution window has not expired (default 30 days)
Recommended fix: Pass DATALYR attributes to RevenueCat after SDK initialization:
// After DATALYR SDK is initialized
const attrs = Datalyr.getRevenueCatAttributes();
Purchases.setAttributes(attrs);

// Also identify in DATALYR and set email in RevenueCat
Datalyr.identify(user.id, { email: user.email });
Purchases.setAttributes({ $email: user.email });

Postbacks Not Sending

Check the following:
  1. A conversion rule exists that matches the DATALYR event name (e.g., subscription_started)
  2. The ad platform is connected in Settings -> Connections
  3. The user has a valid click ID (fbclid, gclid, or ttclid) from their original ad click
See Postback Debugging for detailed troubleshooting.

Revenue Showing Incorrect Values

Common causes:
  • Commission rate mismatch: Check the commission_percentage field in the RevenueCat webhook payload against your expected rate
  • Tax deductions: DATALYR deducts both tax and commission from net revenue. Check the tax_percentage field on the event
  • Currency conversion: RevenueCat converts to USD. The price_in_purchased_currency field shows the original price in the user’s local currency

SDK Attributes Not Populating

Check the following:
  1. The DATALYR mobile SDK is initialized before calling getRevenueCatAttributes()
  2. Attribution data has been resolved (the user visited your site or app via a tracked link)
  3. You are passing the result to Purchases.setAttributes() correctly
Debug: Log the attributes to verify:
const attrs = Datalyr.getRevenueCatAttributes();
console.log('RevenueCat attributes:', attrs);
// Should contain keys like $datalyrId, $mediaSource, utm_source, etc.
The $attConsentStatus attribute maps iOS ATT status integers to RevenueCat’s expected string values:
ATT Status CodeString Value
0notDetermined
1restricted
2denied
3authorized

Next Steps

Conversion Rules

Configure how events are sent to ad platforms

Mobile SDK

Install the DATALYR mobile SDK

Google Ads

Send conversions to Google Ads

Customer Journeys

View user journeys from ad click to subscription