Analytics Ingestion
Treasure’s Data Platform (codename Darkmatter) is a powerful, scalable and real-time streaming analytics service that allows developers to collect data from games. This data can be used to understand player behaviour, improve game design, and optimize your game’s performance. In the future, this data will power various downstream services such as player segmentation, A/B testing, and more.
Prepare your payload
Messages need to be in the following format, and multiple events can be included in the batch array.
Push analytics events to Treasure
From your backend, push your event payloads to our infra. You can choose from the following methods: Kafka, HTTP POST, or AWS SNS.
There is no need for you to set up your own Kafka cluster with this approach. Just send messages to a dedicated Redpanda Kafka topic that Treasure manages for you.
If you are using the Kafka option, prepare each payload as a single JSON object. If you need to batch them together, you can use the Kafka client API to send a batch of single messages.
- Receive Kafka client credentials (username, password, bootstrap URL) from Treasure.
- Send your JSON payloads using a Kafka producer client. Kafka client libraries are available in a number of languages. The following example is in TypeScript (assumes you have already installed
kafkajs@2.2.4
):
There is no need for you to set up your own Kafka cluster with this approach. Just send messages to a dedicated Redpanda Kafka topic that Treasure manages for you.
If you are using the Kafka option, prepare each payload as a single JSON object. If you need to batch them together, you can use the Kafka client API to send a batch of single messages.
- Receive Kafka client credentials (username, password, bootstrap URL) from Treasure.
- Send your JSON payloads using a Kafka producer client. Kafka client libraries are available in a number of languages. The following example is in TypeScript (assumes you have already installed
kafkajs@2.2.4
):
If you choose this step, let us know and in a private channel we’ll provide
you the {DATA_PLATFORM_URL}
and the X-API-Key
header value to use. Make a
POST call to https:// {DATA_PLATFORM_URL}/ingress/events
where the body of the quest is your event
payload JSON.
Make an HTTP POST call using your preferred method. This example uses the Axios HTTP client for Node.js.
If you choose this method, let us know and we’ll provide you the {TREASURE_AWS_ACCOUNT}
in a private channel.
- Create an SNS topic. Let’s say you called it
prod-events-for-treasure
. Then itstopicArn
is going to bearn:aws:sns:{your AWS region}:{your AWS account}:prod-events-for-treasure
. - Allow Treasure’s AWS account to subscribe to your SNS topic by adding this to your SNS topic’s access policy:
- Please tell us your SNS topic’s
topicArn
so we can update our infrastructure to subscribe to it. - Grant your own lambdas/servers
sns:Publish
permission to send payloads to the SNS topic. - Publish event payloads to your SNS topic. AWS SDKs support multiple languages. The following example is in TypeScript: