Skip to content

Commit

Permalink
added sidebar logging (#2456)
Browse files Browse the repository at this point in the history
  • Loading branch information
brock-statsig authored Jan 4, 2025
1 parent 856d564 commit 32ecdee
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/theme/Layout/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React, { useEffect, useLayoutEffect } from 'react';
import Layout from '@theme-original/Layout';

export default function CustomLayout(props) {
useEffect(() => {

console.log('Page loaded!');
}, []);
useLayoutEffect(() => {
// Wait a small tick to ensure DOM is fully rendered
setTimeout(() => {
const hasSidebar = document.querySelector('.theme-doc-sidebar-container');
if (!hasSidebar) {
console.log("doesn't have sidebar")
Statsig.instance().logEvent('NoSidebarPageLoad', window.location.href);
}
}, 0);
}, []);
return <Layout {...props} />;
}

0 comments on commit 32ecdee

Please sign in to comment.