-
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 #45 from foomo/sesamy-cli-0.4.1
Sesamy cli 0.4.1
- Loading branch information
Showing
8 changed files
with
302 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package config | ||
|
||
type ConversionLinker struct { | ||
Enabled bool `json:"enabled" yaml:"enabled"` | ||
Enabled bool `json:"enabled" yaml:"enabled"` | ||
GoogleConsent GoogleConsent `json:"googleConsent" yaml:"googleConsent"` | ||
} |
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 conversionlinker | ||
|
||
const ( | ||
Tag = "cl" | ||
Name = "Conversion Linker" | ||
Tag = "cl" | ||
Name = "Conversion Linker" | ||
NameConversionLinkerTrigger = "Conversion Linker" | ||
) |
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
54 changes: 54 additions & 0 deletions
54
pkg/provider/conversionlinker/server/trigger/conversionlinkerevent.go
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,54 @@ | ||
package trigger | ||
|
||
import ( | ||
"google.golang.org/api/tagmanager/v2" | ||
) | ||
|
||
type ( | ||
ConversionLinkerEventOptions struct { | ||
consentMode *tagmanager.Variable | ||
} | ||
ConversionLinkerEventOption func(*ConversionLinkerEventOptions) | ||
) | ||
|
||
func ConversionLinkerEventWithConsentMode(mode *tagmanager.Variable) ConversionLinkerEventOption { | ||
return func(o *ConversionLinkerEventOptions) { | ||
o.consentMode = mode | ||
} | ||
} | ||
|
||
func NewConversionLinkerEvent(name string, opts ...ConversionLinkerEventOption) *tagmanager.Trigger { | ||
o := &ConversionLinkerEventOptions{} | ||
for _, opt := range opts { | ||
if opt != nil { | ||
opt(o) | ||
} | ||
} | ||
|
||
var filter []*tagmanager.Condition | ||
if o.consentMode != nil { | ||
filter = append(filter, | ||
&tagmanager.Condition{ | ||
Parameter: []*tagmanager.Parameter{ | ||
{ | ||
Key: "arg0", | ||
Type: "template", | ||
Value: "{{" + o.consentMode.Name + "}}", | ||
}, | ||
{ | ||
Key: "arg1", | ||
Type: "template", | ||
Value: "granted", | ||
}, | ||
}, | ||
Type: "equals", | ||
}, | ||
) | ||
} | ||
|
||
return &tagmanager.Trigger{ | ||
Type: "serverPageview", | ||
Name: name, | ||
Filter: filter, | ||
} | ||
} |
File renamed without changes.
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.