Skip to main content
Solved

Integrating Firebase Analytics.logTransaction function

  • 20 May 2024
  • 1 reply
  • 247 views

Forum|alt.badge.img+1

The Firebase iOS documentation shows the following:

 

If you're using StoreKit 2, use the following code to log IAP events.

func purchaseSomeProduct(_ product: Product) {
  // Purchase a Product. This is mostly standard boilerplate StoreKit 2
  // code, except for the Analytics.logTransaction() call.
  let result = try await product.purchase()
  switch result {
  case .success(let verification):
      let transaction = try checkVerified(verification)

      // Call this Firebase API to log the in-app purchase event.
      Analytics.logTransaction(transaction)

      await transaction.finish()
  ...
}

Given that RevenueCat does a fantastic job of abstracting away the complexity of StoreKit, is it still possible to call `Analytics.logTransaction(...)` after a purchase but before `transaction.finish()`?

 

Best answer by sharif

Hi @RevCatUser123,

Apologies for closing the post before replying. RevenueCat doesn’t expose the verification object that Firebase needs, so that isn’t possible to do in RevenueCat. But if you listen to purchase events via StoreKit, then you’ll know when a purchase happens and you can go that route.

But, you may simply want to use RevenueCat’s Firebase integration instead of tracking purchases manually with Firebase.

View original
Did this post help you find an answer to your question?
This post has been closed for comments

1 reply

sharif
RevenueCat Staff
Forum|alt.badge.img+9
  • RevenueCat Staff
  • 513 replies
  • Answer
  • July 17, 2024

Hi @RevCatUser123,

Apologies for closing the post before replying. RevenueCat doesn’t expose the verification object that Firebase needs, so that isn’t possible to do in RevenueCat. But if you listen to purchase events via StoreKit, then you’ll know when a purchase happens and you can go that route.

But, you may simply want to use RevenueCat’s Firebase integration instead of tracking purchases manually with Firebase.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings