Skip to content

Add galaxy events to cloud advert and translation issue banner #3904

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

Merged
merged 5 commits into from
Jun 6, 2025
Merged
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: 2 additions & 1 deletion docs/getting-started/install/install.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import RPMProd from './_snippets/_rpm_install.md'
import MacOSProd from './_snippets/_macos.md'
import Docker from './_snippets/_docker.md'
import {CardPrimary} from '@clickhouse/click-ui/bundled';
import {galaxyOnClick} from '@site/src/lib/galaxy/galaxy'

# Installation instructions

Expand All @@ -26,7 +27,7 @@ import {CardPrimary} from '@clickhouse/click-ui/bundled';
infoText="Get started free"
infoUrl="https://auth.clickhouse.cloud/"
isSelected
onButtonClick={function Da(){}}
onButtonClick={galaxyOnClick('docs.installCloudCallout.buttonClicked')}
size="md"
title="ClickHouse Cloud"
topBadgeText="Recommended"
Expand Down
1 change: 1 addition & 0 deletions src/lib/galaxy/galaxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const galaxyOnPage = (prefix, depsArray = []) => {
galaxyOnFocus(`${prefix}.window.focus`, depsArray);
};

// Pass String with convention 'namespace.component.eventName'
export const galaxyOnClick = (event) => {
return () => {
window.galaxy.track(event, { interaction: "click" });
Expand Down
2 changes: 2 additions & 0 deletions src/theme/DocItem/Layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import IconClose from "@theme/Icon/Close";
import {useLocation} from "@docusaurus/router";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import RelatedBlogs from "../../../components/RelatedBlogs/RelatedBlogs";
import {galaxyOnClick} from "../../../lib/galaxy/galaxy";
/**
* Decide if the toc should be rendered, on mobile or desktop viewports
*/
Expand Down Expand Up @@ -90,6 +91,7 @@ export default function DocItemLayout({children}) {
className={styles.docCloudClose}
onClick={() => {
setShowPopup(false)
galaxyOnClick('docs.translationIssueBanner.buttonClick')
window.localStorage.setItem('doc-translate-card-banner', 'closed')
}}>
<IconClose color="var(--ifm-color-emphasis-600)" width={10} height={10}/>
Expand Down
2 changes: 2 additions & 0 deletions src/theme/DocItem/TOC/Desktop/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import clsx from "clsx";
import IconClose from '@theme/Icon/Close';
import styles from './styles.module.scss'
import Feedback from '../../../../components/Feedback';
import {galaxyOnClick} from "../../../../lib/galaxy/galaxy";

const AD_DATA_ENDPOINT = 'https://cms.clickhouse-dev.com:1337/api/docs-ad'

Expand Down Expand Up @@ -96,6 +97,7 @@ export default function DocItemTOCDesktop() {
className={styles.docCloudClose}
onClick={() => {
setClosed(true)
galaxyOnClick('docs.sidebarCloudAdvert.buttonClick')
window.sessionStorage.setItem('doc-cloud-card-banner', 'closed');
}}>
<IconClose color="var(--ifm-color-emphasis-600)" width={10} height={10}/>
Expand Down