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.
Navigation Events
visit_home
Sent when the user visits the home screen.
Properties: None
visit_search
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 purchasedamount(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 purchasedamount(required) - The payment amountpaymentMode(required) - The payment method (e.g., “UPI”, “CARD”)productId(required) - The unique product identifierconsumeCoins(optional) - Whether coins are being usedcouponCode(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 amountreferenceId(required) - The payment order reference IDprovider(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 amountreferenceId(required) - The payment order reference IDprovider(required) - The payment providerfailureReason(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 generatedamount(required) - The total voucher amountvouchersCount(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 attemptedamount(required) - The attempted voucher amountvouchersCount(required) - The number of vouchers attemptedorderId(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 amountcoins(required) - Number of coins usedbaseDiscount(required) - Base discount appliedcouponDiscount(required) - Coupon discount appliedtotalDiscount(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 purchasedamount(optional) - The transaction amountreason(required) - Description of the errorerrorType(optional) - Categorization of the error typepaymentMode(optional) - The payment method being usedorderId(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}:
homehome_menucouponscheckout_summarybrand_l2voucher_edit_modalvoucher_generation_successvoucher_generation_failvoucher_generation_loadertransactionstransaction_l2how_to_usetncwarning_modalhelp_and_support