Track mobile subscription revenue and push attribution data to RevenueCat
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.
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):
Key
Description
$datalyrId
DATALYR visitor ID
$mediaSource
Acquisition source (maps from utm_source)
$campaign
Campaign name (maps from utm_campaign)
$adGroup
Ad group or adset identifier
$ad
Ad identifier
$keyword
Search keyword
$idfa
iOS Identifier for Advertisers
$gpsAdId
Google Advertising ID (Android)
$attConsentStatus
ATT status: notDetermined, restricted, denied, or authorized
Custom attributes:
Key
Description
utm_source
UTM source parameter
utm_medium
UTM medium parameter
utm_campaign
UTM campaign parameter
utm_term
UTM term parameter
utm_content
UTM content parameter
lyr
DATALYR tracking link ID
fbclid
Meta click ID
gclid
Google click ID
ttclid
TikTok click ID
wbraid
Google wbraid parameter
gbraid
Google gbraid parameter
network
Ad network name
creative_id
Creative 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.
After initializing the DATALYR mobile SDK, call getRevenueCatAttributes() and pass the result to RevenueCat’s setAttributes().React Native:
Copy
import { Datalyr } from '@datalyr/react-native';import Purchases from 'react-native-purchases';// After DATALYR SDK is initialized and user has been identifiedconst attrs = Datalyr.getRevenueCatAttributes();Purchases.setAttributes(attrs);
iOS Swift:
Copy
import DatalyrSDKimport RevenueCat// After DATALYR SDK is initialized and user has been identifiedlet 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.
User clicks a Google adDATALYR web SDK captures: gclid, utm_source=google, utm_medium=cpcStores in visitor profile
Step 2: User Installs App
Copy
User installs your appDATALYR mobile SDK initializesAttribution data captured via web-to-app matching
Step 3: Push Attribution to RevenueCat
Copy
Your app calls:const attrs = Datalyr.getRevenueCatAttributes();Purchases.setAttributes(attrs);This passes $datalyrId (visitor ID) and attribution data to RevenueCat
Step 4: User Identifies
Copy
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
Copy
User purchases subscription through RevenueCat paywallRevenueCat sends webhook to DATALYRWebhook includes subscriber_attributes with $datalyrId and $email
Step 6: DATALYR Resolves Attribution
Copy
DATALYR receives the webhookLooks up visitor by $datalyrId from subscriber_attributes (fastest, most accurate)Falls back to email lookup if $datalyrId not foundFinds match with gclid from Step 1Links subscription_started event to the Google ad click
Step 7: Conversion Postback
Copy
DATALYR sends conversion to Google Ads APIIncludes: gclid, conversion_action, value=$9.99Google attributes the conversion to the original ad
DATALYR resolves identity in this order for each RevenueCat webhook:
Visitor ID lookup — Checks subscriber_attributes.$datalyrId (set automatically by getRevenueCatAttributes()). This is the most accurate method because it directly matches the DATALYR visitor.
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.
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.
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.
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.
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.
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.
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.
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.
You are calling getRevenueCatAttributes() and passing the result to Purchases.setAttributes() — this sets the $datalyrId for direct visitor matching
If not using getRevenueCatAttributes(), the $email subscriber attribute must be set in RevenueCat for the user
The same email was used when calling identify() in the DATALYR SDK
The user was tracked by DATALYR before the subscription event
The attribution window has not expired (default 30 days)
Recommended fix: Pass DATALYR attributes to RevenueCat after SDK initialization:
Copy
// After DATALYR SDK is initializedconst attrs = Datalyr.getRevenueCatAttributes();Purchases.setAttributes(attrs);// Also identify in DATALYR and set email in RevenueCatDatalyr.identify(user.id, { email: user.email });Purchases.setAttributes({ $email: user.email });
The DATALYR mobile SDK is initialized before calling getRevenueCatAttributes()
Attribution data has been resolved (the user visited your site or app via a tracked link)
You are passing the result to Purchases.setAttributes() correctly
Debug: Log the attributes to verify:
Copy
const attrs = Datalyr.getRevenueCatAttributes();console.log('RevenueCat attributes:', attrs);// Should contain keys like $datalyrId, $mediaSource, utm_source, etc.