-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
41 lines (36 loc) · 1.32 KB
/
Copy pathscript.js
File metadata and controls
41 lines (36 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
document.addEventListener("DOMContentLoaded", () => {
const socialLinks = document.querySelectorAll(".social-link");
const revealItems = document.querySelectorAll("[data-reveal]");
if (typeof gtag !== "undefined") {
gtag("event", "page_view_enhanced", {
event_category: "engagement",
page_title: document.title,
page_location: window.location.href,
referrer: document.referrer || "direct",
viewport_size: `${window.innerWidth}x${window.innerHeight}`
});
}
socialLinks.forEach((link) => {
link.addEventListener("click", () => {
if (typeof gtag !== "undefined") {
gtag("event", "link_click", {
event_category: "outbound",
event_label: link.textContent.trim(),
link_url: link.href
});
}
});
});
const reveal = () => {
revealItems.forEach((item, index) => {
window.setTimeout(() => {
item.classList.add("is-visible");
}, index * 120);
});
};
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
revealItems.forEach((item) => item.classList.add("is-visible"));
return;
}
window.setTimeout(reveal, 120);
});