remove GA script tag and use Gatsby plugin (#756)

This commit is contained in:
Vim 2021-09-27 13:54:10 -07:00 committed by GitHub
parent 5e03ba4fac
commit ca7d688623
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 66 additions and 5 deletions

View file

@ -9,6 +9,46 @@ module.exports = {
}, },
pathPrefix: `${process.env.PATH_PREFIX}`, pathPrefix: `${process.env.PATH_PREFIX}`,
plugins: [ plugins: [
{
resolve: `gatsby-plugin-google-analytics`,
options: {
// The property ID; the tracking code won't be generated without it
trackingId: 'UA-33523145-1',
// Defines where to place the tracking script - `true` in the head and `false` in the body
head: false,
// Setting this parameter is optional
anonymize: true,
// Setting this parameter is also optional
respectDNT: true,
// Avoids sending pageview hits from custom paths
// exclude: ['/preview/**', '/do-not-track/me/too/'],
// Delays sending pageview hits on route update (in milliseconds)
pageTransitionDelay: 0,
// Enables Google Optimize using your container Id
// optimizeId: 'YOUR_GOOGLE_OPTIMIZE_TRACKING_ID',
// Enables Google Optimize Experiment ID
// experimentId: 'YOUR_GOOGLE_EXPERIMENT_ID',
// Set Variation ID. 0 for original 1,2,3....
// variationId: 'YOUR_GOOGLE_OPTIMIZE_VARIATION_ID',
// Defers execution of google analytics script after page load
defer: false,
// Any additional optional fields
sampleRate: 5,
siteSpeedSampleRate: 10,
cookieDomain: 'screeningtool.geoplatform.gov',
// defaults to false
enableWebVitalsTracking: true,
},
},
{ {
resolve: 'gatsby-plugin-sass', resolve: 'gatsby-plugin-sass',
options: { options: {

View file

@ -10815,6 +10815,26 @@
"micromatch": "^4.0.2" "micromatch": "^4.0.2"
} }
}, },
"gatsby-plugin-google-analytics": {
"version": "3.14.0",
"resolved": "https://registry.npmjs.org/gatsby-plugin-google-analytics/-/gatsby-plugin-google-analytics-3.14.0.tgz",
"integrity": "sha512-yfSBRrGZZWruKDQMAJOHp7S1nUBQewT9MuvqegCqFsHhxUtm6PZ5JFv3k8385DfQ/+ux9MmzpY20vQ0E5/30fA==",
"requires": {
"@babel/runtime": "^7.15.4",
"minimatch": "3.0.4",
"web-vitals": "^1.1.2"
},
"dependencies": {
"@babel/runtime": {
"version": "7.15.4",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.15.4.tgz",
"integrity": "sha512-99catp6bHCaxr4sJ/DbTGgHS4+Rs2RVd2g7iOap6SLGPDknRK9ztKNsE/Fg6QhSeh1FGE5f6gHGQmvvn3I3xhw==",
"requires": {
"regenerator-runtime": "^0.13.4"
}
}
}
},
"gatsby-plugin-intl": { "gatsby-plugin-intl": {
"version": "0.3.3", "version": "0.3.3",
"resolved": "https://registry.npmjs.org/gatsby-plugin-intl/-/gatsby-plugin-intl-0.3.3.tgz", "resolved": "https://registry.npmjs.org/gatsby-plugin-intl/-/gatsby-plugin-intl-0.3.3.tgz",
@ -22743,6 +22763,11 @@
"minimalistic-assert": "^1.0.0" "minimalistic-assert": "^1.0.0"
} }
}, },
"web-vitals": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-1.1.2.tgz",
"integrity": "sha512-PFMKIY+bRSXlMxVAQ+m2aw9c/ioUYfDgrYot0YUa+/xa0sakubWhSDyxAKwzymvXVdF4CZI71g06W+mqhzu6ig=="
},
"webidl-conversions": { "webidl-conversions": {
"version": "6.1.0", "version": "6.1.0",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz",

View file

@ -76,6 +76,7 @@
"@turf/bbox": "^6.5.0", "@turf/bbox": "^6.5.0",
"chroma-js": "^2.1.2", "chroma-js": "^2.1.2",
"d3-ease": "^3.0.1", "d3-ease": "^3.0.1",
"gatsby-plugin-google-analytics": "^3.14.0",
"mapbox-gl": "^1.13.0", "mapbox-gl": "^1.13.0",
"maplibre-gl": ">=1.14.0", "maplibre-gl": ">=1.14.0",
"query-string": "^7.0.0", "query-string": "^7.0.0",

View file

@ -15,11 +15,6 @@ const Layout = ({children, location, title}: ILayoutProps) => {
return ( return (
<> <>
<Helmet title={title} defer={false}> <Helmet title={title} defer={false}>
<script async
type="text/javascript"
id="_fed_an_ua_tag"
src="https://dap.digitalgov.gov/Universal-Federated-Analytics-Min.js?agency=DOI&sitetopic=cejst">
</script>
</Helmet> </Helmet>
<URLFlagProvider location={location}> <URLFlagProvider location={location}>
<J40Header /> <J40Header />