Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Test Safary Events #98

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/quickstart-install.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import SdkInstallation from './\_sdk-installation.mdx';
import InstallToCreateTracking from '@site/src/components/QuickStartTracking/InstallToCreateTracking.js'

# Install Nillion

Expand All @@ -11,3 +12,5 @@ Install the Nillion SDK, including the <strong>`nada`</strong> tool you'll use t
## Next steps

✅ You're off to a great start! Now that you have installed the Nillion SDK and Tools, you have everything you need to create a Nada project.

<InstallToCreateTracking />
42 changes: 42 additions & 0 deletions src/components/QuickStartTracking/InstallToCreateTracking.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React, { useEffect } from "react";

const InstallToCreateTracking = () => {
useEffect(() => {
const prevButton = document.querySelector('[aria-label="Previous"]');
const nextButton = document.querySelector('[aria-label="Next"]');

const handlePrevClick = () => {
safary.track({
eventType: "custom",
eventName: "quickstart_install_nillion",
parameters: {
fromPage: "Install Nillion",
toPage: "Blind App Quickstart",
},
});
};

const handleNextClick = () => {
safary.track({
eventType: "custom",
eventName: "quickstart_install_nillion",
parameters: {
fromPage: "Install Nillion",
toPage: "Create a Nada project",
},
});
};

if (prevButton) prevButton.addEventListener("click", handlePrevClick);
if (nextButton) nextButton.addEventListener("click", handleNextClick);

return () => {
if (prevButton) prevButton.removeEventListener("click", handlePrevClick);
if (nextButton) nextButton.removeEventListener("click", handleNextClick);
};
}, []);

return null;
};

export default InstallToCreateTracking;