Registering for Analytics
Initializing Analytics
To have VenueNext events reported to your preferred analytics tool, first create a type conforming to AnalyticsAdapter
. The AnalyticsAdapter
protocol has two simple requirements:
func track(event: EventTrackable)
func track(name: String, metadata: [String: Any]?)
For example, here is how you might setup conformance to the protocol:
class MyAnalyticsAdapter: AnalyticsAdapter {
func track(event: EventTrackable) {
if event is PageViewEvent {
//Track page views
}
track(name: event.eventName, metadata: event.metadata)
}
func track(name: String, metadata: [String : Any]?) {
// track eveent with metadata dictionary
}
func set(userId: String?) {
// Here you may subscribe to get the VenuenNext User UUID.
}
init() {
// Do any initialization here
}
}
Then simply pass through an instance of your adapter to the Analytics initializer in your AppDelegate:
VNAnalytics.initialize(with: MyAnalyticsAdapter())
Triggered Events
Successful purchase
After a successful Experience, F&B, or Merch purchase, AnalyticsAdapter::track(name: String, metadata: [String : Any]?)
will fire with a name
of ECOMMERCE_PURCHASE
.
Sample metadata
:
▿ Optional<Dictionary<String, Any>>
▿ some : 7 elements
▿ 0 : 2 elements
- key : "TAX"
- value : 0.0
▿ 1 : 2 elements
- key : "AFFILIATION"
- value : "Unknown RvC - Unknown"
▿ 2 : 2 elements
- key : "items"
▿ value : 1 element
▿ 0 : 6 elements
▿ 0 : 2 elements
- key : "QUANTITY"
- value : 1
▿ 1 : 2 elements
- key : "CURRENCY"
- value : "USD"
▿ 2 : 2 elements
- key : "ITEM_NAME"
- value : "Halftime Magicgram (2 events - no scan)"
▿ 3 : 2 elements
- key : "ITEM_PRICE"
- value : 0
▿ 4 : 2 elements
- key : "ITEM_ID"
- value : "0155f31c-5dfd-42be-9a59-90a6417c24fb-3788d8c4-f06b-4bf2-843d-71e4ea9bf780"
▿ 5 : 2 elements
- key : "ITEM_CATEGORY"
- value : ""
▿ 3 : 2 elements
- key : "TRANSACTION_ID"
- value : "3788d8c4-f06b-4bf2-843d-71e4ea9bf780"
▿ 4 : 2 elements
- key : "VALUE"
- value : 0.0
▿ 5 : 2 elements
- key : "CURRENCY"
- value : "USD"
▿ 6 : 2 elements
- key : "CHECKOUT_PROGRESS"
- value : 4