Registering for Analytics
Initializing Analytics
To have VenueNext events reported to your preferred analytics tool, first create an object that conforms to the VNAnalyticsInterface
. The interface contains several functions that are called when events are triggered in the SDK.
Adding Your VNAnalyticsInterface
Once you’ve created your VNAnalyticsInterface
, pass an instance of it to the VenueNextWeb
object via the following API:
VenueNextWeb.configureAnalytics(MyAnalyticsInterface())
or
class MainActivity : AppCompatActivity(), VNAnalyticsInterface {
private lateinit var view: View
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
view = findViewById(R.id.fragment_main)
VenueNextWeb.initialize("<ORG_NAME>")
VenueNextWeb.configureAnalytics(this)
}
}
Tracking by Method Signature
override fun trackUserId(id: String)
- Triggered each time the User information is fetched via the webview, or when a User is created.
- Note: If you want to ensure this event is captured, make sure to add your
VNAnalyticsInterface
before presenting a webview page.
override fun trackUserAffiliations(affiliations: List<String>)
- Triggered when a User’s affiliations are fetched via the webview, such as season ticket holder member tiers.
- Currently reported when viewing the Wallet page or when attempting to purchase an experience in the marketplace.
override fun trackRvcSelection(
itemId: String,
itemName: String,
itemCategory: String
)
- Triggered when a user taps on a Revenue Center (RvC).
- This will work for F&B, Merch, & Experiences
override fun trackMenuItemSelection(
itemId: String,
itemName: String,
itemCategory: String,
variant: String,
price: Int
)
- Triggered when a user taps on an item being displayed in a Menu
- For Food and Beverage menus, this will provide the base price of an item
- For Experience menus, prices may vary based on which Event the user has selected:
- If the user has selected an event, the price of the item relative to that event will be provided
- If the user has not selected an event, the price of the item relative to the next event where the Experience is available will be provided
override fun trackBeginCheckout()
- Triggered when a user enters the Checkout screen
override fun trackAddItemToCart(
itemId: String,
itemName: String,
itemCategory: String,
variant: String,
price: Int,
quantity: Long
)
- Triggered when a user adds an item to their Cart
- For Food and Beverage menus, this will provide the base price of an item
- For Experience menus, currently this event will not be triggered - this will be updated in a future release
override fun trackRemoveItemFromCart(
itemId: String,
itemName: String,
itemCategory: String,
variant: String,
price: Double,
quantity: Long
)
- Triggered when a user removes an individual item from their cart at Checkout
override fun trackCompletedPurchase(
orderId: String,
quantity: Int,
discount: Int,
tips: Int,
tax: Int,
total: Int,
paymentTypes: String,
name: String?,
email: String?
)
- Triggered whenever a user completes a purchase, regardless of the order state.
override fun trackCheckoutProgress(orderId: String, state: String)
- Triggered once when the user completes a purchase at Checkout.
- Triggered every time the order state changes while the user is viewing the Receipt
Enabling/Disabling Analytics
Analytics are enabled by default. Meaning if not explicitly disabled, analytics events will be sent to a class conforming to the VNAnalyticsInterface
once it has been configured via VenueNextWeb.configureAnalytics(myAnalyticsInterface)
. However, analytics can be disabled/enabled with the use of the AnalyticsEnabledStatusProvider().setEnabledStatus(context: Context, enabled: Boolean)
method:
/**
* Sets a flag that dictates whether or not analytics are enabled. If disabled, no analytics
* events should be triggered.
*
* @param enabled: `true` if analytics events should be triggered. `false` otherwise.
*/
public final fun setEnabledStatus(context: Context, enabled: Boolean)
If disabled via this method, analytic events will not be triggered, even if VenueNextWeb.configureAnalytics(myAnalyticsInterface)
has been called. Therefore, it is safe to always configure the protocol if desired, even if analytics are disabled. If .setEnabledStatus(context, true)
is called later, analytic events will again be sent to the configured analytics protocol without the need to call .configureAnalytics(myAnalyticsInterface)
again.
This setting will also be persisted across app sessions. This means if .setEnabledStatus(context, false)
has been called previously, analytics will continue to be disabled, even if the app is hard-closed and opened again later, until .setEnabledStatus(context, true)
is called, or the app is deleted, thus clearing the app storage on the device.
The current status of wether VenueNext analytics are enabled or disabled can also be checked if desired via AnalyticsEnabledStatusProvider().setEnabledStatus(context: Context)
:
/**
* `true` if analytics events should be triggered. `false` otherwise.
*
* Defaults to `true` if never set. This means analytics are enabled by default.
*/
public final fun checkAnalyticsEnabledStatus(context: Context): Boolean
Reminder: Analytics are enabled by default and must explicitly be disabled if desired.