Skip to content

Commit

Permalink
CLL-257: documentation analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
SlicedSilver committed Jul 11, 2024
1 parent 60b9f98 commit 7494fd8
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
/website/docs/api/**
/website/versioned_docs/**/api/**
/website/build/**
/website/src/theme/**/*.js

/plugin-examples
/packages/create-lwc-plugin
12 changes: 12 additions & 0 deletions website/src/theme/Footer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import Footer from '@theme-original/Footer';
import AnalyticsWrapper from '../analytics-wrapper';

// eslint-disable-next-line import/no-default-export
export default function FooterWrapper(props) {
return (
<AnalyticsWrapper>
<Footer {...props} />
</AnalyticsWrapper>
);
}
1 change: 1 addition & 0 deletions website/src/theme/analytics-tracker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions website/src/theme/analytics-wrapper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React, { useEffect } from 'react';
import { useLocation } from '@docusaurus/router';
import { safeTrackPageView } from './analytics-tracker';

// eslint-disable-next-line react/prop-types
const AnalyticsWrapper = ({ children }) => {
const location = useLocation();

useEffect(() => {
safeTrackPageView();
}, [location]);

return <>{children}</>;
};

// eslint-disable-next-line import/no-default-export
export default AnalyticsWrapper;

0 comments on commit 7494fd8

Please sign in to comment.