Track Inbox Message Opens

Call the trackInboxOpenEvent() to track analytics for Inbox messages and send them to Marketing Cloud. We automatically provide analytical information for message downloads.

To record analytics, call trackMessageOpened with an inbox message dictionary. These examples show how to track inbox opens in a table view.

For SDK version 10 and later, use this example.

1func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
2  let inboxMessage = dataSourceArray[indexPath.row]
3  MarketingCloudSdk.requestSdk { mc in
4    mc?.trackMessageOpened(inboxMessage)
5  }
6  // Your selection handling
7}

For SDK version 8, use this example.

1func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
2    let inboxMessage = dataSourceArray[indexPath.row]
3    SFMCSdk.requestPushSdk { mp in
4        mp.trackMessageOpened(inboxMessage)
5    }
6    // ... your selection handling
7}

For SDK version 7, use this example.

1func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
2    let inboxMessage = dataSourceArray[indexPath.row]
3    MarketingCloudSDK.sharedInstance().sfmc_trackMessageOpened(inboxMessage)
4    // ... your selection handling
5}