Skip to content

Commit

Permalink
Leverage marketing params on Discover (#31648) (#32515)
Browse files Browse the repository at this point in the history
* marketing params to cluster state

* leverage marketing params on Discover
  • Loading branch information
michellescripts authored Sep 28, 2023
1 parent aa0d14b commit 9b74d97
Show file tree
Hide file tree
Showing 18 changed files with 1,967 additions and 1,138 deletions.
186 changes: 150 additions & 36 deletions api/gen/proto/go/userpreferences/v1/onboard.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions api/proto/teleport/userpreferences/v1/onboard.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,24 @@ enum Resource {
RESOURCE_WEB_APPLICATIONS = 5;
}

// MarketingParams are the parameters associated with a user via marketing campaign at the time of sign up.
// They contain both traditional Urchin Tracking Module (UTM) parameters as well as custom parameters.
message MarketingParams {
// campaign is the UTM campaign parameter which identifies a specific product promotion
string campaign = 1;
// source is the UTM source parameter which identifies which site sent the traffic
string source = 2;
// medium is the UTM medium parameter which identifies what type of link was used
string medium = 3;
// intent is the internal query param, which identifies any additional marketing intentions
// via internally set and directed parameters.
string intent = 4;
}

// OnboardUserPreferences is the user preferences selected during onboarding.
message OnboardUserPreferences {
// preferredResources is an array of the resources a user selected during their onboarding questionnaire.
repeated Resource preferred_resources = 1;
// marketingParams are the parameters associated with a user via marketing campaign at the time of sign up
MarketingParams marketing_params = 2;
}
1 change: 1 addition & 0 deletions lib/auth/userpreferences/userpreferencesv1/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func TestService_GetUserPreferences(t *testing.T) {
Theme: userpreferencesv1.Theme_THEME_LIGHT,
Onboard: &userpreferencesv1.OnboardUserPreferences{
PreferredResources: []userpreferencesv1.Resource{},
MarketingParams: &userpreferencesv1.MarketingParams{},
},
},
},
Expand Down
1 change: 1 addition & 0 deletions lib/services/local/userpreferences.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func DefaultUserPreferences() *userpreferencesv1.UserPreferences {
Theme: userpreferencesv1.Theme_THEME_LIGHT,
Onboard: &userpreferencesv1.OnboardUserPreferences{
PreferredResources: []userpreferencesv1.Resource{},
MarketingParams: &userpreferencesv1.MarketingParams{},
},
}
}
Expand Down
27 changes: 26 additions & 1 deletion lib/services/local/userpreferences_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func newUserPreferencesService(t *testing.T) *local.UserPreferencesService {
return local.NewUserPreferencesService(backend)
}

func TestUserPreferencesCRUD2(t *testing.T) {
func TestUserPreferencesCRUD(t *testing.T) {
t.Parallel()

ctx := context.Background()
Expand Down Expand Up @@ -82,6 +82,7 @@ func TestUserPreferencesCRUD2(t *testing.T) {
},
Onboard: &userpreferencesv1.OnboardUserPreferences{
PreferredResources: []userpreferencesv1.Resource{},
MarketingParams: &userpreferencesv1.MarketingParams{},
},
},
},
Expand Down Expand Up @@ -118,6 +119,12 @@ func TestUserPreferencesCRUD2(t *testing.T) {
Preferences: &userpreferencesv1.UserPreferences{
Onboard: &userpreferencesv1.OnboardUserPreferences{
PreferredResources: []userpreferencesv1.Resource{userpreferencesv1.Resource_RESOURCE_DATABASES},
MarketingParams: &userpreferencesv1.MarketingParams{
Campaign: "c_1",
Source: "s_1",
Medium: "m_1",
Intent: "i_1",
},
},
},
},
Expand All @@ -126,6 +133,12 @@ func TestUserPreferencesCRUD2(t *testing.T) {
Theme: defaultPref.Theme,
Onboard: &userpreferencesv1.OnboardUserPreferences{
PreferredResources: []userpreferencesv1.Resource{userpreferencesv1.Resource_RESOURCE_DATABASES},
MarketingParams: &userpreferencesv1.MarketingParams{
Campaign: "c_1",
Source: "s_1",
Medium: "m_1",
Intent: "i_1",
},
},
},
},
Expand All @@ -140,6 +153,12 @@ func TestUserPreferencesCRUD2(t *testing.T) {
},
Onboard: &userpreferencesv1.OnboardUserPreferences{
PreferredResources: []userpreferencesv1.Resource{userpreferencesv1.Resource_RESOURCE_KUBERNETES},
MarketingParams: &userpreferencesv1.MarketingParams{
Campaign: "c_2",
Source: "s_2",
Medium: "m_2",
Intent: "i_2",
},
},
},
},
Expand All @@ -151,6 +170,12 @@ func TestUserPreferencesCRUD2(t *testing.T) {
},
Onboard: &userpreferencesv1.OnboardUserPreferences{
PreferredResources: []userpreferencesv1.Resource{userpreferencesv1.Resource_RESOURCE_KUBERNETES},
MarketingParams: &userpreferencesv1.MarketingParams{
Campaign: "c_2",
Source: "s_2",
Medium: "m_2",
Intent: "i_2",
},
},
},
},
Expand Down
Loading

0 comments on commit 9b74d97

Please sign in to comment.