File tree Expand file tree Collapse file tree 2 files changed +27
-4
lines changed
Expand file tree Collapse file tree 2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -6,16 +6,16 @@ const today = new Date();
66 <div class =" content" >
77 © { today .getFullYear ()} - UmYeah.dev
88 <span class =" social-links" >
9- <a href =" https://github.com/umyeah" target =" _blank" onclick = " window . umami ? . track ( ' github-click ' ) " >
9+ <a href =" https://github.com/umyeah" target =" _blank" >
1010 <i class =" fa-brands fa-github" ></i >
1111 </a >
12- <a href =" https://www.linkedin.com/in/corey-sherman-aa12a611/" target =" _blank" onclick = " window . umami ? . track ( ' linkedin-click ' ) " >
12+ <a href =" https://www.linkedin.com/in/corey-sherman-aa12a611/" target =" _blank" >
1313 <i class =" fa-brands fa-linkedin" ></i >
1414 </a >
15- <a href =" https://last.fm/user/djumyeah" target =" _blank" onclick = " window . umami ? . track ( ' lastfm-click ' ) " >
15+ <a href =" https://last.fm/user/djumyeah" target =" _blank" >
1616 <i class =" fa-brands fa-lastfm" ></i >
1717 </a >
18- <a href =" https://letterboxd.com/UmYeah/" target =" _blank" onclick = " window . umami ? . track ( ' letterboxd-click ' ) " >
18+ <a href =" https://letterboxd.com/UmYeah/" target =" _blank" >
1919 <i class =" fa-brands fa-letterboxd" ></i >
2020 </a >
2121 </span >
Original file line number Diff line number Diff line change @@ -29,6 +29,29 @@ const { pageTitle= "UmYeah's Dev" } = Astro.props
2929 <slot />
3030 </main >
3131 <Footer />
32+ <script is:inline >
33+ (() => {
34+ const eventName = 'external-link-click';
35+
36+ function getSource(link) {
37+ if (link.closest('footer')) return 'footer';
38+ if (link.closest('nav')) return 'navigation';
39+ if (link.closest('section') || link.closest('article')) return 'blog-content';
40+ return 'page';
41+ }
42+
43+ document.querySelectorAll('a').forEach(a => {
44+ if (a.host !== window.location.host && !a.getAttribute('data-umami-event')) {
45+ const source = getSource(a);
46+ const destination = a.hostname;
47+
48+ a.setAttribute('data-umami-event', eventName);
49+ a.setAttribute('data-umami-event-source', source);
50+ a.setAttribute('data-umami-event-destination', destination);
51+ }
52+ });
53+ })();
54+ </script >
3255 </body >
3356</html >
3457
You can’t perform that action at this time.
0 commit comments