Verify your integration works correctly before going to production.
free-test sandbox keyTRACIO ships a public test key, free-test, that you can use for local development and sandbox testing without provisioning your own key. Pass it to Tracio.init():
import { Tracio } from "@tracio/sdk"
const tracio = Tracio.init({ publicKey: "free-test" })const result = await tracio.getResult()console.log(result.visitorId, result.bot.detected)If you load the agent via the zero-build edge snippet, the same key works in the k query parameter:
<script src="https://edge.tracio.ai/s.js?k=free-test" async></script>Run this in the browser console of a page where the SDK is loaded to confirm it initializes and returns a result:
import { Tracio } from "@tracio/sdk"
const tracio = Tracio.init({ publicKey: "free-test" })const result = await tracio.getResult()console.assert(typeof result.visitorId === "string", "visitorId should be a string")console.assert(typeof result.bot.detected === "boolean", "bot.detected should be a boolean")console.log("Integration verified:", result.visitorId)In unit tests you typically do not want a real network call. Mock the Tracio module and assert that your code consumes getResult() correctly. With Vitest:
import { vi, test, expect } from "vitest"import { Tracio } from "@tracio/sdk"
vi.mock("@tracio/sdk", () => ({ Tracio: { init: () => ({ getResult: async () => ({ visitorId: "test-visitor-id", bot: { detected: false, confidence: 0 }, }), }), },}))
test("renders the visitor id", async () => { const tracio = Tracio.init({ publicKey: "free-test" }) const result = await tracio.getResult() expect(result.visitorId).toBe("test-visitor-id") expect(result.bot.detected).toBe(false)})You can also assert error handling by having the mocked getResult() reject with a TracioError.
To verify an identification result on your own server, use the TRACIO Server API. See the API Reference for the server-side endpoints and authentication.