feat: add recommended events

This commit is contained in:
Kevin Franklin Kim 2024-07-13 18:27:42 +02:00
parent 56ab1ada09
commit 45bd571282
No known key found for this signature in database
15 changed files with 168 additions and 0 deletions

View File

@ -0,0 +1,12 @@
package event
import (
"github.com/foomo/sesamy-go/pkg/event/params"
"github.com/foomo/sesamy-go/pkg/sesamy"
)
type CloseConvertLead sesamy.Event[params.CloseConvertLead[params.Item]]
func NewCloseConvertLead(p params.CloseConvertLead[params.Item]) sesamy.Event[params.CloseConvertLead[params.Item]] {
return sesamy.NewEvent(sesamy.EventNameCloseConvertLead, p)
}

View File

@ -0,0 +1,12 @@
package event
import (
"github.com/foomo/sesamy-go/pkg/event/params"
"github.com/foomo/sesamy-go/pkg/sesamy"
)
type CloseUnconvertLead sesamy.Event[params.CloseUnconvertLead[params.Item]]
func NewCloseUnconvertLead(p params.CloseUnconvertLead[params.Item]) sesamy.Event[params.CloseUnconvertLead[params.Item]] {
return sesamy.NewEvent(sesamy.EventNameCloseUnconvertLead, p)
}

View File

@ -0,0 +1,12 @@
package event
import (
"github.com/foomo/sesamy-go/pkg/event/params"
"github.com/foomo/sesamy-go/pkg/sesamy"
)
type DisqualifyLead sesamy.Event[params.DisqualifyLead[params.Item]]
func NewDisqualifyLead(p params.DisqualifyLead[params.Item]) sesamy.Event[params.DisqualifyLead[params.Item]] {
return sesamy.NewEvent(sesamy.EventNameDisqualifyLead, p)
}

12
pkg/event/exception.go Normal file
View File

@ -0,0 +1,12 @@
package event
import (
"github.com/foomo/sesamy-go/pkg/event/params"
"github.com/foomo/sesamy-go/pkg/sesamy"
)
type Exception sesamy.Event[params.Exception]
func NewException(p params.Exception) sesamy.Event[params.Exception] {
return sesamy.NewEvent(sesamy.EventNameException, p)
}

12
pkg/event/firstvisit.go Normal file
View File

@ -0,0 +1,12 @@
package event
import (
"github.com/foomo/sesamy-go/pkg/event/params"
"github.com/foomo/sesamy-go/pkg/sesamy"
)
type FirstVisit sesamy.Event[params.FirstVisit]
func NewFirstVisit(p params.FirstVisit) sesamy.Event[params.FirstVisit] {
return sesamy.NewEvent(sesamy.EventNameFirstVisit, p)
}

View File

@ -0,0 +1,13 @@
package params
import (
"github.com/foomo/gostandards/iso4217"
)
// CloseConvertLead
// https://developers.google.com/tag-platform/gtagjs/reference/events#close_convert_lead
type CloseConvertLead[I any] struct {
Currency iso4217.Currency `json:"currency,omitempty"`
Value float64 `json:"value,omitempty"`
Items []I `json:"items,omitempty"`
}

View File

@ -0,0 +1,14 @@
package params
import (
"github.com/foomo/gostandards/iso4217"
)
// CloseUnconvertLead
// https://developers.google.com/tag-platform/gtagjs/reference/events#close_unconvert_lead
type CloseUnconvertLead[I any] struct {
Currency iso4217.Currency `json:"currency,omitempty"`
Value float64 `json:"value,omitempty"`
Items []I `json:"items,omitempty"`
UnconvertLeadReason string `json:"unconvert_lead_reason,omitempty"`
}

View File

