Skip to content

Commit ceead08

Browse files
committed
feat(nimbus): Advanced targeting for users who have not accepted ToU yet and are on Mac or Win
1 parent 025cd85 commit ceead08

File tree

1 file changed

+115
-0
lines changed

1 file changed

+115
-0
lines changed

experimenter/experimenter/targeting/constants.py

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,93 @@ def __post_init__(self):
3838
CORE_ACTIVE_USERS_TARGETING = "'{event}'|eventCountNonZero('Days', 28, 0) >= 21"
3939
RECENTLY_LOGGED_IN_USERS_TARGETING = "'{event}'|eventCountNonZero('Weeks', 12, 0) >= 1"
4040

41+
# The following indicate whether the user accepted the terms of use in one of our initial phases of experimentation/rollout
42+
ACCEPTED_TOU_IN_NIMBUS_EXPERIMENT = "'datareporting.policy.dataSubmissionPolicyAcceptedVersion'|preferenceValue == 3"
43+
# Accepted in 100% on-train rollout in 139 release (after May 27, 6am PT timestamp)
44+
ACCEPTED_TOU_IN_FULL_ON_TRAIN_ROLLOUT = """
45+
(
46+
'datareporting.policy.dataSubmissionPolicyNotifiedTime'|preferenceValue >= '1748350800000'
47+
&&
48+
'datareporting.policy.dataSubmissionPolicyAcceptedVersion'|preferenceValue == 2
49+
&&
50+
'browser.preonboarding.enrolledInOnTrainRollout'|preferenceValue
51+
)
52+
"""
53+
# Accepted in earlier partial rollout indicated by presence of on-train rollout population value
54+
ACCEPTED_TOU_IN_PARTIAL_ON_TRAIN_ROLLOUT = """
55+
(
56+
'browser.preonboarding.enrolledInOnTrainRollout'|preferenceValue
57+
&&
58+
'browser.preonboarding.onTrainRolloutPopulation'|preferenceValue
59+
&&
60+
'datareporting.policy.dataSubmissionPolicyAcceptedVersion'|preferenceValue == 2
61+
)
62+
"""
63+
ACCEPTED_TOU_V1 = "'termsofuse.acceptedVersion'|preferenceValue == 1"
64+
ACCEPTED_TOU = f"""
65+
(
66+
{ACCEPTED_TOU_IN_NIMBUS_EXPERIMENT}
67+
||
68+
{ACCEPTED_TOU_IN_FULL_ON_TRAIN_ROLLOUT}
69+
||
70+
{ACCEPTED_TOU_IN_PARTIAL_ON_TRAIN_ROLLOUT}
71+
||
72+
{ACCEPTED_TOU_V1}
73+
)
74+
"""
75+
TOU_NOTIFICATION_BYPASS_ENABLED = """
76+
(
77+
'datareporting.policy.dataSubmissionPolicyBypassNotification'|preferenceValue
78+
||
79+
'termsOfUse.bypassNotification'|preferenceValue
80+
)
81+
"""
82+
83+
# The following indicate whether the user has changed prefs suggesting they prefer not to see ads or ad-like features
84+
NEW_TAB_AND_HOMEPAGE_NOT_DEFAULT = """
85+
(
86+
(
87+
!newtabSettings.isDefault
88+
||
89+
!'browser.newtabpage.enabled'|preferenceValue
90+
)
91+
&&
92+
!homePageSettings.isDefault
93+
)
94+
"""
95+
SPONSORED_SEARCH_SUGGESTIONS_DISABLED = "!'browser.urlbar.suggest.quicksuggest.sponsored'|preferenceValue"
96+
TOPSITES_OR_SPONSORED_TOPSITES_DISABLED = """
97+
(
98+
!'browser.newtabpage.activity-stream.feeds.topsites'|preferenceValue
99+
||
100+
!'browser.newtabpage.activity-stream.showSponsoredTopSites'|preferenceValue
101+
)
102+
"""
103+
SPONSORED_STORIES_DISABLED = """
104+
(
105+
!'browser.newtabpage.activity-stream.feeds.section.topstories'|preferenceValue
106+
||
107+
!'browser.newtabpage.activity-stream.showSponsored'|preferenceValue
108+
)
109+
"""
110+
ADS_DISABLED = f"""
111+
(
112+
(
113+
{NEW_TAB_AND_HOMEPAGE_NOT_DEFAULT}
114+
&&
115+
{SPONSORED_SEARCH_SUGGESTIONS_DISABLED}
116+
)
117+
||
118+
(
119+
{TOPSITES_OR_SPONSORED_TOPSITES_DISABLED}
120+
&&
121+
{SPONSORED_STORIES_DISABLED}
122+
&&
123+
{SEARCH_SUGGESTIONS_DISABLED}
124+
)
125+
)
126+
"""
127+
41128
NO_TARGETING = NimbusTargetingConfig(
42129
name="No Targeting",
43130
slug="no_targeting",
@@ -2527,6 +2614,34 @@ def __post_init__(self):
25272614
application_choice_names=(Application.DESKTOP.name,),
25282615
)
25292616

2617+
TOU_NOT_ACCEPTED_ADS_ENABLED_MAC_OR_WIN = NimbusTargetingConfig(
2618+
name="TOU not accepted yet, ads enabled, Mac or Win",
2619+
slug="tou_not_accepted_ads_enabled_mac_win",
2620+
description=(
2621+
"Users who have not accepted the terms of use yet, "
2622+
"have not disabled ads, "
2623+
"and are on Mac or Windows"
2624+
),
2625+
targeting=f"""
2626+
(
2627+
(
2628+
os.isWindows
2629+
||
2630+
os.isMac
2631+
)
2632+
&&
2633+
!{ACCEPTED_TOU}
2634+
&&
2635+
!{TOU_NOTIFICATION_BYPASS_ENABLED}
2636+
&&
2637+
!{ADS_DISABLED}
2638+
)
2639+
""",
2640+
desktop_telemetry="",
2641+
sticky_required=False,
2642+
is_first_run_required=False,
2643+
application_choice_names=(Application.DESKTOP.name,),
2644+
)
25302645

25312646
class TargetingConstants:
25322647
TARGETING_VERSION = "version|versionCompare('{version}') >= 0"

0 commit comments

Comments
 (0)