Skip to main content

Analytics Events

The Hubble SDK can post events back to the parent application, allowing you to track user behavior and respond to actions within the gift card store. This is useful for analytics.

How to Listen for Events

To receive events from the SDK, you will need to register an event listener. Please refer to the platform-specific integration guides for detailed instructions on how to implement this:

Event Structure

Events are sent as JSON objects with the following structure:

{
"type": "analytics",
"event": "payment_success",
"properties": {
"amount": 500,
"referenceId": "ord_123",
"provider": "RAZORPAY"
}
}

Key Events to Track

While the SDK emits many events, the following are the most important for production monitoring and business reporting:

EventCategoryWhy It Matters
visit_homeNavigationTrack SDK open rate and user engagement
visit_brand_l2NavigationTrack which brands users explore (includes brandName, productId)
visit_checkout_summaryNavigationTrack checkout intent (includes amount, discount, coupon details)
payment_initiatedPaymentTrack payment attempts (includes brandName, amount, paymentMode)
payment_successPaymentTrack completed payments (includes amount, referenceId, provider)
payment_failPaymentTrack failed payments (includes amount, failureReason)
voucher_generation_successVoucherTrack successful gift card delivery
voucher_generation_failVoucherTrack failed gift card generation (critical for support)
exitedSessionTrack how users leave the SDK (includes through property)

Event Reference

note

All navigation events automatically include an isModal (boolean) property indicating whether the screen is displayed as a modal overlay.

visit_home

Sent when the user visits the home screen.

{ "isModal": false }

Sent when the user visits the search screen.

{ "isModal": false }

visit_category

Sent when a user visits a specific category page.

Properties:

  • categoryName (required) - The name of the category visited
{ "categoryName": "FASHION", "isModal": false }

visit_brand_l2

Sent when a user visits a specific brand's page.

Properties:

  • productId (required) - The unique product identifier
  • brandName (required) - The name of the brand viewed
  • amount (required) - The selected voucher amount
{
"productId": "01VFBNDM43I2DHJSMCX",
"brandName": "Amazon",
"amount": 500,
"isModal": false
}

visit_checkout_summary

Sent when the user visits the checkout summary screen.

Properties:

  • brandName (required) - The brand being purchased
  • amount (required) - The transaction amount
  • couponCode (optional) - Applied coupon code if any
  • useCoins (optional) - Whether coins are being used
  • discount (optional) - Total discount amount
  • hubbleBaseDiscount (optional) - Base discount from Hubble
  • coinDiscount (optional) - Discount from coins
  • couponDiscount (optional) - Discount from coupon
{
"brandName": "Amazon",
"amount": 500,
"couponCode": "SAVE10",
"useCoins": true,
"discount": 150,
"hubbleBaseDiscount": 50,
"coinDiscount": 50,
"couponDiscount": 50,
"isModal": false
}

visit_voucher_edit_modal

Sent when the user opens the voucher amount/quantity edit modal.

Properties:

  • productId (required) - The unique product identifier
  • brandName (optional) - The name of the brand
  • quantity (optional) - Number of vouchers selected
  • amount (optional) - The selected voucher amount
{
"productId": "01VFBNDM43I2DHJSMCX",
"brandName": "Amazon",
"quantity": 1,
"amount": 500,
"isModal": true
}

Payment Events

payment_initiated

Sent when a payment is initiated by the user.

Properties:

  • brandName (required) - The brand being purchased
  • amount (required) - The payment amount
  • paymentMode (required) - The payment method (e.g., "UPI", "CARD")
  • productId (required) - The unique product identifier
  • consumeCoins (optional) - Whether coins are being used
  • couponCode (optional) - Applied coupon code if any
{
"brandName": "Amazon",
"amount": 500,
"paymentMode": "UPI",
"productId": "01GMAVS2CHXR0XP1BZSTA9A44K"
}

payment_success

Sent when the payment gateway confirms payment success.

Properties:

  • amount (required) - The payment amount
  • referenceId (required) - The payment order reference ID
  • provider (required) - The payment provider (e.g., "RAZORPAY")
{
"amount": 500,
"referenceId": "ord_123",
"provider": "RAZORPAY"
}

payment_fail

Sent when a payment fails at the gateway level.

Properties:

  • amount (required) - The payment amount
  • referenceId (required) - The payment order reference ID
  • provider (required) - The payment provider
  • failureReason (required) - The reason for payment failure
{
"amount": 500,
"referenceId": "ord_123",
"provider": "RAZORPAY",
"failureReason": "Payment declined"
}

payment_upi_intent_triggered

