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:
| Event | Category | Why It Matters |
|---|---|---|
visit_home | Navigation | Track SDK open rate and user engagement |
visit_brand_l2 | Navigation | Track which brands users explore (includes brandName, productId) |
visit_checkout_summary | Navigation | Track checkout intent (includes amount, discount, coupon details) |
payment_initiated | Payment | Track payment attempts (includes brandName, amount, paymentMode) |
payment_success | Payment | Track completed payments (includes amount, referenceId, provider) |
payment_fail | Payment | Track failed payments (includes amount, failureReason) |
voucher_generation_success | Voucher | Track successful gift card delivery |
voucher_generation_fail | Voucher | Track failed gift card generation (critical for support) |
exited | Session | Track how users leave the SDK (includes through property) |
Event Reference
Navigation Events
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 }
visit_search
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 identifierbrandName(required) - The name of the brand viewedamount(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 purchasedamount(required) - The transaction amountcouponCode(optional) - Applied coupon code if anyuseCoins(optional) - Whether coins are being useddiscount(optional) - Total discount amounthubbleBaseDiscount(optional) - Base discount from HubblecoinDiscount(optional) - Discount from coinscouponDiscount(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 identifierbrandName(optional) - The name of the brandquantity(optional) - Number of vouchers selectedamount(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 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
{
"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")
{
"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
{
"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 IDamount(required) - The payment amountupiApp(optional) - The name of the specific UPI app selected (iOS only)
{
"upiApp": "GPAY",
"amount": 500,
"referenceId": "ord_123"
}
Possible upiApp values (iOS only):
| Value | UPI App |
|---|---|
PhonePe | PhonePe |
PayTM | Paytm |
GPAY | Google Pay |
CRED | CRED |
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 purchasedamount(required) - The attempted transaction amountreason(required) - Description of why the payment initiation failedpaymentMode(required) - The payment method attempted
| Reason Value | Description |
|---|---|
Risk checks failed | User failed fraud or security verification checks |
Weekly redemption limit reached | User 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 IDamount(required) - The payment amountpaymentStatus(required) - The current payment order statusprovider(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 amountreferenceId(required) - The order reference IDprovider(required) - The payment providerpaymentMode(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 generatedamount(required) - The total voucher amountvouchersCount(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 attemptedamount(required) - The attempted voucher amountvouchersCount(required) - The number of vouchers attemptedorderId(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" }
banner_clicked
Sent when the user clicks on a promotional banner.
Properties:
bannerId(required) - The unique identifier of the bannerbannerType(required) - The type of bannerbannerUrl(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 amountcoins(required) - Number of coins usedbaseDiscount(required) - Base discount appliedcouponDiscount(required) - Coupon discount appliedtotalDiscount(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 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
{
"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"
}