Hi Folks,
I’m having issues seeing events in good or bad stream with the latest golang tracker v3.
The following is my code. I added the print statement at the end to confirm what’s supposed to be sent. in terms of data and I’m seeing the print statement with no issues.
I’m wondering if someone else has run into similar issues. I’m assuming building the executable and running it will mean the emitter sends the event without any other setup required for the golang program.
I tried GET
and POST
as well as http
and https
. true
and false
for encoding as well.
Additionally, I inspected the network requests leaving my machine using a proxy (Charles) and the url that was receiving these events was https://api.apple-cloudkit.com and not the collectorUri for some reason.
Any help would be appreciated.
package main
import "fmt"
import storagememory "github.com/snowplow/snowplow-golang-tracker/v3/pkg/storage/memory"
import sp "github.com/snowplow/snowplow-golang-tracker/v3/tracker"
func main() {
subject := sp.InitSubject()
subject.SetUserId("go-cms");
subject.SetDomainUserId("client-domain-user-id");
emitter := sp.InitEmitter(
sp.RequireCollectorUri("company-name.mini.snplow.net"),
sp.RequireStorage(*storagememory.Init()),
sp.OptionRequestType("POST"),
sp.OptionProtocol("https"),
)
tracker := sp.InitTracker(
sp.RequireEmitter(emitter),
sp.OptionSubject(subject),
sp.OptionAppId("company-app-id"),
sp.OptionBase64Encode(true),
);
// Create a data map of the content event
data := map[string]interface{}{
"action": "publishedArticle",
"contentId": "j302",
}
// Create a new SelfDescribingJson
sdj := sp.InitSelfDescribingJson("iglu:com.company/company_schema/jsonschema/1-0-0", data)
tracker.TrackSelfDescribingEvent(sp.SelfDescribingEvent{
Event: sdj,
Subject: subject,
})
fmt.Println("eventSent", sdj);
}