Skip to content

Commit

Permalink
Merge pull request #34 from JackEllis/patch-3
Browse files Browse the repository at this point in the history
Check if route change is shallow before firing
  • Loading branch information
derrickreimer authored May 10, 2022
2 parents 6f7deff + 030ade9 commit 176c8f7
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 176c8f7

Please sign in to comment.