Skip to content

Sending arbitrary data when the user takes an action.

André Herculano edited this page Jun 23, 2023 · 4 revisions

Publisher Data

Sourcepoint's endpoints allow for consent information to be retrieved programatically via APIs. You can append information at two stages:

When calling load message

cmp.loadMessage(forAuthId: nil, publisherData: ["foo": AnyEncodable(99)])

or when the user takes an action:

func onAction(_ action: SPAction, from controller: UIViewController) {
    action.publisherData = [
      "myUserId": AnyEncodable("abcd"),
      "someOtherInfo": AnyEncodable([1, 2, 3])
    ]
}

The SDK will send an object encoding your data in the shape of:

{
  "pubData": {
    "myUserId": "abcd",
    "someOtherInfo": [1, 2, 3]
  }
}

PubData will be available to be consumed using one of Sourepoint's log APIs.