Sent when a UPI intent is triggered to open a UPI app for payment.

Properties:

  • referenceId (required) - The payment order reference ID
  • amount (required) - The payment amount
  • upiApp (optional) - The name of the specific UPI app selected (iOS only)
{
"upiApp": "GPAY",
"amount": 500,
"referenceId": "ord_123"
}

Possible upiApp values (iOS only):

ValueUPI App
PhonePePhonePe
PayTMPaytm
GPAYGoogle Pay
CREDCRED

payment_initiate_failed

Sent when payment initiation fails due to risk checks failed or weekly redemption limit is reached.

Properties:

  • brandName (required) - The brand being purchased
  • amount (required) - The attempted transaction amount
  • reason (required) - Description of why the payment initiation failed
  • paymentMode (required) - The payment method attempted
Reason ValueDescription
Risk checks failedUser failed fraud or security verification checks
Weekly redemption limit reachedUser has exceeded their weekly redemption limit
{
"brandName": "Amazon",
"amount": 500,
"reason": "Risk checks failed",
"paymentMode": "UPI"
}

click_payment_cancel

Sent when a user clicks the cancel/close button during an active payment flow.

Properties:

  • referenceId (required) - The payment order reference ID
  • amount (required) - The payment amount
  • paymentStatus (required) - The current payment order status
  • provider (optional) - The payment provider
{
"referenceId": "ord_123",
"amount": 500,
"paymentStatus": "ACTIVE",
"provider": "RAZORPAY"
}

Voucher Events

voucher_generation_processing

Sent when the order status is "ACTIVE" and voucher generation is in progress.

Properties:

  • amount (required) - The order amount
  • referenceId (required) - The order reference ID
  • provider (required) - The payment provider
  • paymentMode (optional) - The payment method used
{
"amount": 500,
"referenceId": "ord_123",
"provider": "RAZORPAY",
"paymentMode": "UPI_INTENT"
}

voucher_generation_success

Sent when voucher(s) are successfully generated after payment.

Properties:

  • brandName (required) - The brand for which vouchers were generated
  • amount (required) - The total voucher amount
  • vouchersCount (required) - The number of vouchers generated
{
"brandName": "Amazon",
"amount": 500,
"vouchersCount": 1
}

voucher_generation_fail

Sent when voucher generation fails after payment.

Properties:

  • brandName (required) - The brand for which voucher generation was attempted
  • amount (required) - The attempted voucher amount
  • vouchersCount (required) - The number of vouchers attempted
  • orderId (required) - The order ID for reference
{
"brandName": "Amazon",
"amount": 500,
"vouchersCount": 1,
"orderId": "ord_123"
}

User Interaction Events

search_query

Sent whenever the user types in the search field.

Properties:

  • query (required) - The search query text
{ "query": "amazon card" }

Sent when the user clicks on a promotional banner.

Properties:

  • bannerId (required) - The unique identifier of the banner
  • bannerType (required) - The type of banner
  • bannerUrl (optional) - The URL the banner links to
{
"bannerId": "banner_123",
"bannerType": "PROMOTIONAL",
"bannerUrl": "https://example.com/offer"
}

coin_payment

Sent when the entire payment is made using only coins.

Properties:

  • amount (required) - The total amount
  • coins (required) - Number of coins used
  • baseDiscount (required) - Base discount applied
  • couponDiscount (required) - Coupon discount applied
  • totalDiscount (required) - Total discount amount
{
"amount": 500,
"coins": 10,
"baseDiscount": 100,
"couponDiscount": 50,
"totalDiscount": 150
}

Error Events

init_error

Sent when the SDK fails to initialize properly.

Properties:

  • error (required) - The error object or message
{
"error": "Failed to load configuration"
}

auth_error

Sent when authentication fails or the user's session has expired.

Properties:

  • error (required) - Description of the authentication error
{
"error": "Invalid session or session has expired"
}

unexpected_error

Sent when an unexpected error occurs during the transaction flow.

Properties:

  • brandName (optional) - The brand being purchased
  • amount (optional) - The transaction amount
  • reason (required) - Description of the error
  • errorType (optional) - Categorization of the error type
  • paymentMode (optional) - The payment method being used
  • orderId (optional) - The order ID if available
{
"brandName": "Amazon",
"amount": 500,
"reason": "Failed to create payment order",
"errorType": "REDEMPTION_INIT_FAILED",
"paymentMode": "UPI"
}

Session Events

exited

Sent when the user exits or closes the SDK.

Properties:

  • through (optional) - How the user exited
{
"through": "home_back_button"
}