Event Tracking

Everything your customers do on your website or in your mobile application is recorded in the system in real time. Information such as the source of the visit, the URL address they have visited and the chain of actions that followed are saved in Synerise as an event.

The scope of information gathered about events is wide. Synerise collects predefined event parameters which can be extended according to the preferences and needs of the Synerise users.

The basic information about the tracked events includes:

  • Action – an indicator of the activity type, such as screen.view
  • Label – human-readable information about the activity, such as the page title
  • Time – the time when the event occurred
  • Customer identification – an identifier of the customer who performed the activity
  • Parameters – additional parameters, depending on the type of the event
Note: Some events are predefined, meaning they have a fixed set of fields that must be sent. For example, a product.view event must include the product ID.

You can enrich events with data from catalogs in Synerise, for example, a product or service event where only an ID has been provided can be enriched with other details such as the description, image URL, and more.

Note: Events are not sent in real time, they’re queued and in most circumstances that’s good compromise between how quick they are sent and battery life.

Automatically Tracked Activities


Auto-Tracking allows you to monitor each type of the customer activity in your mobile application. Every interaction such as click, swipe, view, with any element in the application can be sent as an event to Synerise together with a collection of details concerning the event, which are available in the overview on the customer card. The frequency and the kind of the tracked events are customizable, as you can switch on tracking a particular types of interactions.

Available modes for Auto-Tracking:

  • DISABLED - listeners are disabled (default).
  • EAGER - listeners are set to on-touch only.
  • PLAIN - listeners are set to on-click only.
  • FINE - listeners are attached to nearly everything in your app (even to activities and viewDidAppear, the method that records VisitedScreen events).

Auto-Tracking is disabled by default. In order to turn it on, you need to include the following configuration in your code:

Synerise.settings.tracker.autoTracking.enabled = true // 1
Synerise.settings.tracker.autoTracking.mode = .fine // 2
Synerise.settings.tracker.autoTracking.excludedClasses = [SNRSampleViewController.self] // 3
Synerise.settings.tracker.autoTracking.excludedViewTags = [1, 2] // 4
  1. It enables/disables Auto-Tracking.
  2. It sets Auto-Tracking mode.
  3. It is array of classes that have to be excluded from Auto-Tracking.
  4. It is array of tag numbers for views that have to be excluded from Auto-Tracking.
Note: Go to Settings - Auto-Tracking to see Auto-Tracking settings description too.

List of activities tracked automatically

Activity tracked Activity classes Action Label
All screen views in the application UIViewController screen.view View controllers name (eg. MyApp.ProductDetailsViewController)
All interactions with elements of the application UI UIButton
UISwitch
UISegmentedControl
UISlider
UIStepper
UIDatePicker
screen.interaction viewText or name of control type (if not able to read value)

Depending on the control type tracked, we try to automatically read and pass any values that are set depending on type, such as: time, date, position, progress, state, value, or if the control has been selected.

Declarative Tracking


Declarative tracking is a feature of our SDK that allows you to declare additional actions for tracking.

Product views, screen views, clicking a sign up button, contact with the call center, and more: you can implement anything and declarative tracking will help you to do that.

Basic event implementation

In the most basic scenario, you can pass a simple event as in the example below:

let event: CustomEvent = CustomEvent(label: "My label that will be visible on Activity Stream", action: "my.action")

Tracker.send(event)

Such events are passed to Synerise as the CustomEvent type, since the action can be anything that you want.

Parameterized event implementation

If you want to send more complex events, you can include additional parameters:

let parameters: TrackerParams = TrackerParams.make {
	builder in
	builder.setString("John", forKey: "name")
    builder.setString("Rise", forKey: "surname")
    builder.setString("Synerise", forKey: "company")
	builder.setInt(57, forKey: "age")
	builder.setBool(true, forKey: "isGreat")
	builder.setDouble(384.28, forKey: "lastOrder")
	builder.setInt(10, forKey: "count")
	builder.setObject(SampleObject(), forKey: "someObject")
}   

