UNPKG

gatsby-plugin-plausible

Version:

A Gatsby plugin for adding Plausible analytics to your Gatsby site

13 lines (11 loc) 445 B
"use strict"; exports.onRouteUpdate = function (_ref) { var location = _ref.location; if (process.env.NODE_ENV === "production" && typeof window.plausible === "object") { var pathIsExcluded = location && typeof window.plausibleExcludePaths !== "undefined" && window.plausibleExcludePaths.some(function (rx) { return rx.test(location.pathname); }); if (pathIsExcluded) return null; window.plausible('pageview'); } };