Skip to content

Commit

Permalink
Check if route change is shallow before firing
Browse files Browse the repository at this point in the history
  • Loading branch information
JackEllis authored May 10, 2022
1 parent 6f7deff commit 030ade9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,10 @@ import Router from 'next/router';
import * as Fathom from 'fathom-client';

// Record a pageview when route changes
Router.events.on('routeChangeComplete', () => {
Fathom.trackPageview();
Router.events.on('routeChangeComplete', (as, routeProps) => {
if (!routeProps.shallow) {
Fathom.trackPageview();
}
});

function App({ Component, pageProps }) {
Expand Down

0 comments on commit 030ade9

Please sign in to comment.