let event: CustomEvent = CustomEvent(label: "My label that will be visible on Activity Stream", action: "my.action", params: parameters)

Tracker.send(event)

Predefined events implementation

In Synerise, we have a set of predefined event types that require a minimum set of data for the backend.

This can be achieved by using Setters as in the example below:

let parameters: TrackerParams = TrackerParams.make {
    builder in
    builder.setString("12345", forKey: "campaignId")
    builder.setString("campaign12345", forKey: "campaignHash")
}     
let event: ProductViewEvent = ProductViewEvent(label: "Smartphone X", productName: "Smartphone X", productID:"SM-01-S", params: parameters)
event.setCategory("Smartphones")
event.setURL(URL(string: "myapp://products/SM-01-S")

Tracker.send(event)

You can replace ProductViewEvent with another event type. Event types are described below.

For more details, see the Tracker.Send() method reference.

Events


Session Events

Events related to a customer’s session.

Customer registered

This event may be used if you do not use Synerise registration/authentication features and rely fully on your own mechanisms, but still want to gather events about a customer registration.

Event name: SNRRegisteredEvent

let event: RegisteredEvent = RegisteredEvent(label: "LABEL")

Tracker.send(event)

Customer logged in

This event may be used if you do not use Synerise login/authentication features and rely fully on your own mechanisms, but still want to gather events about a customer logging in.

Event name: SNRLoggedInEvent

let event: LoggedInEvent = LoggedInEvent(label: "LABEL")

Tracker.send(event)

Customer logged out event

This event may be used if you do not use Synerise login/authentication features and rely fully on your own mechanisms, but still want to gather events about a customer logging out.

Event name: SNRLoggedOutEvent

let event: LoggedOutEvent = LoggedOutEvent(label: "LABEL")

Tracker.send(event)

Product Events

Group of events related to products and the cart.

Product viewed

This event should be used when Customer has viewed a product (or service) within your application.

Event name: SNRProductViewEvent

let event: ProductViewEvent = ProductViewEvent(label: "LABEL", productName: "PRODUCT_NAME", productId: "12345", params: nil)
event.setCategory("PRODUCT_CATEGORY")
event.setURL(URL(string: "PRODUCT_URL")!)
event.setIsRecommended(true)

Tracker.send(event)

Product added to favorites

Use this event type when a product is added to favorites in your application.

Event name: SNRAddedProductToFavoritesEvent

let event: AddedProductToFavoritesEvent = AddedProductToFavoritesEvent(label: "LABEL")

Tracker.send(event)

Product added to cart

Use this event type when a product is added to the cart in your application.

Event name: SNRAddedProductToCartEvent

let regularPrice: UnitPrice = UnitPrice(amount: 200)
let discountedPrice: UnitPrice = UnitPrice(amount: 100)
let finalPrice: UnitPrice = UnitPrice(amount: 100)

let event: AddedProductToCartEvent = AddedProductToCartEvent(label: "LABEL", sku: "SKU12345", finalPrice: finalPrice, quantity: 1)
event.setName("PRODUCT_NAME")
event.setCategory("PRODUCT_CATEGORY")
event.setCategories(["PRODUCT_CATEGORY_1", "PRODUCT_CATEGORY_2"])
event.setProducer("PRODUCT_PRODUCER")
event.setOffline(false)
event.setRegularPrice(regularPrice)
event.setDiscountedPrice(discountedPrice)
event.setURL(URL(string: "URL")!)

Tracker.send(event)

Product removed from cart

Use this event type when a product is removed from the cart in your application.

Event name: SNRRemovedProductFromCartEvent

let regularPrice: UnitPrice = UnitPrice(amount: 200)
let discountedPrice: UnitPrice = UnitPrice(amount: 100)
let finalPrice: UnitPrice = UnitPrice(amount: 100)

let event: RemovedProductFromCartEvent = RemovedProductFromCartEvent(label: "LABEL", sku: "SKU12345", finalPrice: finalPrice, quantity: 1)
event.setName("PRODUCT_NAME")
event.setCategory("PRODUCT_CATEGORY")
event.setCategories(["PRODUCT_CATEGORY_1", "PRODUCT_CATEGORY_2"])
event.setProducer("PRODUCT_PRODUCER")
event.setOffline(false)
event.setRegularPrice(regularPrice)
event.setDiscountedPrice(discountedPrice)
event.setURL(URL(string: "URL")!)

Tracker.send(event)

AI Recommendations

Recommendation clicked

Use this event type when a customer clicks a recommendation.

If you use our Widget to present recommendations, this event is tracked automatically.

Event name: SNRRecommendationClickEvent

let event: RecommendationClickEvent = RecommendationClickEvent(label: "LABEL", productName: "PRODUCT_NAME", productId: "12345", campaignID: "12345", campaignHash: "CAMPAIGN_HASH", params: nil)
event.setCategory("PRODUCT_CATEGORY")
event.setURL(URL(string: "PRODUCT_URL")!)

Tracker.send(event)

Recommendation seen

Use this event type when a customer sees a recommendation.

If you use our Widget to present recommendations, this event is tracked automatically.

Event name: SNRRecommendationSeenEvent

let event: RecommendationSeenEvent = RecommendationSeenEvent(label: "LABEL", productName: "PRODUCT_NAME", productId: "12345", campaignID: "12345", campaignHash: "CAMPAIGN_HASH", params: nil)
event.setCategory("PRODUCT_CATEGORY")
event.setURL(URL(string: "PRODUCT_URL")!)

Tracker.send(event)

Other Events

Uncategorized events related to customer’s location and actions.

Customer appeared in location

Use this event to record a customer’s presence at a location by passing geographic coordinates.

Event name: SNRAppearedInLocationEvent

let latitude: CLLocationDegrees = CLLocationDegrees(52.237049)
let longitude: CLLocationDegrees = CLLocationDegrees(21.017532)
let location: CLLocation = CLLocation(latitude: latitude, longitude: longitude)

let event: AppearedInLocationEvent = AppearedInLocationEvent(label: "LABEL", location: location)

Tracker.send(event)

Customer activity timer event

This could be used for profiling or activity time monitoring - you can send “hit timer” when your customer starts doing something and send it once again when the activity finishes, but this time with a different time signature. Then you can use our analytics engine to measure, for example, average activity time.

Event name: SNRHitTimerEvent

let event: HitTimerEvent = HitTimerEvent(label: "LABEL")

Tracker.send(event)

Customer searched event

This event is used when a customer searches for something and you want to track that activity in Synerise.

Event name: SNRSearchedEvent

let event: SearchedEvent = SearchedEvent(label: "LABEL")
        
Tracker.send(event)

Customer shared event

This event is used when a customer shares something from your application.

Event name: SNRSharedEvent

let event: SharedEvent = SharedEvent(label: "LABEL")

Tracker.send(event)

Customer visited a screen

This event is used when a customer visits a particular screen within your application.

Event name: SNRVisitedScreenEvent

let event: VisitedScreenEvent = VisitedScreenEvent(label: "LABEL")

Tracker.send(event)

Crash Event

This event is used when application crashes.

The event is sent automatically by Synerise SDK when you have Crash Handling enabled - Getting Started - Crash Handling.

Obviously, you can send it by yourself when you handle uncaught exception.

Event name: SNRCrashEvent

let event: CrashEvent = CrashEvent(label: "LABEL")
event.setExceptionName("EXCEPTION_NAME")
event.setExceptionReason("EXCEPTION_REASON")
event.setExceptionStacktrace("EXCEPTION_STACKTRACE")

Tracker.send(event)

Custom Event

This is the only event which requires the action field, as the field accepts custom action names.

Event name: SNRCustomEvent

let event: CustomEvent = CustomEvent(label: "My label that will be visible on Activity Stream", action: "my.action")

Tracker.send(event)
Important:
  • The custom action must follow the context.action convention. For example: screen.view, product.buy
  • The name must be up to 32 characters long and must match the following regular expression:
    ^[a-zA-Z0-9\.\-_]+$
    
😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.