-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from foomo/sesamy-cli-0.4.x
fix(provider/cookiebot): add cookiebot and integrate consent mode v2
- Loading branch information
Showing
39 changed files
with
893 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package config | ||
|
||
type Cookiebot struct { | ||
Enabled bool `json:"enabled" yaml:"enabled"` | ||
TemplateName string `json:"templateName" yaml:"templateName"` | ||
CookiebotID string `json:"cookiebotId" yaml:"cookiebotId"` | ||
CDNRegion string `json:"cdnRegion" yaml:"cdnRegion"` | ||
URLPassthrough bool `json:"urlPassthrough" yaml:"urlPassthrough"` | ||
AdvertiserConsentModeEnabled bool `json:"advertiserConsentModeEnabled" yaml:"advertiserConsentModeEnabled"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package config | ||
|
||
type GoogleAds struct { | ||
Enabled bool `json:"enabled" yaml:"enabled"` | ||
Conversion GoogleAdsConversion `json:"conversion" yaml:"conversion"` | ||
Enabled bool `json:"enabled" yaml:"enabled"` | ||
GoogleConsent GoogleConsent `json:"googleConsent" yaml:"googleConsent"` | ||
Conversion GoogleAdsConversion `json:"conversion" yaml:"conversion"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package config | ||
|
||
type GoogleConsent struct { | ||
Enabled bool `json:"enabled" yaml:"enabled"` | ||
Mode string `json:"mode" yaml:"mode"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package cookiebot | ||
|
||
const ( | ||
Tag = "cookiebot" | ||
Name = "Cookiebot" | ||
NameCookiebotTag = "Cookiebot Initialization" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package cookiebot | ||
|
||
import ( | ||
"github.com/foomo/sesamy-cli/pkg/config" | ||
"github.com/foomo/sesamy-cli/pkg/provider/cookiebot/web/tag" | ||
"github.com/foomo/sesamy-cli/pkg/tagmanager" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
func Web(tm *tagmanager.TagManager, cfg config.Cookiebot) error { | ||
{ // create folder | ||
if folder, err := tm.UpsertFolder("Sesamy - " + Name); err != nil { | ||
return err | ||
} else { | ||
tm.SetFolderName(folder.Name) | ||
} | ||
} | ||
|
||
{ // create event tags | ||
temmplate, err := tm.LookupTemplate(cfg.TemplateName) | ||
if err != nil { | ||
return errors.Wrapf(err, "Failed to lookup `%s`, please install the `%s` gallery tag template first (%s)", cfg.TemplateName, "Cookiebot CMP", "https://tagmanager.google.com/gallery/#/owners/cybotcorp/templates/gtm-templates-cookiebot-cmp") | ||
} | ||
|
||
if _, err := tm.UpsertTag(tag.NewCookiebotInitialization(NameCookiebotTag, cfg, temmplate)); err != nil { | ||
return err | ||
} | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package tag | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/foomo/sesamy-cli/pkg/config" | ||
"github.com/foomo/sesamy-cli/pkg/tagmanager/web/trigger" | ||
"github.com/foomo/sesamy-cli/pkg/utils" | ||
"google.golang.org/api/tagmanager/v2" | ||
) | ||
|
||
func NewCookiebotInitialization(name string, cfg config.Cookiebot, template *tagmanager.CustomTemplate) *tagmanager.Tag { | ||
return &tagmanager.Tag{ | ||
Name: name, | ||
FiringTriggerId: []string{trigger.IDConsentInitializtion}, | ||
TagFiringOption: "oncePerEvent", | ||
Parameter: []*tagmanager.Parameter{ | ||
{ | ||
Key: "adsDataRedaction", | ||
Type: "template", | ||
Value: "dynamic", | ||
}, | ||
{ | ||
Key: "addGeoRegion", | ||
Type: "boolean", | ||
Value: "false", | ||
}, | ||
{ | ||
Key: "serial", | ||
Type: "template", | ||
Value: cfg.CookiebotID, | ||
}, | ||
{ | ||
Key: "iabFramework", | ||
Type: "boolean", | ||
Value: "false", | ||
}, | ||
{ | ||
Key: "cdnRegion", | ||
Type: "template", | ||
Value: cfg.CDNRegion, | ||
}, | ||
{ | ||
Key: "advertiserConsentModeEnabled", | ||
Type: "boolean", | ||
Value: "true", | ||
}, | ||
{ | ||
Key: "language", | ||
Type: "template", | ||
Value: "auto", | ||
}, | ||
{ | ||
Key: "urlPassthrough", | ||
Type: "boolean", | ||
Value: strconv.FormatBool(cfg.URLPassthrough), | ||
}, | ||
{ | ||
Key: "consentModeEnabled", | ||
Type: "boolean", | ||
Value: "true", | ||
}, | ||
{ | ||
Key: "waitForUpdate", | ||
Type: "template", | ||
Value: "2000", | ||
}, | ||
}, | ||
Type: utils.TemplateType(template), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.