Hi,
I have installed Snowplow successfully, and JS tracker is working fine and I am able to see the events in our database.
But the events from the Golang tracker don’t end up in the database. This is my code:
package snowplow
import (
sp "github.com/snowplow/snowplow-golang-tracker/v2/tracker"
)
var (
emitter *sp.Emitter
tracker *sp.Tracker
subject *sp.Subject
)
type Event struct {
Category string
Action string
Label string
Subject *sp.Subject
}
func Init() {
subject = sp.InitSubject()
emitter = sp.InitEmitter(
sp.RequireCollectorUri("<collector-uri>"),
sp.OptionRequestType("POST"),
sp.OptionProtocol("https"),
sp.OptionSendLimit(500),
sp.OptionByteLimitGet(40000),
sp.OptionByteLimitPost(40000),
sp.OptionDbName("/mnt/c/Users/Marwan/snowplow.db"),
)
tracker = sp.InitTracker(
sp.RequireEmitter(emitter),
sp.OptionAppId("<app-id>"),
sp.OptionPlatform("backend"),
)
}
func Record(event Event) {
tracker.TrackPageView(sp.PageViewEvent{
PageUrl: sp.NewString("<some-url>"),
Subject: event.Subject,
})
}
Actually, I want to use TrackStructEvent
but it doesn’t work, and even TrackPageView
doesn’t work. What am I missing?