Setting up page view events

The PageView object encapsulates information related to a user’s interactions and passes it to the Page View Event API. These session-based page view events can be seen in Agent Workspace by support agents using Zendesk.

Swift

Below is a code sample showing how to send a page view event.

The API accepts a PageView object as a parameter. Pass the location of the screen that the end user is on to url and the name of the screen to pageTitle.

// Create a `PageView` objectlet pageView = PageView(pageTitle: pageTitle, url: url)Zendesk.instance?.sendPageViewEvent(pageView) { result in    // Your custom result handling...}

Objective-C

Below is a code sample showing how to send a page view event.

The API accepts a PageView object as a parameter. Pass the location of the screen that the end user is on to url and the name of the screen to pageTitle.

// Get your Zendesk instance:Zendesk *instance = [Zendesk instance];// Create a PageViewZDKPageView *pageView = [[ZDKPageView alloc] initWithPageTitle:@"page title" url:@"www.example.com"];[zendesk sendPageViewEvent:pageView completionHandler:^(NSError *error) {    if (error != nil) {        // handle error    }}];