Skip to content
PricingDocs
All Integrations
Go

Device Intelligence for Go

Server-side event verification with the official Go SDK. Add visitor identification, bot detection, and smart signals to your Go application in minutes.

Quick Install

Add the SDK to your project with your preferred package manager.

npmnpm install github.com/tracio-ai/tracio-go
yarnyarn add github.com/tracio-ai/tracio-go
pnpmpnpm add github.com/tracio-ai/tracio-go

Basic Usage

Get up and running with the minimal setup.

$go
package main
import (
"fmt"
tracio "github.com/tracio-ai/tracio-go"
)
func main() {
client := tracio.NewClient("your-secret-key")
event, _ := client.GetEvent(requestID)
fmt.Println(event.VisitorID)
}

Advanced Patterns

Production-ready patterns with error handling, loading states, and advanced configuration.

HTTP Middleware with Bot Blocking — Click to expand
package main
import (
"log"
"net/http"
tracio "github.com/tracio-ai/tracio-go"
)
func main() {
client := tracio.NewClient("your-secret-key")
http.HandleFunc("/api/checkout", func(w http.ResponseWriter, r *http.Request) {
requestID := r.Header.Get("X-Tracio-Request-ID")
event, err := client.GetEvent(requestID)
if err != nil {
http.Error(w, "Verification failed", http.StatusBadGateway)
return
}
if event.Bot.Result != "notDetected" {
http.Error(w, "Bot detected", http.StatusForbidden)
return
}
if event.Confidence < 0.9 {
http.Error(w, "Low confidence", http.StatusUnauthorized)
return
}
log.Printf("Visitor %s verified (confidence: %.3f)",
event.VisitorID, event.Confidence)
w.WriteHeader(http.StatusOK)
})
log.Fatal(http.ListenAndServe(":8080", nil))
}

Configuration Options

All available options for initializing and configuring the SDK.

apiKeystringYour API key from the dashboard
endpointstringCustom endpoint URL for proxy-routed deployments
regionstringData region (us, eu, ap)
timeoutnumberRequest timeout in milliseconds
extendedResultbooleanAdds bot detection, incognito mode flags, and smart signals
linkedIdstringCustom identifier to associate visits (e.g. user ID or session ID)