Skip to main content

Raw event data schema

note

Swrve logs the raw data for your apps to either Amazon S3 or Google Cloud Storage. This article covers the data schema for those raw events. For more information on setting up raw data export to an Amazon S3 or Google Cloud Storage bucket, see our setup guide.

Data schema​

The schema the raw event export files follow is:

  • gzip compressed
  • one line of JSON encoded code (each line represents a single event)
  • each line is a JSON dictionary with the following keys: user, time, client_time, type, app_version, payload, parameters, seqnum, version, device_id

Type​

type represents the event type sent to the Swrve API. It may be one of:

  • event
  • user
  • purchase
  • currency_given
  • iap
  • session_start
  • session_end

User​

user represents the user identifier sent to the Swrve API with the event (or batch of events).

Time​

time represents the time recorded on the Swrve server when the event was received. This is an integer that represents the number of milliseconds since the epoch.

Client time​

client_time represents the client time sent to Swrve with event. This is an integer that represents the number of milliseconds since the epoch.

App version​

app_version represents the app_version identifier sent to the Swrve API with the event (or batch of events).

Payload​

payload represents the optional payload information added to the event. payload is a dictionary of string / integer / boolean values.

Parameters​

parameters contains a dictionary of data sent to the Swrve API with the event. The dictionary fields depend on event_type. These parameters match the REST API.

ParameterFields
eventname, user_initiated
userattributes, user_initiated
purchaseitem, currency, cost, quantity
currency_givengiven_currency, given_amount
iapPlatform dependant
session_startNone
session_endNone

Seqnum, version, device ID​

  • seqnum, version, and device_id are internal and are used for debugging.

Campaign events​

Swrve campaign events are logged in two formats, generic or custom, depending on the channel and action type in question. Generic campaign events use a common event name, with differentiators for channel, action and campaign ID stored within the event payloads. In contrast, custom campaign events encode the channel, action, and campaign ID within the event name itself. For examples, see Custom campaign event format below. The following table provides a breakdown of channels and actions by format:

ChannelActions in generic formatActions in custom format
Pushsent
delivered
influenced
button_click
rejected
engaged
In-app messagespage_view
dismiss
navigation
Impression
Click
Embedded campaignsImpression
Click
Geo notificationsimpression
engaged
button_click

Generic campaign event format​

Campaign touchpoints that are tracked as generic Swrve campaign events will have an event name of Swrve.generic_campaign_event and the following JSON format in the S3 raw logs:

{
"id": "...",
"campaignType": "...",
"actionType": "...",
"contextId":"...",
"payload": {
"key1": "...",
"...": "..."
}
}

where:

PropertyDescription
idThis is the tracking ID of the campaign event.

Use this ID to map the raw data to campaign metadata such as name, dashboard URL, and other attributes via the Campaign Meta Data API.
campaignTypeThis indicates what channel the campaign has been run on:
  • push
  • iam
  • geo
  • push_inbox
  • embedded
actionTypeThis indicates the action of the touchpoint being tracked.
Possible values include:

  • sent – Recorded when the push service provider (for example, APNs or FCM) acknowledges a successful send request from Swrve.
  • delivered – Recorded when the notification is successfully received on the device.
  • influenced – Recorded when the user opens the app within 12 hours of receiving the notification, indicating indirect engagement.
  • button_click – Recorded when the user interacts with one of the notification’s custom buttons.
  • rejected – Recorded when the notification fails to send—either because it was rejected by Swrve before dispatch, or by the push service provider (for example, due to invalid credentials or expired tokens).
  • page_view – Recorded when an in-app message page is displayed (multi-page campaigns only).
  • navigation – Recorded when the user navigates between pages in a multi-page in-app message campaign.
  • dismiss – Recorded when the user closes or dismisses the in-app message.
  • engaged, read, delete – Actions specific to push_inbox messages (for example, message read, deleted, or opened).
contextIdRepresents the contextual identifier associated with the event:

  • For in-app message events: corresponds to the pageId.
  • For push button_click events: corresponds to the buttonId.
