JavaScript API
The snippet's first line defines a stub Rawrrr object, so Rawrrr.log() and Rawrrr.setContext() can be called before the widget has loaded: they are queued with their timestamps. The other calls work once the widget has loaded (wait for the window load event).
| Call | What it does |
|---|---|
Rawrrr.open() | Opens the report window, as if the visitor tapped the tiger. Use it for your own "Report a problem" link. |
Rawrrr.tickets() | Opens the visitor's own tickets. |
Rawrrr.setAppVersion(v) | Sets the version string attached to reports, for apps that know it only at runtime. |
Rawrrr.setContext({ ... }) | Attaches small pieces of app state, such as the current piece or chapter, to reports. |
Rawrrr.log(message, data?) | Records a descriptive event of what the user is doing, for the "Last moments" story. See Describing what users do. |
Rawrrr.timeline() | Returns the "Last moments" text as the AI helper would see it, for checking your instrumentation. |
data-rawrrr="Name" | An attribute that gives an element a human name in recorded clicks. |
Example
<button type="button" id="report">Report a problem</button>
<script>
document.getElementById("report").addEventListener("click", () => Rawrrr.open());
Rawrrr.setAppVersion("2.4.1");
Rawrrr.setContext({ piece: "Nocturne in E-flat", measure: 12 });
</script>
Guidance for context
- Keep it small and factual: ids, names, positions.
- Never put personal data or secrets in it. Context is attached to the report and, on a public repo, may end up in the public text or in the private attachment depending on what it is. See public and private repos.