TagSpy

in_app_purchase

Recommendedapp

App-stream event for an in-app product or subscription purchase. It may be collected automatically by the Firebase SDK/store integration; log it manually only when automatic purchase tracking is unavailable and avoid duplicate events.

Platforms
app
When it fires
You send it when the action happens.
Official docs

Parameters (10)

ParameterTypeRequiredDescriptionExample
currencystringYes*Currency associated with value, in 3-letter ISO 4217 format.USD
valuenumberYes*Monetary value of the in-app purchase.30.03
product_idstringNoProduct identifier.ABC123456789
product_namestringNoProduct name supported by Firebase Analytics SDKs.Premium plan
pricenumberNoProduct price supported by Firebase Analytics SDKs.9.99
quantitynumberNoPurchase quantity; defaults to 1 where supported.1
subscriptionbooleanNoWhether the purchase is a subscription.true
free_trialbooleanNoWhether the event is for a free trial subscription.false
price_is_discountedbooleanNoWhether the item price is discounted.false
introductory_pricenumberNoIntroductory subscription price when supplied by automatic app purchase collection.4.99

Example

gtag.js
gtag('event', 'in_app_purchase', {
  currency: 'USD',
  value: 30.03,
  product_id: 'ABC123456789',
  product_name: 'Premium plan',
  price: 9.99,
  quantity: 1,
});
GTM dataLayer
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
  event: 'in_app_purchase',
  currency: 'USD',
  value: 30.03,
  product_id: 'ABC123456789',
  product_name: 'Premium plan',
  price: 9.99,
  quantity: 1,
});

Also see