Jam.Metadata
Include custom debug data in every bug report
Last updated
Include custom debug data in every bug report
Last updated
With one function call, jam.metadata()
, you can ensure that every Jam submitted from your website includes the metadata you need to debug the bug.
You can log anything in Jam.Metadata: simple static values like User ID, to any data like redux or react state. Whatever you need to debug, just send it to Jam.Metadata so it's always there for you in any ticket.
First, install the Jam SDK into your project:
Once the script is included, you can start using the jam.metadata
function to include debug information with every Jam a user files on your site:
Now, your metadata will be shown inside every Jam filed from your site!
Beyond static values and local variables, you can also pass in:
State from your app stores (for example: user ID, team ID, the last 5 items in your user's checkout cart, which feature flags are enabled, etc.)
Values from localStorage
Whatever data you need to debug your bugs!
To see this live, try going to our example site and creating a Jam! This example site already has Jam.Metadata integrated, so as soon as you capture any kind of Jam, we'll include up-to-date debugging info.
Your Jam should include metadata that looks like the following:
Objects provided will be expanded and pretty-printed when you click on them:
The live code for is here, and the jam.metadata()
call is here, for your reference. This demo shows a realistic example of how to include data from a store. In this case, we use MobX for state management, but you can pull from Redux, Zustand, or any other store you prefer.
Metadata is captured when a bug reporter decides to create a Jam.
When calling jam.metadata()
, keep in mind that the returned metadata object must be:
An Object
instance (for example, { a: 1, b: 2}
, and not window
, which is a Window
instance)
Under 10kb in size, when serialized.
Serializable. If JSON.stringify
can't stringify it, we can't store it!
If your app throws an error, or the above conditions aren't met, Jam will both log in your browser's live console, and display an error when the Jam is captured:
As always, if you have suggestions or requests for the Jam.metadata feature, or the direction our SDK should evolve in, our inbox is open at hello@jam.dev!