Skip to content

Instantly share code, notes, and snippets.

@koenbok
Created January 11, 2023 11:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save koenbok/648cd847a9287c0e3910c09b538caf55 to your computer and use it in GitHub Desktop.
Save koenbok/648cd847a9287c0e3910c09b538caf55 to your computer and use it in GitHub Desktop.
Track page views in Framer
// https://stackoverflow.com/a/64927639
function addPushStateListener(listener) {
if (!Proxy) return;
window.history.pushState = new Proxy(window.history.pushState, {
apply: (target, thisArg, argArray) => {
target.apply(thisArg, argArray);
listener();
},
});
}
addPushStateListener(() => {
// Add your event recording here...
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment