@salesforcedevs/dw-components 1.3.52 → 1.3.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dw-components",
3
- "version": "1.3.52",
3
+ "version": "1.3.53",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -29,6 +29,7 @@
29
29
  icon-sprite="general"
30
30
  href="https://developer.salesforce.com/blogs/feed"
31
31
  class="button"
32
+ onclick={rssOnClick}
32
33
  >
33
34
  Subscribe to RSS
34
35
  </dx-button>
@@ -6,12 +6,11 @@ import { PostsGrid } from "dwBaseElements/postsGrid";
6
6
  const BLOG_SUBSCRIBE_HREF = "https://developer.salesforce.com/blogs/feed";
7
7
 
8
8
  const ANALYTICS_INFO = {
9
- itemTitle: "Blogs RSS Subscribe Button",
10
- elementType: "button",
11
- destinationType: "internal",
12
- clickText: "Subscribe",
13
- clickUrl: BLOG_SUBSCRIBE_HREF,
14
- ctaClick: true
9
+ click_text: "Subscribe to RSS",
10
+ element_title: "dx-button",
11
+ click_url: BLOG_SUBSCRIBE_HREF,
12
+ element_type: "link",
13
+ content_category: "cta"
15
14
  };
16
15
 
17
16
  export default class BlogsGrid extends PostsGrid {
@@ -23,6 +22,6 @@ export default class BlogsGrid extends PostsGrid {
23
22
 
24
23
  rssOnClick(event: Event): void {
25
24
  track(event.target!, "custEv_ctaButtonClick", ANALYTICS_INFO);
26
- window.location.href = BLOG_SUBSCRIBE_HREF;
25
+ track(event.target!, "custEv_linkClick", ANALYTICS_INFO);
27
26
  }
28
27
  }
@@ -113,6 +113,7 @@
113
113
  icon-symbol="new_window"
114
114
  variant="inline"
115
115
  href={item.href}
116
+ onclick={handleReadItClick}
116
117
  >
117
118
  {item.buttonText}
118
119
  </dx-button>
@@ -5,6 +5,7 @@ import orderBy from "lodash.orderby";
5
5
  import cloneDeep from "lodash.clonedeep";
6
6
  import { DocsTile, DropdownItem, CodeSample } from "typings/custom";
7
7
  import { toJson } from "dxUtils/normalizers";
8
+ import { track } from "dxUtils/analytics";
8
9
 
9
10
  const PRODUCT_FILTER_ALL_PRODUCTS = "all products";
10
11
  const LANGUAGE_FILTER_LABEL = "Type";
@@ -36,6 +37,7 @@ export default class CodeSamplesGrid extends LightningElement {
36
37
  private isMobile = "(min-width: 401px) and (max-width: 1023px)";
37
38
  private isMobileSmall = "(max-width: 400px)";
38
39
  private showSourcesFilter = false;
40
+ private filteredItemsSelected: boolean = false;
39
41
  private filtersDefaultValue = {
40
42
  selectedSourceFilter: [],
41
43
  selectedTypeFilter: [],
@@ -111,6 +113,18 @@ export default class CodeSamplesGrid extends LightningElement {
111
113
  this.matchMobile.removeEventListener("change", this.handleView);
112
114
  this.matchMobileSmall.removeEventListener("change", this.handleView);
113
115
  window.removeEventListener("popstate", this.handleURLStateChange);
116
+
117
+ if (!this.filteredItemsSelected) {
118
+ this.selectedProductFilter?.forEach((filter) => {
119
+ track(document, "custEv_filterAbandoned", {
120
+ click_text: filter,
121
+ click_url: filter,
122
+ element_title: "CodeSamplesGrid",
123
+ element_type: "filter abandoned",
124
+ content_category: "filter"
125
+ });
126
+ });
127
+ }
114
128
  }
115
129
 
116
130
  @api
@@ -336,6 +350,7 @@ export default class CodeSamplesGrid extends LightningElement {
336
350
  this.selectedProductFilter = newList;
337
351
  }
338
352
  this.calculatePagination();
353
+ this.filteredItemsSelected = false;
339
354
  }
340
355
 
341
356
  handleLanguageFilterChange(event: CustomEvent): void {
@@ -427,4 +442,17 @@ export default class CodeSamplesGrid extends LightningElement {
427
442
  const newurl = `${window.location.pathname}?${searchParams}`;
428
443
  window.history.pushState({ path: newurl }, "", newurl);
429
444
  }
445
+
446
+ handleReadItClick() {
447
+ this.filteredItemsSelected = true;
448
+ this.selectedProductFilter?.forEach((filter) => {
449
+ track(document, "custEv_filterApplied", {
450
+ click_text: filter,
451
+ click_url: filter,
452
+ element_title: "dx-button",
453
+ element_type: "filter applied",
454
+ content_category: "filter"
455
+ });
456
+ });
457
+ }
430
458
  }
@@ -31,18 +31,6 @@ const DUPLICATE_USERNAME_MESSAGE =
31
31
  const ACCEPTED = "accepted";
32
32
  const SIGN_UP_LABEL = "Sign me Up";
33
33
 
34
- const ANALYTICS_INFO = {
35
- clickText: "Sign me Up",
36
- itemTitle: "Dev Edition Sign Up Button",
37
- formType: "Dev Edition Sign Up",
38
- formName: "DEVELOPER:xx:signup:Developer-Edition",
39
- method: "email",
40
- clickUrl: "/signup/success",
41
- elementType: "button",
42
- destinationType: "internal",
43
- ctaClick: true,
44
- offerType: "Free Trial"
45
- };
46
34
  export default class DeSignupForm extends LightningElement {
47
35
  @api
48
36
  get countries() {
@@ -163,10 +151,12 @@ export default class DeSignupForm extends LightningElement {
163
151
  submitForm(formData)
164
152
  .then(() => {
165
153
  trackGtm(event.target!, "custEv_signUp", {
166
- ...ANALYTICS_INFO,
167
- formId: "form-builder|DEVELOPER:xx:signup|<null>"
154
+ authenticationMethod: "dev edition sign up form",
155
+ authenticationType: "dev edition",
156
+ userId: this.username,
157
+ newRegistration: true
168
158
  });
169
- window.location.href = ANALYTICS_INFO.clickUrl;
159
+ window.location.href = "/signup/success";
170
160
  })
171
161
  .catch((error) => {
172
162
  if (error.message === ErrorCode.DUPLICATE) {
@@ -54,6 +54,7 @@
54
54
  <dx-button
55
55
  variant="inline"
56
56
  href={item.guidesHref}
57
+ onclick={handleReadItClick}
57
58
  if:false={item.links}
58
59
  >
59
60
  Read It
@@ -5,6 +5,7 @@ import qs from "query-string";
5
5
  import uniqBy from "lodash.uniqby";
6
6
  import orderBy from "lodash.orderby";
7
7
  import { isGivenLanguageSupported } from "dxUtils/language";
8
+ import { track } from "dxUtils/analytics";
8
9
 
9
10
  const DSC_API_URL = {
10
11
  "en-us": "/docs/get_index/en-us/000.0/false/All%20Services/all",
@@ -41,6 +42,7 @@ export default abstract class DocsGrid extends LightningElement {
41
42
  private _searchTimeout?: number;
42
43
  private _couchDbDocTileExclusions?: Set<any>;
43
44
  private _allLanguages: Array<Language> = [];
45
+ private filteredItemsSelected: boolean = false;
44
46
 
45
47
  connectedCallback(): void {
46
48
  this.retrieveDscApis(true);
@@ -76,6 +78,18 @@ export default abstract class DocsGrid extends LightningElement {
76
78
  "change",
77
79
  this.handleMobileSmallView
78
80
  );
81
+
82
+ if (!this.filteredItemsSelected) {
83
+ this.selectedProductFilters?.forEach((filter) => {
84
+ track(document, "custEv_filterAbandoned", {
85
+ click_text: filter,
86
+ click_url: filter,
87
+ element_title: "CodeSamplesGrid",
88
+ element_type: "filter abandoned",
89
+ content_category: "filter"
90
+ });
91
+ });
92
+ }
79
93
  }
80
94
 
81
95
  @api apiDomain = "https://developer.salesforce.com";
@@ -403,6 +417,7 @@ export default abstract class DocsGrid extends LightningElement {
403
417
  this.selectedProductFilters = newList;
404
418
  }
405
419
  this.calculatePagination();
420
+ this.filteredItemsSelected = false;
406
421
  }
407
422
 
408
423
  handleLanguageFilterChange(event): void {
@@ -537,4 +552,17 @@ export default abstract class DocsGrid extends LightningElement {
537
552
  this.calculatePagination(urlParams.page, true);
538
553
  }
539
554
  };
555
+
556
+ handleReadItClick() {
557
+ this.filteredItemsSelected = true;
558
+ this.selectedProductFilters?.forEach((filter) => {
559
+ track(document, "custEv_filterApplied", {
560
+ click_text: filter,
561
+ click_url: filter,
562
+ element_title: "dx-button",
563
+ element_type: "filter applied",
564
+ content_category: "filter"
565
+ });
566
+ });
567
+ }
540
568
  }
@@ -2,17 +2,6 @@ import { LightningElement, api } from "lwc";
2
2
  import { track } from "dxUtils/analytics";
3
3
  import { CountryOptions, CheckboxTextSet } from "typings/custom";
4
4
 
5
- const ANALYTICS_INFO = {
6
- itemTitle: "newsletter sign up submit",
7
- formName: "newsletter",
8
- formType: "newsletter",
9
- method: "email",
10
- destinationType: "internal",
11
- clickText: "Subscribe Now",
12
- clickUrl: "/newsletter/success",
13
- elementType: "button",
14
- ctaClick: true
15
- };
16
5
  const LOCAL_STORAGE_KEY = "subscriberEmail";
17
6
 
18
7
  export default class Form extends LightningElement {
@@ -159,8 +148,24 @@ export default class Form extends LightningElement {
159
148
  }
160
149
 
161
150
  // GTM event
162
- track(submitButtonEl, "custEv_formCompletion", ANALYTICS_INFO);
163
-
151
+ track(submitButtonEl, "custEv_formCompletion", {
152
+ itemTitle: "newsletter sign up submit",
153
+ formName: "newsletter",
154
+ formType: "newsletter",
155
+ method: "email",
156
+ destinationType: "internal",
157
+ clickText: "Subscribe Now",
158
+ clickUrl: "/newsletter/success",
159
+ elementType: "button",
160
+ ctaClick: true
161
+ });
162
+ track(submitButtonEl, "custEv_linkClick", {
163
+ click_text: "Subscribe Now",
164
+ element_title: "button",
165
+ click_url: "/newsletter/success",
166
+ element_type: "button",
167
+ content_category: "cta"
168
+ });
164
169
  window.location.assign("/newsletter/success");
165
170
  } catch (error) {
166
171
  if (submitButtonEl) {
@@ -109,40 +109,31 @@ export default class TbidLoginMenu extends LightningElement {
109
109
  // Shared utility for tracking link clicks.
110
110
  private trackMenuClick = (
111
111
  target: HTMLAnchorElement | null,
112
- eventName: string,
113
- navItemPrefix: string
112
+ eventName: string
114
113
  ) => {
115
- const trackingPayload: any = {
116
- nav_level: "utility",
117
- nav_type: "global",
118
- elementType: "link"
119
- };
120
-
121
- if (target) {
122
- trackingPayload.clickText = target.textContent?.trim() || "";
123
- trackingPayload.clickUrl = target.href;
124
- const [firstWord, ...remainingText] =
125
- trackingPayload.clickText.split(" ");
126
- trackingPayload.nav_item = `${navItemPrefix}${firstWord.toLowerCase()}${remainingText.join()}`;
127
- }
128
-
129
- track(target || document, eventName, trackingPayload);
114
+ track(target || document, eventName, {
115
+ click_text: target.textContent?.trim() || "",
116
+ click_url: target.href || "",
117
+ element_title: "a",
118
+ element_type: "link",
119
+ content_category: "tbid"
120
+ });
130
121
  };
131
122
 
132
123
  // Track link clicks on the "logged out" version of the dropdown.
133
124
  private trackLoginMenuClick = (event: Event) => {
134
125
  const target = event.currentTarget as HTMLAnchorElement | null;
135
- this.trackMenuClick(target, "custEv_loginClick", "login:salesforce:");
126
+ this.trackMenuClick(target, "custEv_loginClick");
136
127
  };
137
128
 
138
129
  // Track link clicks on the "logged in" version of the dropdown.
139
130
  private trackLoggedInMenuClick = (event: Event) => {
140
131
  const target = event.currentTarget as HTMLAnchorElement | null;
141
- this.trackMenuClick(target, "custEv_loginMenuClick", "login:tbid:");
132
+ this.trackMenuClick(target, "custEv_loginMenuClick");
142
133
  };
143
134
 
144
135
  // Special tracking for clicking on "Logout" specifically
145
136
  private trackLogoutClick = (target: HTMLAnchorElement | null) => {
146
- this.trackMenuClick(target, "custEv_userLogout", "login:tbid:");
137
+ this.trackMenuClick(target, "custEv_userLogout");
147
138
  };
148
139
  }
@@ -4,9 +4,9 @@ import { track } from "dxUtils/analytics";
4
4
  import { WordpressPost, NormalizedPost } from "typings/custom";
5
5
 
6
6
  const ANALYTICS_INFO = {
7
- elementType: "link",
8
- destinationType: "internal",
9
- ctaClick: true
7
+ element_type: "link",
8
+ destination_type: "internal",
9
+ cta_click: true
10
10
  };
11
11
  export abstract class PostsGrid extends LightningElement {
12
12
  @api columns = "three";
@@ -47,15 +47,19 @@ export abstract class PostsGrid extends LightningElement {
47
47
  this._morePostsViewed = true;
48
48
  track(e.target, "custEv_ctaLinkClick", {
49
49
  ...ANALYTICS_INFO,
50
- clickText: "show more",
51
- itemTitle: "show more"
50
+ click_text: "show more",
51
+ element_title: "dx-button",
52
+ element_type: "button",
53
+ content_category: "cta"
52
54
  });
53
55
  } else {
54
56
  track(e.target, "custEv_ctaLinkClick", {
55
57
  ...ANALYTICS_INFO,
56
- clickText: "view archives",
57
- itemTitle: "view archives",
58
- clickUrl: "https://developer.salesforce.com/content-archive"
58
+ click_text: "view archives",
59
+ click_url: "https://developer.salesforce.com/content-archive",
60
+ element_title: "dx-button",
61
+ element_type: "button",
62
+ content_category: "cta"
59
63
  });
60
64
  }
61
65
  }