mirror of
https://github.com/foomo/sesamy-cli.git
synced 2025-10-16 12:35:36 +00:00
feat(provider/hotjar): add provider
This commit is contained in:
parent
427201c0c0
commit
5c56ceae20
43
README.md
43
README.md
@ -51,6 +51,7 @@ Add a `sesamy.yaml` configuration
|
||||
|
||||
```yaml
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/foomo/sesamy-cli/v0.4.1/sesamy.yaml
|
||||
# yaml-language-server: $schema=sesamy.schema.json
|
||||
version: '1.0'
|
||||
|
||||
# Whether to redact the visitor ip
|
||||
@ -68,49 +69,33 @@ googleApi:
|
||||
# --- Google Tag Manager settings
|
||||
googleTagManager:
|
||||
# The account id
|
||||
accountId: 6099238525
|
||||
accountId: '6099238525'
|
||||
# Web container settings
|
||||
webContainer:
|
||||
# The container tag id
|
||||
tagId: GTM-57BHX34G
|
||||
# The container id
|
||||
containerId: 175355532
|
||||
containerId: '175355532'
|
||||
# The workspace id that should be used by the api
|
||||
workspaceId: 23
|
||||
workspaceId: '23'
|
||||
# Server container settings
|
||||
serverContainer:
|
||||
# The container tag id
|
||||
tagId: GTM-5NWPR4QW
|
||||
# The container id
|
||||
containerId: 175348980
|
||||
containerId: '175348980'
|
||||
# The workspace id that should be used by the api
|
||||
workspaceId: 10
|
||||
workspaceId: '10'
|
||||
|
||||
# --- Google Tag settings
|
||||
googleTag:
|
||||
# A tag ID is an identifier that you put on your page to load a given Google tag
|
||||
tagId: G-PZ5ELRCR31
|
||||
# Whether a page_view should be sent on initial load
|
||||
sendPageView: true
|
||||
# Enable debug mode for all user devices
|
||||
debugMode: false
|
||||
# Google Tag Manager web container settings
|
||||
webContainer:
|
||||
# Contemplate package config for generated events
|
||||
packages:
|
||||
- path: github.com/foomo/sesamy-go/pkg/event
|
||||
types:
|
||||
- PageView
|
||||
- SelectItem
|
||||
# Google Tag Manager server container settings
|
||||
serverContainer:
|
||||
# Contemplate package config for generated events
|
||||
packages:
|
||||
- path: github.com/foomo/sesamy-go/pkg/event
|
||||
types:
|
||||
- PageView
|
||||
- SelectItem
|
||||
# Google Tag Manager web container settings
|
||||
# Whether a page_view should be sent on initial load
|
||||
sendPageView: true
|
||||
# TypeScript settings
|
||||
typeScript:
|
||||
# Target directory for generate files
|
||||
outputPath: path/to/target
|
||||
@ -175,7 +160,6 @@ googleTag:
|
||||
- ViewPromotion
|
||||
- WorkingLead
|
||||
|
||||
|
||||
# --- Google Analytics settings
|
||||
googleAnalytics:
|
||||
# Enable provider
|
||||
@ -291,13 +275,13 @@ facebook:
|
||||
apiAccessToken: ''
|
||||
# Code used to verify that your server events are received correctly by Conversions API
|
||||
testEventToken: ''
|
||||
# Google Tag Manager server container settings
|
||||
# Google Consent settings
|
||||
googleConsent:
|
||||
# Enable consent mode
|
||||
enabled: true
|
||||
# Consent mode name
|
||||
mode: ad_storage
|
||||
# Google Tag Manager server container settings
|
||||
serverContainer:
|
||||
# Contemplate package config for generated events
|
||||
packages:
|
||||
@ -360,6 +344,13 @@ tracify:
|
||||
- ViewItem
|
||||
- Purchase
|
||||
|
||||
# --- Hotjar
|
||||
hotjar:
|
||||
# Enable provider
|
||||
enabled: true
|
||||
# Hotjar site id
|
||||
siteId: 123456
|
||||
|
||||
# --- Cookiebot CMP
|
||||
cookiebot:
|
||||
# Enable provider
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
emarsysprovider "github.com/foomo/sesamy-cli/pkg/provider/emarsys"
|
||||
googleanaylticsprovider "github.com/foomo/sesamy-cli/pkg/provider/googleanalytics"
|
||||
googletagprovider "github.com/foomo/sesamy-cli/pkg/provider/googletag"
|
||||
hotjarprovider "github.com/foomo/sesamy-cli/pkg/provider/hotjar"
|
||||
"github.com/foomo/sesamy-cli/pkg/tagmanager"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
@ -60,6 +61,12 @@ func NewWeb(root *cobra.Command) {
|
||||
}
|
||||
}
|
||||
|
||||
if cfg.Hotjar.Enabled && pkgcmd.Tag(hotjarprovider.Tag, tags) {
|
||||
if err := hotjarprovider.Web(tm, cfg.Hotjar); err != nil {
|
||||
return errors.Wrap(err, "failed to provision hotjar provider")
|
||||
}
|
||||
}
|
||||
|
||||
if cfg.Cookiebot.Enabled && pkgcmd.Tag(cookiebotprovider.Tag, tags) {
|
||||
if err := cookiebotprovider.Web(tm, cfg.Cookiebot); err != nil {
|
||||
return errors.Wrap(err, "failed to provision cookiebot provider")
|
||||
|
||||
@ -5,6 +5,8 @@ import (
|
||||
"errors"
|
||||
"os"
|
||||
"path"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
testingx "github.com/foomo/go/testing"
|
||||
@ -22,6 +24,13 @@ func TestConfig(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
reflector := new(jsonschema.Reflector)
|
||||
reflector.RequiredFromJSONSchemaTags = true
|
||||
reflector.Namer = func(t reflect.Type) string {
|
||||
if t.Name() == "" {
|
||||
return t.String()
|
||||
}
|
||||
return strings.ReplaceAll(t.PkgPath(), "/", ".") + "." + t.Name()
|
||||
}
|
||||
require.NoError(t, reflector.AddGoComments("github.com/foomo/sesamy-cli", "./"))
|
||||
schema := reflector.Reflect(&config.Config{})
|
||||
actual, err := json.MarshalIndent(schema, "", " ")
|
||||
|
||||
@ -23,6 +23,8 @@ type Config struct {
|
||||
Facebook Facebook `json:"facebook" yaml:"facebook"`
|
||||
// Emarsys provider settings
|
||||
Emarsys Emarsys `json:"emarsys" yaml:"emarsys"`
|
||||
// Hotjar provider settings
|
||||
Hotjar Hotjar `json:"hotjar" yaml:"hotjar"`
|
||||
// Tracify provider settings
|
||||
Tracify Tracify `json:"tracify" yaml:"tracify"`
|
||||
// Umami provider settings
|
||||
|
||||
@ -5,9 +5,14 @@ import (
|
||||
)
|
||||
|
||||
type Emarsys struct {
|
||||
Enabled bool `json:"enabled" yaml:"enabled"`
|
||||
MerchantID string `json:"merchantId" yaml:"merchantId"`
|
||||
GoogleConsent GoogleConsent `json:"googleConsent" yaml:"googleConsent"`
|
||||
WebContainer contemplate.Config `json:"webContainer" yaml:"webContainer"`
|
||||
// Enable provider
|
||||
Enabled bool `json:"enabled" yaml:"enabled"`
|
||||
// Emarsys merchant id
|
||||
MerchantID string `json:"merchantId" yaml:"merchantId"`
|
||||
// Google Consent settings
|
||||
GoogleConsent GoogleConsent `json:"googleConsent" yaml:"googleConsent"`
|
||||
// Google Tag Manager web container settings
|
||||
WebContainer contemplate.Config `json:"webContainer" yaml:"webContainer"`
|
||||
// Google Tag Manager server container settings
|
||||
ServerContainer contemplate.Config `json:"serverContainer" yaml:"serverContainer"`
|
||||
}
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
package config
|
||||
|
||||
type GoogleTag struct {
|
||||
TagID string `json:"tagId" yaml:"tagId"`
|
||||
DebugMode bool `json:"debugMode" yaml:"debugMode"`
|
||||
SendPageView bool `json:"sendPageView" yaml:"sendPageView"`
|
||||
TypeScript TypeScript `json:"typeScript" yaml:"typeScript"`
|
||||
// A tag ID is an identifier that you put on your page to load a given Google tag
|
||||
TagID string `json:"tagId" yaml:"tagId"`
|
||||
// Enable debug mode for all user devices
|
||||
DebugMode bool `json:"debugMode" yaml:"debugMode"`
|
||||
// Whether a page_view should be sent on initial load
|
||||
SendPageView bool `json:"sendPageView" yaml:"sendPageView"`
|
||||
// TypeScript settings
|
||||
TypeScript TypeScript `json:"typeScript" yaml:"typeScript"`
|
||||
}
|
||||
|
||||
6
pkg/config/hotjar.go
Normal file
6
pkg/config/hotjar.go
Normal file
@ -0,0 +1,6 @@
|
||||
package config
|
||||
|
||||
type Hotjar struct {
|
||||
Enabled bool `json:"enabled" yaml:"enabled"`
|
||||
SiteID string `json:"siteId" yaml:"siteId"`
|
||||
}
|
||||
@ -5,9 +5,14 @@ import (
|
||||
)
|
||||
|
||||
type Tracify struct {
|
||||
Enabled bool `json:"enabled" yaml:"enabled"`
|
||||
Token string `json:"token" yaml:"token"`
|
||||
CustomerSiteID string `json:"customerSiteId" yaml:"customerSiteId"`
|
||||
GoogleConsent GoogleConsent `json:"googleConsent" yaml:"googleConsent"`
|
||||
// Enable provider
|
||||
Enabled bool `json:"enabled" yaml:"enabled"`
|
||||
// Tracify token
|
||||
Token string `json:"token" yaml:"token"`
|
||||
// Tracify customer site id
|
||||
CustomerSiteID string `json:"customerSiteId" yaml:"customerSiteId"`
|
||||
// Google Consent settings
|
||||
GoogleConsent GoogleConsent `json:"googleConsent" yaml:"googleConsent"`
|
||||
// Google Tag Manager server container settings
|
||||
ServerContainer contemplate.Config `json:"serverContainer" yaml:"serverContainer"`
|
||||
}
|
||||
|
||||
8
pkg/provider/hotjar/constants.go
Normal file
8
pkg/provider/hotjar/constants.go
Normal file
@ -0,0 +1,8 @@
|
||||
package hotjar
|
||||
|
||||
const (
|
||||
Tag = "hotjar"
|
||||
Name = "Hotjar"
|
||||
NameSiteID = "Hotjar Site ID"
|
||||
NameHotjarTag = "Hotjar"
|
||||
)
|
||||
31
pkg/provider/hotjar/web.go
Normal file
31
pkg/provider/hotjar/web.go
Normal file
@ -0,0 +1,31 @@
|
||||
package hotjar
|
||||
|
||||
import (
|
||||
"github.com/foomo/sesamy-cli/pkg/config"
|
||||
client "github.com/foomo/sesamy-cli/pkg/provider/hotjar/web/tag"
|
||||
"github.com/foomo/sesamy-cli/pkg/tagmanager"
|
||||
commonvariable "github.com/foomo/sesamy-cli/pkg/tagmanager/common/variable"
|
||||
)
|
||||
|
||||
func Web(tm *tagmanager.TagManager, cfg config.Hotjar) error {
|
||||
{ // create folder
|
||||
if folder, err := tm.UpsertFolder("Sesamy - " + Name); err != nil {
|
||||
return err
|
||||
} else {
|
||||
tm.SetFolderName(folder.Name)
|
||||
}
|
||||
}
|
||||
|
||||
{ // setup hotjar
|
||||
siteID, err := tm.UpsertVariable(commonvariable.NewConstant(NameSiteID, cfg.SiteID))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err = tm.UpsertTag(client.NewHotjar(NameHotjarTag, siteID)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
22
pkg/provider/hotjar/web/tag/hotjar.go
Normal file
22
pkg/provider/hotjar/web/tag/hotjar.go
Normal file
@ -0,0 +1,22 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"github.com/foomo/sesamy-cli/pkg/tagmanager/web/trigger"
|
||||
"google.golang.org/api/tagmanager/v2"
|
||||
)
|
||||
|
||||
func NewHotjar(name string, siteID *tagmanager.Variable) *tagmanager.Tag {
|
||||
ret := &tagmanager.Tag{
|
||||
FiringTriggerId: []string{trigger.IDAllPages},
|
||||
Name: name,
|
||||
Parameter: []*tagmanager.Parameter{
|
||||
{
|
||||
Key: "hotjar_site_id",
|
||||
Type: "template",
|
||||
Value: "{{" + siteID.Name + "}}",
|
||||
},
|
||||
},
|
||||
Type: "hjtc",
|
||||
}
|
||||
return ret
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package trigger
|
||||
|
||||
const (
|
||||
IDAllPages = "2147479553"
|
||||
IDInitialization = "2147479573"
|
||||
IDConsentInitializtion = "2147479572"
|
||||
)
|
||||
|
||||
@ -1,9 +1,42 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://github.com/foomo/sesamy-cli/pkg/config/config",
|
||||
"$ref": "#/$defs/Config",
|
||||
"$id": "https://github.com/foomo/sesamy-cli/pkg/config/github.com.foomo.sesamy-cli.pkg.config.-config",
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.Config",
|
||||
"$defs": {
|
||||
"Config": {
|
||||
"[]*contemplate.PackageConfig": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/github.com.foomo.gocontemplate.pkg.contemplate.PackageConfig"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"[]string": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"github.com.foomo.gocontemplate.pkg.contemplate.Config": {
|
||||
"properties": {
|
||||
"packages": {
|
||||
"$ref": "#/$defs/[]*contemplate.PackageConfig"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"github.com.foomo.gocontemplate.pkg.contemplate.PackageConfig": {
|
||||
"properties": {
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"types": {
|
||||
"$ref": "#/$defs/[]string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"github.com.foomo.sesamy-cli.pkg.config.Config": {
|
||||
"properties": {
|
||||
"version": {
|
||||
"type": "string",
|
||||
@ -14,85 +47,73 @@
|
||||
"description": "Globally redact visitor ip"
|
||||
},
|
||||
"googleTag": {
|
||||
"$ref": "#/$defs/GoogleTag",
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.GoogleTag",
|
||||
"description": "Google Tag settings"
|
||||
},
|
||||
"googleApi": {
|
||||
"$ref": "#/$defs/GoogleAPI",
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.GoogleAPI",
|
||||
"description": "Google API settings"
|
||||
},
|
||||
"googleTagManager": {
|
||||
"$ref": "#/$defs/GoogleTagManager",
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.GoogleTagManager",
|
||||
"description": "Google Tag Manager settings"
|
||||
},
|
||||
"googleAds": {
|
||||
"$ref": "#/$defs/GoogleAds",
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.GoogleAds",
|
||||
"description": "Google Ads provider settings"
|
||||
},
|
||||
"cookiebot": {
|
||||
"$ref": "#/$defs/Cookiebot",
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.Cookiebot",
|
||||
"description": "CookieBot provider settings"
|
||||
},
|
||||
"googleAnalytics": {
|
||||
"$ref": "#/$defs/GoogleAnalytics",
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.GoogleAnalytics",
|
||||
"description": "Google Analytics provider settings"
|
||||
},
|
||||
"conversionLinker": {
|
||||
"$ref": "#/$defs/ConversionLinker",
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.ConversionLinker",
|
||||
"description": "Conversion Linker provider settings"
|
||||
},
|
||||
"facebook": {
|
||||
"$ref": "#/$defs/Facebook",
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.Facebook",
|
||||
"description": "Facebook provider settings"
|
||||
},
|
||||
"emarsys": {
|
||||
"$ref": "#/$defs/Emarsys",
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.Emarsys",
|
||||
"description": "Emarsys provider settings"
|
||||
},
|
||||
"hotjar": {
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.Hotjar",
|
||||
"description": "Hotjar provider settings"
|
||||
},
|
||||
"tracify": {
|
||||
"$ref": "#/$defs/Tracify",
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.Tracify",
|
||||
"description": "Tracify provider settings"
|
||||
},
|
||||
"umami": {
|
||||
"$ref": "#/$defs/Umami",
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.Umami",
|
||||
"description": "Umami provider settings"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"version",
|
||||
"redactVisitorIp",
|
||||
"googleTag",
|
||||
"googleApi",
|
||||
"googleTagManager",
|
||||
"googleAds",
|
||||
"cookiebot",
|
||||
"googleAnalytics",
|
||||
"conversionLinker",
|
||||
"facebook",
|
||||
"emarsys",
|
||||
"tracify",
|
||||
"umami"
|
||||
"version"
|
||||
]
|
||||
},
|
||||
"ConversionLinker": {
|
||||
"github.com.foomo.sesamy-cli.pkg.config.ConversionLinker": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"googleConsent": {
|
||||
"$ref": "#/$defs/GoogleConsent"
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.GoogleConsent"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"enabled",
|
||||
"googleConsent"
|
||||
]
|
||||
"type": "object"
|
||||
},
|
||||
"Cookiebot": {
|
||||
"github.com.foomo.sesamy-cli.pkg.config.Cookiebot": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
@ -114,45 +135,35 @@
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"enabled",
|
||||
"templateName",
|
||||
"cookiebotId",
|
||||
"cdnRegion",
|
||||
"urlPassthrough",
|
||||
"advertiserConsentModeEnabled"
|
||||
]
|
||||
"type": "object"
|
||||
},
|
||||
"Emarsys": {
|
||||
"github.com.foomo.sesamy-cli.pkg.config.Emarsys": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
"type": "boolean",
|
||||
"description": "Enable provider"
|
||||
},
|
||||
"merchantId": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"description": "Emarsys merchant id"
|
||||
},
|
||||
"googleConsent": {
|
||||
"$ref": "#/$defs/GoogleConsent"
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.GoogleConsent",
|
||||
"description": "Google Consent settings"
|
||||
},
|
||||
"webContainer": {
|
||||
"$ref": "#/$defs/Config"
|
||||
"$ref": "#/$defs/github.com.foomo.gocontemplate.pkg.contemplate.Config",
|
||||
"description": "Google Tag Manager web container settings"
|
||||
},
|
||||
"serverContainer": {
|
||||
"$ref": "#/$defs/Config"
|
||||
"$ref": "#/$defs/github.com.foomo.gocontemplate.pkg.contemplate.Config",
|
||||
"description": "Google Tag Manager server container settings"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"enabled",
|
||||
"merchantId",
|
||||
"googleConsent",
|
||||
"webContainer",
|
||||
"serverContainer"
|
||||
]
|
||||
"type": "object"
|
||||
},
|
||||
"Facebook": {
|
||||
"github.com.foomo.sesamy-cli.pkg.config.Facebook": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
@ -167,24 +178,16 @@
|
||||
"type": "string"
|
||||
},
|
||||
"googleConsent": {
|
||||
"$ref": "#/$defs/GoogleConsent"
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.GoogleConsent"
|
||||
},
|
||||
"serverContainer": {
|
||||
"$ref": "#/$defs/Config"
|
||||
"$ref": "#/$defs/github.com.foomo.gocontemplate.pkg.contemplate.Config"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"enabled",
|
||||
"pixelId",
|
||||
"apiAccessToken",
|
||||
"testEventToken",
|
||||
"googleConsent",
|
||||
"serverContainer"
|
||||
]
|
||||
"type": "object"
|
||||
},
|
||||
"GoogleAPI": {
|
||||
"github.com.foomo.sesamy-cli.pkg.config.GoogleAPI": {
|
||||
"properties": {
|
||||
"credentials": {
|
||||
"type": "string"
|
||||
@ -197,42 +200,30 @@
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"credentials",
|
||||
"credentialsFile",
|
||||
"requestQuota"
|
||||
]
|
||||
"type": "object"
|
||||
},
|
||||
"GoogleAds": {
|
||||
"github.com.foomo.sesamy-cli.pkg.config.GoogleAds": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"googleConsent": {
|
||||
"$ref": "#/$defs/GoogleConsent"
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.GoogleConsent"
|
||||
},
|
||||
"conversionId": {
|
||||
"type": "string"
|
||||
},
|
||||
"conversion": {
|
||||
"$ref": "#/$defs/GoogleAdsConversion"
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.GoogleAdsConversion"
|
||||
},
|
||||
"remarketing": {
|
||||
"$ref": "#/$defs/GoogleAdsRemarketing"
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.GoogleAdsRemarketing"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"enabled",
|
||||
"googleConsent",
|
||||
"conversionId",
|
||||
"conversion",
|
||||
"remarketing"
|
||||
]
|
||||
"type": "object"
|
||||
},
|
||||
"GoogleAdsConversion": {
|
||||
"github.com.foomo.sesamy-cli.pkg.config.GoogleAdsConversion": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
@ -241,18 +232,13 @@
|
||||
"type": "string"
|
||||
},
|
||||
"serverContainer": {
|
||||
"$ref": "#/$defs/Config"
|
||||
"$ref": "#/$defs/github.com.foomo.gocontemplate.pkg.contemplate.Config"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"enabled",
|
||||
"conversionLabel",
|
||||
"serverContainer"
|
||||
]
|
||||
"type": "object"
|
||||
},
|
||||
"GoogleAdsRemarketing": {
|
||||
"github.com.foomo.sesamy-cli.pkg.config.GoogleAdsRemarketing": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
@ -262,41 +248,30 @@
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"enabled",
|
||||
"enableConversionLinker"
|
||||
]
|
||||
"type": "object"
|
||||
},
|
||||
"GoogleAnalytics": {
|
||||
"github.com.foomo.sesamy-cli.pkg.config.GoogleAnalytics": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"googleGTag": {
|
||||
"$ref": "#/$defs/GoogleGTag"
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.GoogleGTag"
|
||||
},
|
||||
"googleConsent": {
|
||||
"$ref": "#/$defs/GoogleConsent"
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.GoogleConsent"
|
||||
},
|
||||
"webContainer": {
|
||||
"$ref": "#/$defs/Config"
|
||||
"$ref": "#/$defs/github.com.foomo.gocontemplate.pkg.contemplate.Config"
|
||||
},
|
||||
"serverContainer": {
|
||||
"$ref": "#/$defs/Config"
|
||||
"$ref": "#/$defs/github.com.foomo.gocontemplate.pkg.contemplate.Config"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"enabled",
|
||||
"googleGTag",
|
||||
"googleConsent",
|
||||
"webContainer",
|
||||
"serverContainer"
|
||||
]
|
||||
"type": "object"
|
||||
},
|
||||
"GoogleConsent": {
|
||||
"github.com.foomo.sesamy-cli.pkg.config.GoogleConsent": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
@ -306,13 +281,9 @@
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"enabled",
|
||||
"mode"
|
||||
]
|
||||
"type": "object"
|
||||
},
|
||||
"GoogleGTag": {
|
||||
"github.com.foomo.sesamy-cli.pkg.config.GoogleGTag": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
@ -325,58 +296,46 @@
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"enabled",
|
||||
"priority",
|
||||
"ecommerceItems"
|
||||
]
|
||||
"type": "object"
|
||||
},
|
||||
"GoogleTag": {
|
||||
"github.com.foomo.sesamy-cli.pkg.config.GoogleTag": {
|
||||
"properties": {
|
||||
"tagId": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"description": "A tag ID is an identifier that you put on your page to load a given Google tag"
|
||||
},
|
||||
"debugMode": {
|
||||
"type": "boolean"
|
||||
"type": "boolean",
|
||||
"description": "Enable debug mode for all user devices"
|
||||
},
|
||||
"sendPageView": {
|
||||
"type": "boolean"
|
||||
"type": "boolean",
|
||||
"description": "Whether a page_view should be sent on initial load"
|
||||
},
|
||||
"typeScript": {
|
||||
"$ref": "#/$defs/TypeScript"
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.TypeScript",
|
||||
"description": "TypeScript settings"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"tagId",
|
||||
"debugMode",
|
||||
"sendPageView",
|
||||
"typeScript"
|
||||
]
|
||||
"type": "object"
|
||||
},
|
||||
"GoogleTagManager": {
|
||||
"github.com.foomo.sesamy-cli.pkg.config.GoogleTagManager": {
|
||||
"properties": {
|
||||
"accountId": {
|
||||
"type": "string"
|
||||
},
|
||||
"webContainer": {
|
||||
"$ref": "#/$defs/GoogleTagManagerContainer"
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.GoogleTagManagerContainer"
|
||||
},
|
||||
"serverContainer": {
|
||||
"$ref": "#/$defs/GoogleTagManagerContainer"
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.GoogleTagManagerContainer"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"accountId",
|
||||
"webContainer",
|
||||
"serverContainer"
|
||||
]
|
||||
"type": "object"
|
||||
},
|
||||
"GoogleTagManagerContainer": {
|
||||
"github.com.foomo.sesamy-cli.pkg.config.GoogleTagManagerContainer": {
|
||||
"properties": {
|
||||
"tagId": {
|
||||
"type": "string"
|
||||
@ -389,80 +348,59 @@
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"tagId",
|
||||
"containerId",
|
||||
"workspaceId"
|
||||
]
|
||||
"type": "object"
|
||||
},
|
||||
"PackageConfig": {
|
||||
"properties": {
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"types": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"path",
|
||||
"types"
|
||||
]
|
||||
},
|
||||
"Tracify": {
|
||||
"github.com.foomo.sesamy-cli.pkg.config.Hotjar": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"token": {
|
||||
"siteId": {
|
||||
"type": "string"
|
||||
},
|
||||
"customerSiteId": {
|
||||
"type": "string"
|
||||
},
|
||||
"googleConsent": {
|
||||
"$ref": "#/$defs/GoogleConsent"
|
||||
},
|
||||
"serverContainer": {
|
||||
"$ref": "#/$defs/Config"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"enabled",
|
||||
"token",
|
||||
"customerSiteId",
|
||||
"googleConsent",
|
||||
"serverContainer"
|
||||
]
|
||||
"type": "object"
|
||||
},
|
||||
"TypeScript": {
|
||||
"github.com.foomo.sesamy-cli.pkg.config.Tracify": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean",
|
||||
"description": "Enable provider"
|
||||
},
|
||||
"token": {
|
||||
"type": "string",
|
||||
"description": "Tracify token"
|
||||
},
|
||||
"customerSiteId": {
|
||||
"type": "string",
|
||||
"description": "Tracify customer site id"
|
||||
},
|
||||
"googleConsent": {
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.GoogleConsent",
|
||||
"description": "Google Consent settings"
|
||||
},
|
||||
"serverContainer": {
|
||||
"$ref": "#/$defs/github.com.foomo.gocontemplate.pkg.contemplate.Config",
|
||||
"description": "Google Tag Manager server container settings"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"github.com.foomo.sesamy-cli.pkg.config.TypeScript": {
|
||||
"properties": {
|
||||
"packages": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/PackageConfig"
|
||||
},
|
||||
"type": "array"
|
||||
"$ref": "#/$defs/[]*contemplate.PackageConfig"
|
||||
},
|
||||
"outputPath": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"packages",
|
||||
"outputPath"
|
||||
]
|
||||
"type": "object"
|
||||
},
|
||||
"Umami": {
|
||||
"github.com.foomo.sesamy-cli.pkg.config.Umami": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
@ -477,22 +415,14 @@
|
||||
"type": "string"
|
||||
},
|
||||
"googleConsent": {
|
||||
"$ref": "#/$defs/GoogleConsent"
|
||||
"$ref": "#/$defs/github.com.foomo.sesamy-cli.pkg.config.GoogleConsent"
|
||||
},
|
||||
"serverContainer": {
|
||||
"$ref": "#/$defs/Config"
|
||||
"$ref": "#/$defs/github.com.foomo.gocontemplate.pkg.contemplate.Config"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"enabled",
|
||||
"domain",
|
||||
"websiteId",
|
||||
"endpointUrl",
|
||||
"googleConsent",
|
||||
"serverContainer"
|
||||
]
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
39
sesamy.yaml
39
sesamy.yaml
@ -16,49 +16,33 @@ googleApi:
|
||||
# --- Google Tag Manager settings
|
||||
googleTagManager:
|
||||
# The account id
|
||||
accountId: 6099238525
|
||||
accountId: '6099238525'
|
||||
# Web container settings
|
||||
webContainer:
|
||||
# The container tag id
|
||||
tagId: GTM-57BHX34G
|
||||
# The container id
|
||||
containerId: 175355532
|
||||
containerId: '175355532'
|
||||
# The workspace id that should be used by the api
|
||||
workspaceId: 23
|
||||
workspaceId: '23'
|
||||
# Server container settings
|
||||
serverContainer:
|
||||
# The container tag id
|
||||
tagId: GTM-5NWPR4QW
|
||||
# The container id
|
||||
containerId: 175348980
|
||||
containerId: '175348980'
|
||||
# The workspace id that should be used by the api
|
||||
workspaceId: 10
|
||||
workspaceId: '10'
|
||||
|
||||
# --- Google Tag settings
|
||||
googleTag:
|
||||
# A tag ID is an identifier that you put on your page to load a given Google tag
|
||||
tagId: G-PZ5ELRCR31
|
||||
# Whether a page_view should be sent on initial load
|
||||
sendPageView: true
|
||||
# Enable debug mode for all user devices
|
||||
debugMode: false
|
||||
# Google Tag Manager web container settings
|
||||
webContainer:
|
||||
# Contemplate package config for generated events
|
||||
packages:
|
||||
- path: github.com/foomo/sesamy-go/pkg/event
|
||||
types:
|
||||
- PageView
|
||||
- SelectItem
|
||||
# Google Tag Manager server container settings
|
||||
serverContainer:
|
||||
# Contemplate package config for generated events
|
||||
packages:
|
||||
- path: github.com/foomo/sesamy-go/pkg/event
|
||||
types:
|
||||
- PageView
|
||||
- SelectItem
|
||||
# Google Tag Manager web container settings
|
||||
# Whether a page_view should be sent on initial load
|
||||
sendPageView: true
|
||||
# TypeScript settings
|
||||
typeScript:
|
||||
# Target directory for generate files
|
||||
outputPath: path/to/target
|
||||
@ -307,6 +291,13 @@ tracify:
|
||||
- ViewItem
|
||||
- Purchase
|
||||
|
||||
# --- Hotjar
|
||||
hotjar:
|
||||
# Enable provider
|
||||
enabled: true
|
||||
# Hotjar site id
|
||||
siteId: '123456'
|
||||
|
||||
# --- Cookiebot CMP
|
||||
cookiebot:
|
||||
# Enable provider
|
||||
|
||||
@ -12,6 +12,7 @@ import (
|
||||
"github.com/foomo/sesamy-cli/pkg/config"
|
||||
"github.com/foomo/sesamy-cli/pkg/tagmanager"
|
||||
"github.com/foomo/sesamy-cli/pkg/tagmanager/common/trigger"
|
||||
"github.com/joho/godotenv"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/api/option"
|
||||
@ -20,6 +21,7 @@ import (
|
||||
|
||||
func TestNewClient_Web(t *testing.T) {
|
||||
testingx.Tags(t, tagx.Skip)
|
||||
require.NoError(t, godotenv.Load("../../.env"))
|
||||
|
||||
c, err := tagmanager.New(
|
||||
context.TODO(),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user