@ -0,0 +1,14 @@
package params
import (
"github.com/foomo/gostandards/iso4217"
)
// DisqualifyLead
// https://developers.google.com/tag-platform/gtagjs/reference/events#disqualify_lead
type DisqualifyLead[I any] struct {
Currency iso4217.Currency `json:"currency,omitempty"`
Value float64 `json:"value,omitempty"`
Items []I `json:"items,omitempty"`
DisqualifiedLeadReason string `json:"disqualified_lead_reason,omitempty"`
}

View File

@ -0,0 +1,6 @@
package params
type Exception struct {
Description string `json:"description,omitempty"`
Fatal bool `json:"fatal,omitempty"`
}

View File

@ -0,0 +1,3 @@
package params
type FirstVisit struct{}

View File

@ -0,0 +1,13 @@
package params
import (
"github.com/foomo/gostandards/iso4217"
)
// QualifyLead
// https://developers.google.com/tag-platform/gtagjs/reference/events#qualify_lead
type QualifyLead[I any] struct {
Currency iso4217.Currency `json:"currency,omitempty"`
Value float64 `json:"value,omitempty"`
Items []I `json:"items,omitempty"`
}

View File

@ -0,0 +1,14 @@
package params
import (
"github.com/foomo/gostandards/iso4217"
)
// WorkingLead
// https://developers.google.com/tag-platform/gtagjs/reference/events#working_lead
type WorkingLead[I any] struct {
Currency iso4217.Currency `json:"currency,omitempty"`
Value float64 `json:"value,omitempty"`
Items []I `json:"items,omitempty"`
LeadStatus string `json:"lead_status,omitempty"`
}

12
pkg/event/qualifylead.go Normal file
View File

@ -0,0 +1,12 @@
package event
import (
"github.com/foomo/sesamy-go/pkg/event/params"
"github.com/foomo/sesamy-go/pkg/sesamy"
)
type QualifyLead sesamy.Event[params.QualifyLead[params.Item]]
func NewQualifyLead(p params.QualifyLead[params.Item]) sesamy.Event[params.QualifyLead[params.Item]] {
return sesamy.NewEvent(sesamy.EventNameQualifyLead, p)
}

12
pkg/event/workinglead.go Normal file
View File

@ -0,0 +1,12 @@
package event
import (
"github.com/foomo/sesamy-go/pkg/event/params"
"github.com/foomo/sesamy-go/pkg/sesamy"
)
type WorkingLead sesamy.Event[params.WorkingLead[params.Item]]
func NewWorkingLead(p params.WorkingLead[params.Item]) sesamy.Event[params.WorkingLead[params.Item]] {
return sesamy.NewEvent(sesamy.EventNameWorkingLead, p)
}

View File

@ -15,8 +15,13 @@ const (
EventNameBeginCheckout EventName = "begin_checkout"
EventNameCampaignDetails EventName = "campaign_details"
EventNameClick EventName = "click"
EventNameCloseConvertLead EventName = "close_convert_lead"
EventNameCloseUnconvertLead EventName = "close_unconvert_lead"
EventNameDisqualifyLead EventName = "disqualify_lead"
EventNameEarnVirtualMoney EventName = "earn_virtual_money"
EventNameException EventName = "exception"
EventNameFileDownload EventName = "file_download"
EventNameFirstVisit EventName = "first_visit"
EventNameFormStart EventName = "form_start"
EventNameFormSubmit EventName = "form_submit"
EventNameGenerateLead EventName = "generate_lead"
@ -28,6 +33,7 @@ const (
EventNamePageView EventName = "page_view"
EventNamePostScore EventName = "post_score"
EventNamePurchase EventName = "purchase"
EventNameQualifyLead EventName = "qualify_lead"
EventNameRefund EventName = "refund"
EventNameRemoveFromCart EventName = "remove_from_cart"
EventNameScreenView EventName = "screen_view"
@ -52,6 +58,7 @@ const (
EventNameViewItemList EventName = "view_item_list"
EventNameViewPromotion EventName = "view_promotion"
EventNameViewSearchResults EventName = "view_search_results"
EventNameWorkingLead EventName = "working_lead"
)
func (s EventName) String() string {