Ontvang en verifieer identificatie-webhooks in Go (standaardbibliotheek). Voeg binnen enkele minuten bezoekersidentificatie, botdetectie en smart signals toe aan je Go-applicatie.
Voeg de SDK toe aan je project met je favoriete package manager.
npm install net/httpyarn add net/httppnpm add net/httpGa van start met de minimale 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)}Productieklare patronen met foutafhandeling, laadstatussen en geavanceerde configuratie.
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))}Alle beschikbare opties voor het initialiseren en configureren van de SDK.
publicKeystringJe public key uit het dashboard — veilig om in de browser mee te sturenendpointstringAangepaste endpoint-URL voor proxy-gerouteerde deployments — een expliciete URL gaat vóór regionregionstringDataregio: us of eutimeoutMsnumberTime-out voor de hele getResult()-call, in millisecondenlinkedIdstringJe interne account-ID van de ingelogde gebruiker, zodat bezoeken vanaf hetzelfde apparaat gekoppeld kunnen wordentagstringVrij label dat aan het identificatieverzoek wordt gekoppeld, bijv. checkout of logindebugbooleanLogt de levenscyclus van het script en netwerkactiviteit naar de browserconsolescriptUrlstringVolledige override van de URL van het agentscript — voor self-hosting of Subresource IntegrityGa dieper met de volledige API-referentie, webhookconfiguratie en geavanceerde gidsen.
Volledige API-referentie, integratiegidsen en best practices.
Realtime event-levering, payload-schema en handtekeningverificatie.
Configureer realtime eventmeldingen voor elke device-identificatie.
Voeg in minder dan 5 minuten device-fingerprinting toe aan je Go-applicatie.