@rtstic.dev/pulse 0.0.60 → 0.0.61
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/form/index.js +15 -0
- package/dist/form/index.js.map +2 -2
- package/package.json +1 -1
package/dist/form/index.js
CHANGED
|
@@ -10576,6 +10576,7 @@
|
|
|
10576
10576
|
window.posthog?.capture("form_started", {
|
|
10577
10577
|
fields: this.getFormStateJSON()
|
|
10578
10578
|
});
|
|
10579
|
+
this.pushGAEvent("form_started");
|
|
10579
10580
|
}
|
|
10580
10581
|
};
|
|
10581
10582
|
this.form.addEventListener("input", markStarted);
|
|
@@ -10705,6 +10706,7 @@
|
|
|
10705
10706
|
window.posthog?.capture("form_submitted", {
|
|
10706
10707
|
fields: this.getFormStateJSON()
|
|
10707
10708
|
});
|
|
10709
|
+
this.pushGAEvent("form_submitted", this.getFormStateJSON());
|
|
10708
10710
|
} else {
|
|
10709
10711
|
dbgError("submit", "One or both submit buttons not found \u2014 form NOT submitted");
|
|
10710
10712
|
}
|
|
@@ -10896,6 +10898,19 @@
|
|
|
10896
10898
|
}
|
|
10897
10899
|
}, 30 * 60 * 1e3);
|
|
10898
10900
|
}
|
|
10901
|
+
pushGAEvent(eventName, fields) {
|
|
10902
|
+
window.dataLayer = window.dataLayer || [];
|
|
10903
|
+
const payload = { event: eventName };
|
|
10904
|
+
if (fields) {
|
|
10905
|
+
const get = (name) => fields.find((f) => f["field-name"] === name)?.value ?? "";
|
|
10906
|
+
payload.first_name = get("first_name");
|
|
10907
|
+
payload.last_name = get("last_name");
|
|
10908
|
+
payload.email = get("email");
|
|
10909
|
+
payload.website = get("website");
|
|
10910
|
+
payload.flow_type = get("flow_type");
|
|
10911
|
+
}
|
|
10912
|
+
window.dataLayer.push(payload);
|
|
10913
|
+
}
|
|
10899
10914
|
setSubmissionType(type) {
|
|
10900
10915
|
const el = document.getElementById("submission_type");
|
|
10901
10916
|
if (el) {
|