payload
displayed
This indicates if the notification was displayed (true or false).
reason
This provides a reason if the notification is not displayed (false). The possible values include:

  • permission_denied - the user has disabled notifications for the app.
  • stopped - the SDK stopped tracking user activity (that is, no user was logged in) and the notification was set to only display for identified users.
  • different_user - the notification was set to display only if the current user ID is the same as the user who was last logged into the app. For more information on authenticated push, see Tracking your users with Swrve User Identity.
  • Unregistered/NotRegistered - the push token was invalid or expired.
  • silent
    This indicates whether the event is associated with a background app update (true) or push notification (false).
    platform
    The platform or channel on which the message was delivered (for example, ios, android, web, or push_inbox).
    delta
    The time in minutes between when the device receives the notification and when the user subsequently opens the app (influenced events only).
    buttonId
    The ID of the button used to dismiss the campaign or navigate between pages in a multi-page campaign.
    buttonName
    The name of the button used to dismiss the campaign in a multi-page campaign.
    buttonText
    The text label of a push notification button.
    pageName
    The name of the page the action occurred on.
    to
    The ID of the page the user navigated to from the current page (used in navigation events).
    messageId
    The unique identifier of a Push Inbox message.
    state
    The current Push Inbox message state (for example, read or unread).

    Example event​

    {
    "type": "generic_campaign_event",
    "time": 123,
    "seqnum": 1,
    "actionType": "delivered",
    "campaignType": "push",
    "id": "1",
    "payload": {
    "displayed": "false",
    "reason": "permission_denied",
    "silent": "false"
    }
    }

    Custom campaign event format​

    Campaign touchpoints that are tracked as custom Swrve campaign events will encode tracking ID, campaign type, and action type in the event name, rather than the payload:

    ChannelActionsEvent name schema
    PushEngagedSwrve.Messages.Push-<ID>.engaged
    In-app messagesImpression
    Click
    Swrve.Messages.Message-<ID>.impression
    Swrve.Messages.Message-<ID>.click
    Embedded campaignsImpression
    Click
    Swrve.Messages.Message-<ID>.impression
    Swrve.Messages.Message-<ID>.click

    Where <ID> is the tracking ID. Use the raw event name to map from the log entry to relevant campaign metadata such as name, dashboard URL, and so forth via the Campaign Meta Data API.

    Swrve campaign events have the following JSON format in the S3 raw logs:

    {
    "name": "...",
    "payload": {
    "key1": "...",
    "...": "..."
    }
    }

    where:

    PropertyDescription
    nameThe event name that identifies the campaign, channel, and user action.

    The possible action types include:
    • engaged - Recorded when the user interacts directly with a push notification.
    • impression - Recorded when an in-app message or embedded campaign is displayed to the user.
    • click - Recorded when the user taps or selects an interactive element containing a call-to-action (for example, a deeplink or copy-to-clipboard button). Dismiss actions are not recorded as clicks.
    payload
    platform
    The platform or channel where the campaign was delivered (for example, ios, android, or web).
    deviceType
    The device type associated with the event (for example, mobile or tv).
    embedded
    Indicates whether the event is associated with an embedded campaign (true) or a standard in-app message (false).
    contextId
    Represents the contextual identifier associated with the event.
    For in-app message campaigns, this corresponds to the pageId of the in-app message.
    buttonId
    The ID of the button the user interacted with in an in-app message.
    name
    The name or label of the button or element that triggered the click event.
    pageName
    The name of the page where the interaction occurred (for example, the in-app message page name).

    Example event​

    {
    "type": "event",
    "time": 123,
    "seqnum": 1,
    "name": "Swrve.Messages.Message-646079.click",
    "payload": {
    "embedded": "false",
    "contextId": 207747,
    "name": "Button 1",
    "buttonId": 259418,
    "pageName": "Page 3",
    }
    }

    Push sent and delivered events​

    The raw S3 logs also include Push Sent and Delivered events, both in generic campaign event format.

    Push Sent events are logged server-side, so are independent of all SDK flavors and require no SDK update. The deciding factor for Push Sent is what type of push.

    Push TypePush Sent events logged
    StandardYes
    Via APIYes
    QuickYes
    Geo-triggeredNo - impression event logged from SDK

    Push Delivered events are logged client-side, so require an SDK update. They are also not supported by all of our SDKs yet.

    SDK platformPush Delivered events logged
    iOSYes
    AndroidYes
    AmazonYes
    UnityYes
    CordovaNo
    WebNo

    Need help with Queries?

    MessageGears support can help you with parsing and ETL of the data schema described above. If you need help with your queries, contact our Data Services team at support@messagegears.com. They will help you get the most out of your data with dedicated support, pre-built and custom reports, and dedicated data science hours.