Go SDK
Go SDK
Request ads from Go backends and services. HMAC signing is handled inside the client.
Install
Private GitLab modules need GOPRIVATE=git.yelle.software.
Go
export GOPRIVATE=git.yelle.software
go get git.yelle.software/yelle/saas/meridian-ads/sdks/goServe, render, click
Call Serve with a placement and user key, then Impression after render. Use ClickURL() on the decision for tracked redirects.
Go
package main
import (
"context"
"os"
meridianads "git.yelle.software/yelle/saas/meridian-ads/sdks/go"
)
func main() {
client, err := meridianads.New(meridianads.Config{
AppKey: os.Getenv("MERIDIAN_ADS_APP_KEY"),
Secret: os.Getenv("MERIDIAN_ADS_APP_SECRET"),
})
if err != nil {
panic(err)
}
dec, err := client.Serve(context.Background(), "home", "user-42", map[string]any{
"country": "US",
"plan": "pro",
})
if err != nil || dec == nil {
return
}
_ = client.Impression(context.Background(), dec.ImpressionToken())
_ = dec.ClickURL()
}