Integrating Custom Analytics

The Zappar component automatically collects and transmits anonymous usage data to the ZapWork's built in analytics system, Zapalytics. You can view this aggregated data from your ZapWorks account.

In addition to this, you may like to report information to a different analytics system used by your app, e.g. Google Analytics. The Zappar component provides a number of useful callbacks, allowing you to forward relevant events to your own system should you wish to do so.

Further to this documentation, the example project included with the Zappar embed component for iOS demonstrates use of these callbacks.

Adding the Methods

In the Integrating with your iOS app step, an extension was added to your ViewController to provide the exit functionality for the Zappar component. You can add further methods to that extension to be notified of analytics events like this:

extension ViewController: ZapparDelegate {

    func zapparClose() {
        self.dismiss(animated: true)
    }

    //// ANALYTICS
    //// These optional methods can be used to send Zappar embed events
    //// to your analytics system of choice, e.g. Google Analytics

    func zapparAnalyticsExperienceSessionDidStart(_ deepLinkId: String!) {
        // Is called when an AR experience starts
    }

    func zapparAnalyticsExperienceSessionDidEnd(_ deepLinkId: String!) {
        // Is called when an AR experience ends
    }

    func zapparAnalyticsExperienceSession(_ deepLinkId: String!, didSendCustomEvent eventName: String!) {
        // Is called when an AR experience emits a custom event
        // These events can triggered from script within an AR experience using:
        // Z.stats.logEvent("...");
    }
}

Suggested Next Steps

zapcode branded_zapcode i