gatsby-plugin-statsy
Advanced tools
Comparing version 0.1.0 to 0.1.3
@@ -9,2 +9,5 @@ "use strict"; | ||
).default("statsy.observer"), | ||
autoTrackPageviews: Joi.boolean().description( | ||
`Whether to automatically track page views. Defaults to true.` | ||
).default(true), | ||
exclude: Joi.array().items(Joi.string()).description( | ||
@@ -11,0 +14,0 @@ `If you need to exclude any path from the tracking system, you can add it (one or more) to this optional array as glob expressions.` |
@@ -27,2 +27,3 @@ "use strict"; | ||
var import_react = __toESM(require("react")); | ||
var import_gatsby = require("gatsby"); | ||
var import_minimatch = require("minimatch"); | ||
@@ -78,11 +79,17 @@ var onRenderBody = async ({ setHeadComponents, setPostBodyComponents }, pluginOptions) => { | ||
`; | ||
const code = ` | ||
window.statsy=function(...t){(window.statsyq=window.statsyq||[]).push(t)},window.statsy.call(window,"eventMiddleware",(function(t){const n=new | ||
URL(t.href),e=[${excludeStatsyPaths.join( | ||
"," | ||
)}];if("pageview"===t.name)for(const t of e)if(t.test(n.pathname))return null;const o=["${removeQueryParams.join( | ||
'","' | ||
)}"];for(const t of o)n.searchParams.delete(t);return | ||
t.href=n.toString(),console.log({event:t}),t})); | ||
`; | ||
if (typeof pluginOptions.autoTrackPageviews === `boolean`) { | ||
setPostBodyComponents([ | ||
/* @__PURE__ */ import_react.default.createElement( | ||
"script", | ||
{ | ||
key: "statsy-config", | ||
dangerouslySetInnerHTML: { | ||
__html: `window.statsyConfig = { | ||
autoTrackPageviews: ${pluginOptions.autoTrackPageviews}, | ||
}` | ||
} | ||
} | ||
) | ||
]); | ||
} | ||
setHeadComponents([ | ||
@@ -92,3 +99,3 @@ /* @__PURE__ */ import_react.default.createElement("link", { rel: "preconnect", key: "preconnect-statsy", href: origin }), | ||
/* @__PURE__ */ import_react.default.createElement( | ||
"script", | ||
import_gatsby.Script, | ||
{ | ||
@@ -104,3 +111,3 @@ key: "script-statsy", | ||
/* @__PURE__ */ import_react.default.createElement( | ||
"script", | ||
import_gatsby.Script, | ||
{ | ||
@@ -107,0 +114,0 @@ key: "gatsby-plugin-statsy-middleware", |
{ | ||
"name": "gatsby-plugin-statsy", | ||
"version": "0.1.0", | ||
"version": "0.1.3", | ||
"description": "", | ||
@@ -25,3 +25,3 @@ "main": "./dist/index.js", | ||
"typescript": "^5.0.4", | ||
"@statsy/analytics": "0.1.0" | ||
"@statsy/analytics": "0.1.3" | ||
}, | ||
@@ -28,0 +28,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
258
25358