Skip to content

Commit

Permalink
Merge pull request #1639 from tradingview/cll-257_documentation_analy…
Browse files Browse the repository at this point in the history
…tics

CLL-257: documentation analytics
  • Loading branch information
SlicedSilver committed Jul 15, 2024
2 parents 60b9f98 + 9e98900 commit f934911
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ jobs:

build-docusaurus-website:
executor: node-executor
resource_class: medium+
steps:
- checkout-with-deps
- run: npm run build:prod
Expand Down
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 f934911

Please sign in to comment.