1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
|
# Targeting attributes
When you create ASRouter messages such as snippets, contextual feature recommendations, or onboarding cards, you may choose to include **targeting information** with those messages.
Targeting information must be captured in [an expression](./targeting-guide.md) that has access to the following attributes. You may combine and compare any of these attributes as needed.
Please note that some targeting attributes require stricter controls on the telemetry than can be colleted, so when in doubt, ask for review.
## Available attributes
* [addonsInfo](#addonsinfo)
* [attributionData](#attributiondata)
* [browserSettings](#browsersettings)
* [currentDate](#currentdate)
* [devToolsOpenedCount](#devtoolsopenedcount)
* [isDefaultBrowser](#isdefaultbrowser)
* [firefoxVersion](#firefoxversion)
* [locale](#locale)
* [localeLanguageCode](#localelanguagecode)
* [needsUpdate](#needsupdate)
* [pinnedSites](#pinnedsites)
* [previousSessionEnd](#previoussessionend)
* [profileAgeCreated](#profileagecreated)
* [profileAgeReset](#profileagereset)
* [providerCohorts](#providercohorts)
* [region](#region)
* [searchEngines](#searchengines)
* [sync](#sync)
* [topFrecentSites](#topfrecentsites)
* [totalBookmarksCount](#totalbookmarkscount)
* [usesFirefoxSync](#usesfirefoxsync)
* [isFxAEnabled](#isFxAEnabled)
* [isFxASignedIn](#isFxASignedIn)
* [xpinstallEnabled](#xpinstallEnabled)
* [hasPinnedTabs](#haspinnedtabs)
* [hasAccessedFxAPanel](#hasaccessedfxapanel)
* [isWhatsNewPanelEnabled](#iswhatsnewpanelenabled)
* [totalBlockedCount](#totalblockedcount)
* [recentBookmarks](#recentbookmarks)
* [userPrefs](#userprefs)
* [attachedFxAOAuthClients](#attachedfxaoauthclients)
* [platformName](#platformname)
* [messageImpressions](#messageimpressions)
* [blockedCountByType](#blockedcountbytype)
* [isChinaRepack](#ischinarepack)
* [userId](#userid)
* [profileRestartCount](#profilerestartcount)
* [homePageSettings](#homepagesettings)
* [newtabSettings](#newtabsettings)
* [isFissionExperimentEnabled](#isfissionexperimentenabled)
* [activeNotifications](#activenotifications)
* [isMajorUpgrade](#ismajorupgrade)
* [hasActiveEnterprisePolicies](#hasactiveenterprisepolicies)
* [userMonthlyActivity](#usermonthlyactivity)
* [doesAppNeedPin](#doesappneedpin)
* [doesAppNeedPrivatePin](#doesappneedprivatepin)
* [isBackgroundTaskMode](#isbackgroundtaskmode)
* [backgroundTaskName](#backgroundtaskname)
* [userPrefersReducedMotion](#userPrefersReducedMotion)
* [colorwaysActive](#colorwaysActive)
* [userEnabledActiveColorway](#userEnabledActiveColorway)
* [inMr2022Holdback](#inMr2022Holdback)
* [distributionId](#distributionId)
* [fxViewButtonAreaType](#fxViewButtonAreaType)
## Detailed usage
### `addonsInfo`
Provides information about the add-ons the user has installed.
Note that the `name`, `userDisabled`, and `installDate` is only available if `isFullData` is `true` (this is usually not the case right at start-up).
**Due to an existing bug, `userDisabled` is not currently available**
#### Examples
* Has the user installed the unicorn addon?
```java
addonsInfo.addons["unicornaddon@mozilla.org"]
```
* Has the user installed and disabled the unicorn addon?
```java
addonsInfo.isFullData && addonsInfo.addons["unicornaddon@mozilla.org"].userDisabled
```
#### Definition
```ts
declare const addonsInfo: Promise<AddonsInfoResponse>;
interface AddonsInfoResponse {
// Does this include extra information requiring I/O?
isFullData: boolean;
// addonId should be something like activity-stream@mozilla.org
[addonId: string]: {
// Version of the add-on
version: string;
// (string) e.g. "extension"
type: AddonType;
// Version of the add-on
isSystem: boolean;
// Is the add-on a webextension?
isWebExtension: boolean;
// The name of the add-on
name: string;
// Is the add-on disabled?
// CURRENTLY UNAVAILABLE due to an outstanding bug
userDisabled: boolean;
// When was it installed? e.g. "2018-03-10T03:41:06.000Z"
installDate: string;
};
}
```
### `attributionData`
An object containing information on exactly how Firefox was downloaded
#### Examples
* Was the browser installed via the `"back_to_school"` campaign?
```java
attributionData && attributionData.campaign == "back_to_school"
```
#### Definition
```ts
declare const attributionData: AttributionCode;
interface AttributionCode {
// Descriptor for where the download started from
campaign: string,
// A source, like addons.mozilla.org, or google.com
source: string,
// The medium for the download, like if this was referral
medium: string,
// Additional content, like an addonID for instance
content: string
}
```
### `browserSettings`
* `update`, which has information about Firefox update channel
#### Examples
* Is updating enabled?
```java
browserSettings.update.enabled
```
* Is beta channel?
```js
browserSettings.update.channel == 'beta'
```
#### Definition
```ts
declare const browserSettings: {
attribution: undefined | {
// Referring partner domain, when install happens via a known partner
// e.g. google.com
source: string;
// category of the source, such as "organic" for a search engine
// e.g. organic
medium: string;
// identifier of the particular campaign that led to the download of the product
// e.g. back_to_school
campaign: string;
// identifier to indicate the particular link within a campaign
// e.g. https://mozilla.org/some-page
content: string;
},
update: {
// Is auto-downloading enabled?
autoDownload: boolean;
// What release channel, e.g. "nightly"
channel: string;
// Is updating enabled?
enabled: boolean;
}
}
```
### `currentDate`
The current date at the moment message targeting is checked.
#### Examples
* Is the current date after Oct 3, 2018?
```java
currentDate > "Wed Oct 03 2018 00:00:00"|date
```
#### Definition
```ts
declare const currentDate; ECMA262DateString;
// ECMA262DateString = Date.toString()
type ECMA262DateString = string;
```
### `devToolsOpenedCount`
Number of usages of the web console.
#### Examples
* Has the user opened the web console more than 10 times?
```java
devToolsOpenedCount > 10
```
#### Definition
```ts
declare const devToolsOpenedCount: number;
```
### `isDefaultBrowser`
Is Firefox the user's default browser?
#### Definition
```ts
declare const isDefaultBrowser: boolean;
```
### `firefoxVersion`
The major Firefox version of the browser
#### Examples
* Is the version of the browser greater than 63?
```java
firefoxVersion > 63
```
#### Definition
```ts
declare const firefoxVersion: number;
```
### `locale`
The current locale of the browser including country code, e.g. `en-US`.
#### Examples
* Is the locale of the browser either English (US) or German (Germany)?
```java
locale in ["en-US", "de-DE"]
```
#### Definition
```ts
declare const locale: string;
```
### `localeLanguageCode`
The current locale of the browser NOT including country code, e.g. `en`.
This is useful for matching all countries of a particular language.
#### Examples
* Is the locale of the browser any English locale?
```java
localeLanguageCode == "en"
```
#### Definition
```ts
declare const localeLanguageCode: string;
```
### `needsUpdate`
Does the client have the latest available version installed
```ts
declare const needsUpdate: boolean;
```
### `pinnedSites`
The sites (including search shortcuts) that are pinned on a user's new tab page.
#### Examples
* Has the user pinned any site on `foo.com`?
```java
"foo.com" in pinnedSites|mapToProperty("host")
```
* Does the user have a pinned `duckduckgo.com` search shortcut?
```java
"duckduckgo.com" in pinnedSites[.searchTopSite == true]|mapToProperty("host")
```
#### Definition
```ts
interface PinnedSite {
// e.g. https://foo.mozilla.com/foo/bar
url: string;
// e.g. foo.mozilla.com
host: string;
// is the pin a search shortcut?
searchTopSite: boolean;
}
declare const pinnedSites: Array<PinnedSite>
```
### `previousSessionEnd`
Timestamp of the previously closed session.
#### Definition
```ts
declare const previousSessionEnd: UnixEpochNumber;
// UnixEpochNumber is UNIX Epoch timestamp, e.g. 1522843725924
type UnixEpochNumber = number;
```
### `profileAgeCreated`
The date the profile was created as a UNIX Epoch timestamp.
#### Definition
```ts
declare const profileAgeCreated: UnixEpochNumber;
// UnixEpochNumber is UNIX Epoch timestamp, e.g. 1522843725924
type UnixEpochNumber = number;
```
### `profileAgeReset`
The date the profile was reset as a UNIX Epoch timestamp (if it was reset).
#### Examples
* Was the profile never reset?
```java
!profileAgeReset
```
#### Definition
```ts
// profileAgeReset can be undefined if the profile was never reset
// UnixEpochNumber is number, e.g. 1522843725924
declare const profileAgeReset: undefined | UnixEpochNumber;
// UnixEpochNumber is UNIX Epoch timestamp, e.g. 1522843725924
type UnixEpochNumber = number;
```
### `providerCohorts`
Information about cohort settings (from prefs, including shield studies) for each provider.
#### Examples
* Is the user in the "foo_test" cohort for snippets?
```java
providerCohorts.snippets == "foo_test"
```
#### Definition
```ts
declare const providerCohorts: {
[providerId: string]: string;
}
```
### `region`
Country code retrieved from `location.services.mozilla.com`. Can be `""` if request did not finish or encountered an error.
#### Examples
* Is the user in Canada?
```java
region == "CA"
```
#### Definition
```ts
declare const region: string;
```
### `searchEngines`
Information about the current and available search engines.
#### Examples
* Is the current default search engine set to google?
```java
searchEngines.current == "google"
```
#### Definition
```ts
declare const searchEngines: Promise<SearchEnginesResponse>;
interface SearchEnginesResponse: {
current: SearchEngineId;
installed: Array<SearchEngineId>;
}
// This is an identifier for a search engine such as "google" or "amazondotcom"
type SearchEngineId = string;
```
### `sync`
Information about synced devices.
#### Examples
* Is at least 1 mobile device synced to this profile?
```java
sync.mobileDevices > 0
```
#### Definition
```ts
declare const sync: {
desktopDevices: number;
mobileDevices: number;
totalDevices: number;
}
```
### `topFrecentSites`
Information about the browser's top 25 frecent sites.
**Please note this is a restricted targeting property that influences what telemetry is allowed to be collected may not be used without review**
#### Examples
* Is mozilla.com in the user's top frecent sites with a frececy greater than 400?
```java
"mozilla.com" in topFrecentSites[.frecency >= 400]|mapToProperty("host")
```
#### Definition
```ts
declare const topFrecentSites: Promise<Array<TopSite>>
interface TopSite {
// e.g. https://foo.mozilla.com/foo/bar
url: string;
// e.g. foo.mozilla.com
host: string;
frecency: number;
lastVisitDate: UnixEpochNumber;
}
// UnixEpochNumber is UNIX Epoch timestamp, e.g. 1522843725924
type UnixEpochNumber = number;
```
### `totalBookmarksCount`
Total number of bookmarks.
#### Definition
```ts
declare const totalBookmarksCount: number;
```
### `usesFirefoxSync`
Does the user use Firefox sync?
#### Definition
```ts
declare const usesFirefoxSync: boolean;
```
### `isFxAEnabled`
Does the user have Firefox sync enabled? The service could potentially be turned off [for enterprise builds](https://searchfox.org/mozilla-central/rev/b59a99943de4dd314bae4e44ab43ce7687ccbbec/browser/components/enterprisepolicies/Policies.jsm#327).
#### Definition
```ts
declare const isFxAEnabled: boolean;
```
### `isFxASignedIn`
Is the user signed in to a Firefox Account?
#### Definition
```ts
declare const isFxASignedIn: Promise<boolean>
```
### `xpinstallEnabled`
Pref used by system administrators to disallow add-ons from installed altogether.
#### Definition
```ts
declare const xpinstallEnabled: boolean;
```
### `hasPinnedTabs`
Does the user have any pinned tabs in any windows.
#### Definition
```ts
declare const hasPinnedTabs: boolean;
```
### `hasAccessedFxAPanel`
Boolean pref that gets set the first time the user opens the FxA toolbar panel
#### Definition
```ts
declare const hasAccessedFxAPanel: boolean;
```
### `isWhatsNewPanelEnabled`
Boolean pref that controls if the What's New panel feature is enabled
#### Definition
```ts
declare const isWhatsNewPanelEnabled: boolean;
```
### `totalBlockedCount`
Total number of events from the content blocking database
#### Definition
```ts
declare const totalBlockedCount: number;
```
### `recentBookmarks`
An array of GUIDs of recent bookmarks as provided by [`NewTabUtils.getRecentBookmarks`](https://searchfox.org/mozilla-central/rev/c5c002f81f08a73e04868e0c2bf0eb113f200b03/toolkit/modules/NewTabUtils.sys.mjs#1059)
#### Definition
```ts
interface Bookmark {
bookmarkGuid: string;
url: string;
title: string;
...
}
declare const recentBookmarks: Array<Bookmark>
```
### `userPrefs`
Information about user facing prefs configurable from `about:preferences`.
#### Examples
```java
userPrefs.cfrFeatures == false
```
#### Definition
```ts
declare const userPrefs: {
cfrFeatures: boolean;
cfrAddons: boolean;
snippets: boolean;
}
```
### `attachedFxAOAuthClients`
Information about connected services associated with the FxA Account.
Return an empty array if no account is found or an error occurs.
#### Definition
```
interface OAuthClient {
// OAuth client_id of the service
// https://docs.telemetry.mozilla.org/datasets/fxa_metrics/attribution.html#service-attribution
id: string;
lastAccessedDaysAgo: number;
}
declare const attachedFxAOAuthClients: Promise<OAuthClient[]>
```
#### Examples
```javascript
{
id: "7377719276ad44ee",
name: "Pocket",
lastAccessTime: 1513599164000
}
```
### `platformName`
[Platform information](https://searchfox.org/mozilla-central/rev/c5c002f81f08a73e04868e0c2bf0eb113f200b03/toolkit/modules/AppConstants.sys.mjs#153).
#### Definition
```
declare const platformName = "linux" | "win" | "macosx" | "android" | "other";
```
### `messageImpressions`
Dictionary that maps message ids to impression timestamps. Timestamps are stored in
consecutive order. Can be used to detect first impression of a message, number of
impressions. Can be used in targeting to show a message if another message has been
seen.
Impressions are used for frequency capping so we only store them if the message has
`frequency` configured.
Impressions for badges might not work as expected: we add a badge for every opened
window so the number of impressions stored might be higher than expected. Additionally
not all badges have `frequency` cap so `messageImpressions` might not be defined.
Badge impressions should not be used for targeting.
#### Definition
```
declare const messageImpressions: { [key: string]: Array<UnixEpochNumber> };
```
### `blockedCountByType`
Returns a breakdown by category of all blocked resources in the past 42 days.
#### Definition
```
declare const messageImpressions: { [key: string]: number };
```
#### Examples
```javascript
Object {
trackerCount: 0,
cookieCount: 34,
cryptominerCount: 0,
fingerprinterCount: 3,
socialCount: 2
}
```
### `isChinaRepack`
Does the user use [the partner repack distributed by Mozilla Online](https://github.com/mozilla-partners/mozillaonline),
a wholly owned subsidiary of the Mozilla Corporation that operates in China.
#### Definition
```ts
declare const isChinaRepack: boolean;
```
### `userId`
A unique user id generated by Normandy (note that this is not clientId).
#### Definition
```ts
declare const userId: string;
```
### `profileRestartCount`
A session counter that shows how many times the browser was started.
More info about the details in [the telemetry docs](https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/concepts/sessions.html).
#### Definition
```ts
declare const profileRestartCount: number;
```
### `homePageSettings`
An object reflecting the current settings of the browser home page (about:home)
#### Definition
```ts
declare const homePageSettings: {
isDefault: boolean;
isLocked: boolean;
isWebExt: boolean;
isCustomUrl: boolean;
urls: Array<URL>;
}
interface URL {
url: string;
host: string;
}
```
#### Examples
* Default about:home
```javascript
Object {
isDefault: true,
isLocked: false,
isCustomUrl: false,
isWebExt: false,
urls: [
{ url: "about:home", host: "" }
],
}
```
* Default about:home with locked preference
```javascript
Object {
isDefault: true,
isLocked: true,
isCustomUrl: false,
isWebExt: false,
urls: [
{ url: "about:home", host: "" }
],
}
```
* Custom URL
```javascript
Object {
isDefault: false,
isLocked: false,
isCustomUrl: true,
isWebExt: false,
urls: [
{ url: "https://www.google.com", host: "google.com" }
],
}
```
* Custom URLs
```javascript
Object {
isDefault: false,
isLocked: false,
isCustomUrl: true,
isWebExt: false,
urls: [
{ url: "https://www.google.com", host: "google.com" },
{ url: "https://www.youtube.com", host: "youtube.com" }
],
}
```
* Web extension
```javascript
Object {
isDefault: false,
isLocked: false,
isCustomUrl: false,
isWebExt: true,
urls: [
{ url: "moz-extension://123dsa43213acklncd/home.html", host: "" }
],
}
```
### `newtabSettings`
An object reflecting the current settings of the browser newtab page (about:newtab)
#### Definition
```ts
declare const newtabSettings: {
isDefault: boolean;
isWebExt: boolean;
isCustomUrl: boolean;
url: string;
host: string;
}
```
#### Examples
* Default about:newtab
```javascript
Object {
isDefault: true,
isCustomUrl: false,
isWebExt: false,
url: "about:newtab",
host: "",
}
```
* Custom URL
```javascript
Object {
isDefault: false,
isCustomUrl: true,
isWebExt: false,
url: "https://www.google.com",
host: "google.com",
}
```
* Web extension
```javascript
Object {
isDefault: false,
isCustomUrl: false,
isWebExt: true,
url: "moz-extension://123dsa43213acklncd/home.html",
host: "",
}
```
### `isFissionExperimentEnabled`
A boolean. `true` if we're running Fission experiment, `false` otherwise.
### `activeNotifications`
True when an infobar style message is displayed or when the awesomebar is
expanded to show a message (for example onboarding tips).
### `isMajorUpgrade`
A boolean. `true` if the browser just updated to a new major version.
### `hasActiveEnterprisePolicies`
A boolean. `true` if any Enterprise Policies are active.
### `userMonthlyActivity`
Returns an array of entries in the form `[int, unixTimestamp]` for each day of
user activity where the first entry is the total urls visited for that day.
### `doesAppNeedPin`
Checks if Firefox app can be and isn't pinned to OS taskbar/dock.
### `doesAppNeedPrivatePin`
Checks if Firefox Private Browsing Mode can be and isn't pinned to OS taskbar/dock. Currently this only works on certain Windows versions.
### `isBackgroundTaskMode`
Checks if this invocation is running in background task mode.
### `backgroundTaskName`
A non-empty string task name if this invocation is running in background task
mode, or `null` if this invocation is not running in background task mode.
### `userPrefersReducedMotion`
Checks if user prefers reduced motion as indicated by the value of a media query for `prefers-reduced-motion`.
### `colorwaysActive`
A boolean. `true` when there are Colorways available.
### `userEnabledActiveColorway`
A boolean. `true` when user has an active Colorway theme enabled.
### `inMr2022Holdback`
A boolean. `true` when the user is in the Major Release 2022 holdback study.
### `distributionId`
A string containing the id of the distribution, or the empty string if there
is no distribution associated with the build.
### `fxViewButtonAreaType`
A string of the name of the container where the Firefox View button is shown, null if the button has been removed.
|