Overview
This document outlines how to publish user events and user attributes using the Auxia system on Pub/Sub. It covers the message format Auxia expects, the schemas, and samples of the resulting messages from Pub/Sub.Client Requirements
To set up Pub/Sub integration, please provide:-
Topic Name (Full Path)
- Example:
projects/my-company/topics/user-events
- Example:
-
Permission on the Topic
- Grant Auxia’s service account (
data-transfer@auxia-gcp.iam.gserviceaccount.com) thepubsub.subscriptions.createpermission on the above topic, allowing us to create a subscription on our end.
- Grant Auxia’s service account (
Message format requirements
Each message published to the topic must follow these requirements so that Auxia can process it:- The message data is a binary-encoded protobuf. Serialize each
LogEventsRequest(events) orUserAttributePb(user attributes) with the standard protobuf binary encoding, for exampleSerializeToString()in Python ortoByteArray()in Java and Kotlin, and publish the resulting bytes as the message data. Textproto and JSON payloads are not supported. The textproto samples on this page are shown for readability only. - Each message has a
data_typeattribute. Set it toEventDatafor events andUserAttributefor user attributes.
Use the Auxia schemas for events and user attributes exactly as written, including field names, field numbers, and types. Messages that do not follow these requirements cannot be processed.
Events:
Schema for User Events:
Please refer to the schema specified in the documentation for Event Transaction data. Use the exact schema provided at the following link: Auxia User Events Schema.Textproto Format for Publishing Events:
The sample below shows aLogEventsRequest in textproto for readability. Publish it as a binary-encoded protobuf, as described in Message format requirements. The schema for the LogEventsRequest and ExternalEventPb messages is as per the documentation.
Sample textproto:
Sample Message Pulled from Pub/Sub:
Decoding the Message from Pub/Sub:
After pulling the message from Pub/Sub, it needs to be decoded into a readable format. The data field in the message contains a base64-encoded string. This string must be decoded into a JSON structure that matches the schema of the LogEventsRequest. Sample decoded message:User Attributes:
Schema for User Attributes:
Please refer to the documentation of User Attributes. Use the exact schema below:Textproto Format for Publishing User Attributes:
The sample below shows aUserAttributePb in textproto for readability. Publish it as a binary-encoded protobuf, as described in Message format requirements. The schema for the UserAttributePb message is as per the schema mentioned above.
Sample textproto: