Skip to content

SDK 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 Reference

The SDK emits various events with associated data. Below is a comprehensive list of events you can listen for.

visit_home

Sent when the user visits the home screen.

Properties: None


Sent when the user visits the search screen.

Properties: None


visit_category

Sent when a user visits a specific category page.

Properties:

  • categoryName (required) - The name of the category visited

Example:

{"categoryName": "FASHION"}

visit_brand_l2

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

Properties:

  • brandName (required) - The name of the brand viewed

Example:

{"brandName": "Amazon"}

visit_checkout_summary

Sent when the user visits the checkout summary screen.

Properties:

  • brandName (required) - The brand being purchased
  • amount (required) - The transaction amount

Example:

{"brandName": "Amazon", "amount": 500}

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

Example:

{
"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”)

Example:

{
"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

Example:

{
"amount": 500,
"referenceId": "ord_123",
"provider": "RAZORPAY",
"failureReason": "Payment declined"
}

Voucher Events

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

Example:

{
"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

Example:

{
"brandName": "Amazon",
"amount": 500,
"vouchersCount": 1,
"orderId": "ord_123"
}

Other Events

search_query

Sent whenever the user types in the search field.

Properties:

  • query (required) - The search query text

Example:

{"query": "amazon card"}

coin_payment

Sent when the entire payment is made using only coins (no actual payment gateway involved).

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

Example:

{
"amount": 500,
"coins": 10,
"baseDiscount": 100,
"couponDiscount": 50,
"totalDiscount": 150
}

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

Example:

{
"brandName": "Amazon",
"amount": 500,
"reason": "Failed to create payment order",
"errorType": "REDEMPTION_INIT_FAILED",
"paymentMode": "UPI"
}

Default Screen Visit Events

A generic visit_{screen_name} event is sent whenever a user navigates to any screen within the SDK. For example, visiting the “Apply Coupons” screen sends a visit_coupons event.

Screen Names

The following are the possible values for {screen_name}:

  • home
  • home_menu
  • coupons
  • checkout_summary
  • brand_l2
  • voucher_edit_modal
  • voucher_generation_success
  • voucher_generation_fail
  • voucher_generation_loader
  • transactions
  • transaction_l2
  • how_to_use
  • tnc
  • warning_modal
  • help_and_support