Skip to content

Commit 36d7d25

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 36d7d25

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

experimenter/experimenter/targeting/constants.py

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,70 @@ 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), or in earlier partial rollout indicated by presence of on-train rollout population value
44+
ACCEPTED_TOU_IN_ON_TRAIN_ROLLOUT = f"""
45+
(
46+
(
47+
'browser.preonboarding.enrolledInOnTrainRollout'|preferenceValue
48+
&&
49+
'datareporting.policy.dataSubmissionPolicyAcceptedVersion'|preferenceValue == 2
50+
)
51+
||
52+
(
53+
'datareporting.policy.dataSubmissionPolicyNotifiedTime'|preferenceValue >= '1748350800000'
54+
||
55+
'browser.preonboarding.onTrainRolloutPopulation'|preferenceValue
56+
)
57+
)
58+
"""
59+
ACCEPTED_TOU_V1 = "'termsofuse.acceptedVersion'|preferenceValue == 1"
60+
ACCEPTED_TOU = f"""
61+
(
62+
{ACCEPTED_TOU_IN_NIMBUS_EXPERIMENT}
63+
||
64+
{ACCEPTED_TOU_IN_ON_TRAIN_ROLLOUT}
65+
||
66+
{ACCEPTED_TOU_V1}
67+
)
68+
"""
69+
70+
# The following indicate whether the user has changed prefs suggesting they prefer not to see ads or ad-like features
71+
NEW_TAB_AND_HOMEPAGE_NOT_DEFAULT = "(!homePageSettings.isDefault && !newtabSettings.isDefault)"
72+
SEARCH_SUGGESTIONS_DISABLED = "!'browser.urlbar.suggest.quicksuggest.sponsored'|preferenceValue"
73+
SPONSORED_TOPSITES_DISABLED = """
74+
(
75+
!'browser.newtabpage.activity-stream.feeds.topsites'|preferenceValue
76+
||
77+
!'browser.newtabpage.activity-stream.showSponsoredTopSites'|preferenceValue
78+
)
79+
"""
80+
SPONSORED_STORIES_DISABLED = """
81+
(
82+
!'browser.newtabpage.activity-stream.feeds.section.topstories'|preferenceValue
83+
||
84+
!'browser.newtabpage.activity-stream.showSponsored'|preferenceValue
85+
)
86+
"""
87+
ADS_DISABLED = f"""
88+
(
89+
(
90+
{NEW_TAB_AND_HOMEPAGE_NOT_DEFAULT}
91+
&&
92+
{SEARCH_SUGGESTIONS_DISABLED}
93+
)
94+
||
95+
(
96+
{SPONSORED_TOPSITES_DISABLED}
97+
&&
98+
{SPONSORED_STORIES_DISABLED}
99+
&&
100+
{SEARCH_SUGGESTIONS_DISABLED}
101+
)
102+
)
103+
"""
104+
41105
NO_TARGETING = NimbusTargetingConfig(
42106
name="No Targeting",
43107
slug="no_targeting",
@@ -2527,6 +2591,32 @@ def __post_init__(self):
25272591
application_choice_names=(Application.DESKTOP.name,),
25282592
)
25292593

2594+
TOU_NOT_ACCEPTED_ADS_ENABLED_MAC_OR_WIN = NimbusTargetingConfig(
2595+
name="TOU not accepted yet, ads enabled, Mac or Win",
2596+
slug="tou_not_accepted_ads_enabled_mac_win",
2597+
description=(
2598+
"Users who have not accepted the terms of use yet, "
2599+
"have not disabled ads, "
2600+
"and are on Mac or Windows"
2601+
),
2602+
targeting=f"""
2603+
(
2604+
(
2605+
os.isWindows
2606+
||
2607+
os.isMac
2608+
)
2609+
&&
2610+
!{ACCEPTED_TOU}
2611+
&&
2612+
!{ADS_DISABLED}
2613+
)
2614+
""",
2615+
desktop_telemetry="",
2616+
sticky_required=False,
2617+
is_first_run_required=False,
2618+
application_choice_names=(Application.DESKTOP.name,),
2619+
)
25302620

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

0 commit comments

Comments
 (0)