Receive and verify identification webhooks in Go (standard library). Add visitor identification, bot detection, and smart signals to your Go application in minutes.
Add the SDK to your project with your preferred package manager.
npm install net/httpyarn add net/httppnpm add net/httpGet up and running with the minimal setup.
package mainimport ( "fmt" "io" "net/http")func main() { http.HandleFunc("/webhook/tracio", func(w http.ResponseWriter, r *http.Request) { body, _ := io.ReadAll(r.Body) // verify r.Header.Get("X-Tracio-Signature") against body, then act fmt.Println(string(body)) w.WriteHeader(http.StatusOK) }) http.ListenAndServe(":8080", nil)}Production-ready patterns with error handling, loading states, and advanced configuration.
package mainimport ( "crypto/hmac" "crypto/sha256" "encoding/hex" "encoding/json" "io" "log" "net/http" "os" "strings")type Event struct { VisitorID string `json:"visitorId"` Bot struct { Result string `json:"result"` } `json:"bot"` Decision struct { RiskScore int `json:"riskScore"` } `json:"decision"`}// verify recomputes the HMAC-SHA256 over "<t>.<rawBody>" and compares it.func verify(body []byte, header, secret string) bool { parts := map[string]string{} for _, kv := range strings.Split(header, ",") { if p := strings.SplitN(kv, "=", 2); len(p) == 2 { parts[p[0]] = p[1] } } mac := hmac.New(sha256.New, []byte(secret)) mac.Write([]byte(parts["t"] + ".")) mac.Write(body) expected := hex.EncodeToString(mac.Sum(nil)) return hmac.Equal([]byte(expected), []byte(parts["v1"]))}func main() { secret := os.Getenv("TRACIO_WEBHOOK_SECRET") http.HandleFunc("/webhook/tracio", func(w http.ResponseWriter, r *http.Request) { body, _ := io.ReadAll(r.Body) if !verify(body, r.Header.Get("X-Tracio-Signature"), secret) { http.Error(w, "Invalid signature", http.StatusUnauthorized) return } var e Event if err := json.Unmarshal(body, &e); err != nil { http.Error(w, "Bad payload", http.StatusBadRequest) return } if e.Bot.Result == "bot" || e.Decision.RiskScore > 50 { log.Printf("flagging visitor %s (bot=%s risk=%d)", e.VisitorID, e.Bot.Result, e.Decision.RiskScore) } w.WriteHeader(http.StatusOK) }) log.Fatal(http.ListenAndServe(":8080", nil))}All available options for initializing and configuring the SDK.
publicKeystringYour public key from the dashboard — safe to ship in the browserendpointstringCustom endpoint URL for proxy-routed deployments — an explicit URL wins over regionregionstringData region: us or eutimeoutMsnumberTimeout for the whole getResult() call, in millisecondslinkedIdstringYour internal account ID for the signed-in user, so visits sharing a device can be linkedtagstringFree-form label attached to the identification request, e.g. checkout or logindebugbooleanLogs the script lifecycle and network activity to the browser consolescriptUrlstringFull override for the agent script URL — for self-hosting or Subresource IntegrityGo deeper with the full API reference, webhook configuration, and advanced guides.
Full API reference, integration guides, and best practices.
Real-time event delivery, payload schema, and signature verification.
Configure real-time event notifications for every device identification.
Add device fingerprinting to your Go application in under 5 minutes.