Skip to content

Commit

Permalink
Add an open social link event
Browse files Browse the repository at this point in the history
  • Loading branch information
naveen521kk committed Nov 7, 2023
1 parent d9f1fe8 commit a237f69
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import SEO from "../components/seo.jsx";
import {Mail, GitHub, Twitter, Gitlab} from "react-feather";
import Mastodon from "../components/icon/Mastodon";

declare global {
interface Window {
gtag: any;
}
}

const SocialLink = ({
href,
title,
Expand All @@ -21,6 +27,14 @@ const SocialLink = ({
target="_blank"
rel="noopener noreferrer me"
title={title}
onClick={() => {
if (typeof window !== "undefined" && window.gtag) {
window.gtag("event", "open_social_link", {
event_category: "engagement",
event_label: title
});
}
}}
>
{children}
</a>
Expand Down

0 comments on commit a237f69

Please sign in to comment.