Created
July 30, 2025 16:24
-
-
Save Samox/f3c55bd19134e7fac88d962b9ae8e10a to your computer and use it in GitHub Desktop.
Track subscription in Adjust from Superwall events for iOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class MySuperwallDelegate extends SuperwallDelegate { | |
handleSuperwallEvent(eventInfo: SuperwallEventInfo) { | |
switch (eventInfo.event.type) { | |
case EventType.transactionComplete: | |
const product = eventInfo.event.product; | |
const transaction = eventInfo.event.transaction; | |
if (product && transaction) { | |
console.info("product", product); | |
console.info("transaction", transaction); | |
trackPlatformPurchase({ | |
price: product.price, | |
currency: product.currencyCode!, | |
transactionId: | |
transaction.originalTransactionIdentifier || undefined, | |
sku: product.productIdentifier, | |
orderId: transaction.storeTransactionId || undefined, | |
signature: undefined, | |
purchaseToken: undefined, | |
}); | |
const subscription = new AdjustAppStoreSubscription( | |
String(product.price), | |
product.currencyCode, | |
transaction.originalTransactionIdentifier, | |
); | |
Adjust.trackAppStoreSubscription(subscription); | |
} | |
break; | |
default: | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment