@maxzima/wa-communicator 1.0.42 → 1.0.44
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/dist/engine/AccountTracker/Enums/AccountTrackerEnum.d.ts +3 -1
- package/dist/engine/AccountTracker/Enums/AccountTrackerEnum.js +2 -0
- package/dist/engine/AccountTracker/Public/AccountTracker.d.ts +2 -0
- package/dist/engine/AccountTracker/Public/AccountTracker.js +6 -0
- package/dist/engine/AccountTracker/Types/TAccountTracker.d.ts +13 -3
- package/package.json +1 -1
- package/src/engine/AccountTracker/Enums/AccountTrackerEnum.ts +2 -0
- package/src/engine/AccountTracker/Public/AccountTracker.ts +8 -0
- package/src/engine/AccountTracker/Types/TAccountTracker.ts +18 -3
- package/test/accountTracker.spec.ts +13 -0
- package/test/testunits/accountTracker/events.ts +24 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare enum GTMEventEnum {
|
|
2
2
|
SIGN_UP = "sign_up",
|
|
3
|
-
SIGN_UP_ONLINE = "sign_up_online"
|
|
3
|
+
SIGN_UP_ONLINE = "sign_up_online",
|
|
4
|
+
VERIFY_EMAIL_ONLINE = "verify_email_online",
|
|
5
|
+
VERIFY_PHONE_ONLINE = "verify_phone_online"
|
|
4
6
|
}
|
|
5
7
|
export declare enum GTMEventParamsEnum {
|
|
6
8
|
GCLID = "gclid",
|
|
@@ -2,6 +2,8 @@ export var GTMEventEnum;
|
|
|
2
2
|
(function (GTMEventEnum) {
|
|
3
3
|
GTMEventEnum["SIGN_UP"] = "sign_up";
|
|
4
4
|
GTMEventEnum["SIGN_UP_ONLINE"] = "sign_up_online";
|
|
5
|
+
GTMEventEnum["VERIFY_EMAIL_ONLINE"] = "verify_email_online";
|
|
6
|
+
GTMEventEnum["VERIFY_PHONE_ONLINE"] = "verify_phone_online";
|
|
5
7
|
})(GTMEventEnum || (GTMEventEnum = {}));
|
|
6
8
|
export var GTMEventParamsEnum;
|
|
7
9
|
(function (GTMEventParamsEnum) {
|
|
@@ -3,6 +3,8 @@ export declare class AccountTracker {
|
|
|
3
3
|
private props;
|
|
4
4
|
constructor(props: TAccountTrackerProps);
|
|
5
5
|
sendRegistrationSuccessEvent(eventParams: TAccountTrackerEventParams): void;
|
|
6
|
+
sendVerifyPhoneSuccessEvent(eventParams: TAccountTrackerEventParams): void;
|
|
7
|
+
sendVerifyEmailSuccessEvent(eventParams: TAccountTrackerEventParams): void;
|
|
6
8
|
private sendGtmEvent;
|
|
7
9
|
private sendLinkedInEvent;
|
|
8
10
|
}
|
|
@@ -27,4 +27,10 @@ export class AccountTracker {
|
|
|
27
27
|
this.sendGtmEvent(GTMEventEnum.SIGN_UP_ONLINE, eventParams.gtm);
|
|
28
28
|
this.sendLinkedInEvent(LintrkEventIdEnum.REGISTRATION);
|
|
29
29
|
}
|
|
30
|
+
sendVerifyPhoneSuccessEvent(eventParams) {
|
|
31
|
+
this.sendGtmEvent(GTMEventEnum.VERIFY_PHONE_ONLINE, eventParams.gtm);
|
|
32
|
+
}
|
|
33
|
+
sendVerifyEmailSuccessEvent(eventParams) {
|
|
34
|
+
this.sendGtmEvent(GTMEventEnum.VERIFY_EMAIL_ONLINE, eventParams.gtm);
|
|
35
|
+
}
|
|
30
36
|
}
|
|
@@ -7,12 +7,12 @@ export type TAccountTrackerProps = {
|
|
|
7
7
|
lintrk?: (action: LintrkActionTypeEnum, options: TLintrkOptions) => void;
|
|
8
8
|
};
|
|
9
9
|
export type TAccountTrackerEventParams = {
|
|
10
|
-
|
|
10
|
+
gtm: TAccountTrackerGtmEventParamsMapping;
|
|
11
11
|
};
|
|
12
12
|
export type TAccountTrackerGtmEventParamsMapping = {
|
|
13
|
-
[event in GTMEventEnum]
|
|
13
|
+
[event in GTMEventEnum]?: TAccountTrackerGtmEventParams;
|
|
14
14
|
};
|
|
15
|
-
export type TAccountTrackerGtmEventParams = TAccountTrackerGtmSignUpEventParams | TAccountTrackerGtmSignUpOnlineEventParams;
|
|
15
|
+
export type TAccountTrackerGtmEventParams = TAccountTrackerGtmSignUpEventParams | TAccountTrackerGtmSignUpOnlineEventParams | TAccountTrackerGtmVerifyPhoneOnlineEventParams | TAccountTrackerGtmVerifyEmailOnlineEventParams;
|
|
16
16
|
export type TAccountTrackerGtmSignUpEventParams = {
|
|
17
17
|
[GTMEventParamsEnum.GCLID]: string;
|
|
18
18
|
[GTMEventParamsEnum.EMAIL]: string;
|
|
@@ -23,3 +23,13 @@ export type TAccountTrackerGtmSignUpOnlineEventParams = {
|
|
|
23
23
|
[GTMEventParamsEnum.SEND_TO]: string;
|
|
24
24
|
[GTMEventParamsEnum.GCL_ID]: string;
|
|
25
25
|
};
|
|
26
|
+
export type TAccountTrackerGtmVerifyPhoneOnlineEventParams = {
|
|
27
|
+
[GTMEventParamsEnum.ORIGIN]: string;
|
|
28
|
+
[GTMEventParamsEnum.SEND_TO]: string;
|
|
29
|
+
[GTMEventParamsEnum.GCL_ID]: string;
|
|
30
|
+
};
|
|
31
|
+
export type TAccountTrackerGtmVerifyEmailOnlineEventParams = {
|
|
32
|
+
[GTMEventParamsEnum.ORIGIN]: string;
|
|
33
|
+
[GTMEventParamsEnum.SEND_TO]: string;
|
|
34
|
+
[GTMEventParamsEnum.GCL_ID]: string;
|
|
35
|
+
};
|
package/package.json
CHANGED
|
@@ -18,6 +18,14 @@ export class AccountTracker {
|
|
|
18
18
|
this.sendLinkedInEvent(LintrkEventIdEnum.REGISTRATION);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
public sendVerifyPhoneSuccessEvent (eventParams: TAccountTrackerEventParams) {
|
|
22
|
+
this.sendGtmEvent(GTMEventEnum.VERIFY_PHONE_ONLINE, eventParams.gtm);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public sendVerifyEmailSuccessEvent (eventParams: TAccountTrackerEventParams) {
|
|
26
|
+
this.sendGtmEvent(GTMEventEnum.VERIFY_EMAIL_ONLINE, eventParams.gtm);
|
|
27
|
+
}
|
|
28
|
+
|
|
21
29
|
private sendGtmEvent = (event: GTMEventEnum, eventParams: TAccountTrackerGtmEventParamsMapping) => {
|
|
22
30
|
if (typeof this.props.gtmDataLayer === 'undefined') {
|
|
23
31
|
return;
|
|
@@ -14,14 +14,17 @@ export type TAccountTrackerProps = {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export type TAccountTrackerEventParams = {
|
|
17
|
-
|
|
17
|
+
gtm: TAccountTrackerGtmEventParamsMapping;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export type TAccountTrackerGtmEventParamsMapping = {
|
|
21
|
-
[event in GTMEventEnum]
|
|
21
|
+
[event in GTMEventEnum]?: TAccountTrackerGtmEventParams;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
export type TAccountTrackerGtmEventParams = TAccountTrackerGtmSignUpEventParams
|
|
24
|
+
export type TAccountTrackerGtmEventParams = TAccountTrackerGtmSignUpEventParams
|
|
25
|
+
| TAccountTrackerGtmSignUpOnlineEventParams
|
|
26
|
+
| TAccountTrackerGtmVerifyPhoneOnlineEventParams
|
|
27
|
+
| TAccountTrackerGtmVerifyEmailOnlineEventParams;
|
|
25
28
|
|
|
26
29
|
export type TAccountTrackerGtmSignUpEventParams = {
|
|
27
30
|
[GTMEventParamsEnum.GCLID]: string;
|
|
@@ -34,3 +37,15 @@ export type TAccountTrackerGtmSignUpOnlineEventParams = {
|
|
|
34
37
|
[GTMEventParamsEnum.SEND_TO]: string;
|
|
35
38
|
[GTMEventParamsEnum.GCL_ID]: string;
|
|
36
39
|
}
|
|
40
|
+
|
|
41
|
+
export type TAccountTrackerGtmVerifyPhoneOnlineEventParams = {
|
|
42
|
+
[GTMEventParamsEnum.ORIGIN]: string;
|
|
43
|
+
[GTMEventParamsEnum.SEND_TO]: string;
|
|
44
|
+
[GTMEventParamsEnum.GCL_ID]: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type TAccountTrackerGtmVerifyEmailOnlineEventParams = {
|
|
48
|
+
[GTMEventParamsEnum.ORIGIN]: string;
|
|
49
|
+
[GTMEventParamsEnum.SEND_TO]: string;
|
|
50
|
+
[GTMEventParamsEnum.GCL_ID]: string;
|
|
51
|
+
}
|
|
@@ -20,9 +20,22 @@ describe('AccountTracker', () => {
|
|
|
20
20
|
accountTracker.sendRegistrationSuccessEvent(registrationSuccessEventParams);
|
|
21
21
|
|
|
22
22
|
expect(mockGtmDataLayer[0]).toEqual({...registrationSuccessEvents.gtm.sign_up});
|
|
23
|
+
expect(mockGtmDataLayer[1]).toEqual({...registrationSuccessEvents.gtm.sign_up_online});
|
|
23
24
|
|
|
24
25
|
expect(mockLintrk.mock.calls[0][0]).toBe(registrationSuccessEvents.linkedIn.action);
|
|
25
26
|
expect(mockLintrk.mock.calls[0][1]).toEqual(registrationSuccessEvents.linkedIn.event);
|
|
26
27
|
expect(mockLintrk).toHaveBeenCalled();
|
|
27
28
|
});
|
|
29
|
+
|
|
30
|
+
test('sendVerifyPhoneSuccessEvent', () => {
|
|
31
|
+
accountTracker.sendVerifyPhoneSuccessEvent(registrationSuccessEventParams);
|
|
32
|
+
|
|
33
|
+
expect(mockGtmDataLayer[2]).toEqual({...registrationSuccessEvents.gtm.verify_phone_online});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('sendVerifyEmailSuccessEvent', () => {
|
|
37
|
+
accountTracker.sendVerifyEmailSuccessEvent(registrationSuccessEventParams);
|
|
38
|
+
|
|
39
|
+
expect(mockGtmDataLayer[3]).toEqual({...registrationSuccessEvents.gtm.verify_email_online});
|
|
40
|
+
});
|
|
28
41
|
});
|
|
@@ -10,7 +10,20 @@ const registrationSuccessEvents = {
|
|
|
10
10
|
},
|
|
11
11
|
sign_up_online: {
|
|
12
12
|
event: 'sign_up_online',
|
|
13
|
-
|
|
13
|
+
origin: communicatorTestData.gtmId,
|
|
14
|
+
send_to: communicatorTestData.ga4Id,
|
|
15
|
+
gcl_id: communicatorTestData.gcId,
|
|
16
|
+
},
|
|
17
|
+
verify_phone_online: {
|
|
18
|
+
event: 'verify_phone_online',
|
|
19
|
+
origin: communicatorTestData.gtmId,
|
|
20
|
+
send_to: communicatorTestData.ga4Id,
|
|
21
|
+
gcl_id: communicatorTestData.gcId,
|
|
22
|
+
},
|
|
23
|
+
verify_email_online: {
|
|
24
|
+
event: 'verify_email_online',
|
|
25
|
+
origin: communicatorTestData.gtmId,
|
|
26
|
+
send_to: communicatorTestData.ga4Id,
|
|
14
27
|
gcl_id: communicatorTestData.gcId,
|
|
15
28
|
}
|
|
16
29
|
},
|
|
@@ -33,6 +46,16 @@ const registrationSuccessEventParams = {
|
|
|
33
46
|
origin: communicatorTestData.gtmId,
|
|
34
47
|
send_to: communicatorTestData.ga4Id,
|
|
35
48
|
gcl_id: communicatorTestData.gcId,
|
|
49
|
+
},
|
|
50
|
+
verify_phone_online: {
|
|
51
|
+
origin: communicatorTestData.gtmId,
|
|
52
|
+
send_to: communicatorTestData.ga4Id,
|
|
53
|
+
gcl_id: communicatorTestData.gcId,
|
|
54
|
+
},
|
|
55
|
+
verify_email_online: {
|
|
56
|
+
origin: communicatorTestData.gtmId,
|
|
57
|
+
send_to: communicatorTestData.ga4Id,
|
|
58
|
+
gcl_id: communicatorTestData.gcId,
|
|
36
59
|
}
|
|
37
60
|
}
|
|
38
61
|
}
|