feat(provider/tracify): add staging mode config

This commit is contained in:
Kevin Franklin Kim 2024-12-09 11:16:19 +01:00
parent 84131bd076
commit 53e4b278dd
No known key found for this signature in database
4 changed files with 12 additions and 3 deletions

View File

@ -11,6 +11,8 @@ type Tracify struct {
Token string `json:"token" yaml:"token"`
// Tracify customer site id
CustomerSiteID string `json:"customerSiteId" yaml:"customerSiteId"`
// Enable stating mode
StagingModeEnabled bool `json:"stagingModeEnabled" yaml:"stagingModeEnabled"`
// Google Consent settings
GoogleConsent GoogleConsent `json:"googleConsent" yaml:"googleConsent"`
// Google Tag Manager server container settings

View File

@ -64,7 +64,7 @@ func Server(l *slog.Logger, tm *tagmanager.TagManager, cfg config.Tracify) error
return errors.Wrap(err, "failed to upsert event trigger: "+event)
}
if _, err := tm.UpsertTag(servertagx.NewTracify(event, token, customerSiteID, tagTemplate, eventTrigger)); err != nil {
if _, err := tm.UpsertTag(servertagx.NewTracify(event, token, customerSiteID, tagTemplate, cfg, eventTrigger)); err != nil {
return err
}
}

View File

@ -1,6 +1,9 @@
package tag
import (
"strconv"
"github.com/foomo/sesamy-cli/pkg/config"
"github.com/foomo/sesamy-cli/pkg/utils"
"google.golang.org/api/tagmanager/v2"
)
@ -9,7 +12,7 @@ func TracifyName(v string) string {
return "Tracify - " + v
}
func NewTracify(name string, token, customerSiteID *tagmanager.Variable, template *tagmanager.CustomTemplate, triggers ...*tagmanager.Trigger) *tagmanager.Tag {
func NewTracify(name string, token, customerSiteID *tagmanager.Variable, template *tagmanager.CustomTemplate, cfg config.Tracify, triggers ...*tagmanager.Trigger) *tagmanager.Tag {
return &tagmanager.Tag{
FiringTriggerId: utils.TriggerIDs(triggers),
Name: TracifyName(name),
@ -28,7 +31,7 @@ func NewTracify(name string, token, customerSiteID *tagmanager.Variable, templat
{
Key: "isStagingMode",
Type: "boolean",
Value: "false",
Value: strconv.FormatBool(cfg.StagingModeEnabled),
},
{
Key: "token",

View File

@ -535,6 +535,10 @@
"type": "string",
"description": "Tracify customer site id"
},
"stagingModeEnabled": {
"type": "boolean",
"description": "Enable stating mode"
},
"googleConsent": {
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.GoogleConsent",
"description": "Google Consent settings"