Ticket metadata
Every app is unique so the Data attached by default sent with each ticket are often not enough. That's why Shake also allows you to automatically attach any custom data from your app to the ticket.
How to use
To set ticket metadata, call Shake.setMetadata
and pass the data you want to
receive on your Shake dashboard as a String pair.
You can call Shake.setMetadata
anywhere in your app, but be careful because any subsequent calls with the same String key will override the former String value.
Let’s say you want to send yourself a roomID after a user successfully joins a chat room. You would do this:
- Javascript
- Typescript
const onChatRoomJoined = (room) => {Shake.setMetadata('roomId', room.id);}
const onChatRoomJoined = (room: Room) => {Shake.setMetadata('roomId', room.id);}
Clear Ticket metadata
If you want to clear existing ticket metadata, you can use the Shake.clearMetadata
method.
For example, you want to clear ticket metadata when the user leaves a chat room:
- Javascript
- Typescript
const onChatRoomClosed = () => {chatService.close();Shake.clearMetadata();}
const onChatRoomClosed = () => {chatService.close();Shake.clearMetadata();}
Examples
Use Ticket metadata to attach useful custom data to tickets. Examples are statuses of various app variables at the moment of ticket being sent:
- Current chat room ID
- List of items currently in a shopping cart
- Task synced true/false
- Number of search results
- List sorted by what
- Video muted true/false