@salesforcedevs/dw-components 1.3.51 → 1.3.52

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.51",
3
+ "version": "1.3.52",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -31,6 +31,18 @@ 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
+ };
34
46
  export default class DeSignupForm extends LightningElement {
35
47
  @api
36
48
  get countries() {
@@ -151,12 +163,10 @@ export default class DeSignupForm extends LightningElement {
151
163
  submitForm(formData)
152
164
  .then(() => {
153
165
  trackGtm(event.target!, "custEv_signUp", {
154
- authenticationMethod: "dev edition sign up form",
155
- authenticationType: "dev edition",
156
- userId: this.username,
157
- newRegistration: true
166
+ ...ANALYTICS_INFO,
167
+ formId: "form-builder|DEVELOPER:xx:signup|<null>"
158
168
  });
159
- window.location.href = "/signup/success";
169
+ window.location.href = ANALYTICS_INFO.clickUrl;
160
170
  })
161
171
  .catch((error) => {
162
172
  if (error.message === ErrorCode.DUPLICATE) {
@@ -2,6 +2,17 @@ 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
+ };
5
16
  const LOCAL_STORAGE_KEY = "subscriberEmail";
6
17
 
7
18
  export default class Form extends LightningElement {
@@ -148,17 +159,7 @@ export default class Form extends LightningElement {
148
159
  }
149
160
 
150
161
  // GTM event
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_formCompletion", ANALYTICS_INFO);
162
163
 
163
164
  window.location.assign("/newsletter/success");
164
165
  } catch (error) {
@@ -109,31 +109,40 @@ 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
112
+ eventName: string,
113
+ navItemPrefix: string
113
114
  ) => {
114
- track(target || document, eventName, {
115
- clickText: target.textContent?.trim() || "",
116
- clickUrl: target.href || "",
117
- elementTitle: "a",
118
- elementType: "link",
119
- contentCategory: "tbid"
120
- });
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);
121
130
  };
122
131
 
123
132
  // Track link clicks on the "logged out" version of the dropdown.
124
133
  private trackLoginMenuClick = (event: Event) => {
125
134
  const target = event.currentTarget as HTMLAnchorElement | null;
126
- this.trackMenuClick(target, "custEv_loginClick");
135
+ this.trackMenuClick(target, "custEv_loginClick", "login:salesforce:");
127
136
  };
128
137
 
129
138
  // Track link clicks on the "logged in" version of the dropdown.
130
139
  private trackLoggedInMenuClick = (event: Event) => {
131
140
  const target = event.currentTarget as HTMLAnchorElement | null;
132
- this.trackMenuClick(target, "custEv_loginMenuClick");
141
+ this.trackMenuClick(target, "custEv_loginMenuClick", "login:tbid:");
133
142
  };
134
143
 
135
144
  // Special tracking for clicking on "Logout" specifically
136
145
  private trackLogoutClick = (target: HTMLAnchorElement | null) => {
137
- this.trackMenuClick(target, "custEv_userLogout");
146
+ this.trackMenuClick(target, "custEv_userLogout", "login:tbid:");
138
147
  };
139
148
  }
@@ -48,18 +48,14 @@ export abstract class PostsGrid extends LightningElement {
48
48
  track(e.target, "custEv_ctaLinkClick", {
49
49
  ...ANALYTICS_INFO,
50
50
  clickText: "show more",
51
- elementTitle: "dx-button",
52
- elementType: "button",
53
- contentCategory: "cta"
51
+ itemTitle: "show more"
54
52
  });
55
53
  } else {
56
54
  track(e.target, "custEv_ctaLinkClick", {
57
55
  ...ANALYTICS_INFO,
58
56
  clickText: "view archives",
59
- clickUrl: "https://developer.salesforce.com/content-archive",
60
- elementTitle: "dx-button",
61
- elementType: "button",
62
- contentCategory: "cta"
57
+ itemTitle: "view archives",
58
+ clickUrl: "https://developer.salesforce.com/content-archive"
63
59
  });
64
60
  }
65
61
  }