Skip to content

Commit c69ed6f

Browse files
[Analytics] Updated calculator tracking (#22267)
* [Analytics] Updated calculator tracking * Update src/components/TunnelCalculator.astro Co-authored-by: Pedro Sousa <[email protected]> --------- Co-authored-by: Pedro Sousa <[email protected]>
1 parent 14e3d93 commit c69ed6f

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/components/SubtractIPCalculator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function SubtractIPCalculator({
1717

1818
function calculate() {
1919
setResult(excludeCidr(base, exclude));
20-
track("clicked calculator submit");
20+
track("interacted with docs calculator", { value: "split ip calculator" });
2121
}
2222

2323
function disableButton() {

src/components/TunnelCalculator.astro

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ const metrics = Object.entries({
122122
</sup>
123123

124124
<script>
125+
import { track } from "~/util/zaraz";
126+
125127
function getValueOfInputById(id: string) {
126128
const element = document.querySelector<HTMLInputElement>(id);
127129

@@ -200,7 +202,10 @@ const metrics = Object.entries({
200202
}
201203
}
202204

203-
document
204-
.querySelectorAll("input[data-tunnel-calculator]")
205-
.forEach((input) => input.addEventListener("change", calculate));
205+
document.querySelectorAll("input[data-tunnel-calculator]").forEach((input) =>
206+
input.addEventListener("change", () => {
207+
calculate();
208+
track("interacted with docs calculator", { value: "tunnel calculator" });
209+
}),
210+
);
206211
</script>

0 commit comments

Comments
 (0)