Я потратил свое время почти на 4-5 часов, чтобы выяснить это, но я не смог ничего с этим поделать ... но, к счастью, мое приложение Gatsby успешно признало Google Analytics.Тем не менее проблема возникает «Не обнаружен HTTP-ответ» из Google Tag Assistant
Chrome Extension.Я много раз вставлял фрагменты Google Analytics в HTML.js
, Index.html
и обновлял последнюю версию GatsbyJs.
Кроме того, я также попытался отключить расширение Adblock
!но все не удалось ...
URL Произошла ошибка в блоге
gatsby-config.js
module.exports = {
// Note: it must *not* have a trailing slash.
siteMetadata: {
title: 'SJ personal Blog',
siteUrl: `https://ollagada.github.io`
},
plugins: [
{
resolve: `gatsby-plugin-google-analytics`,
options: {
trackingId: "MY TRACKING ID",
// Puts tracking script in the head instead of the body
head: true,
// 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/"],
// Enables Google Optimize using your container Id
optimizeId: "YOUR_GOOGLE_OPTIMIZE_TRACKING_ID",
// Any additional create only fields (optional)
sampleRate: 5,
siteSpeedSampleRate: 10,
},
},
{
resolve: `gatsby-plugin-gtag`,
options: {
// your google analytics tracking id
trackingId: `MY TRACKING ID`,
// Puts tracking script in the head instead of the body
head: true,
// enable ip anonymization
anonymize: true,
},
},
'gatsby-transformer-remark', {
resolve: `gatsby-source-filesystem`,
options: {
name: `posts`,
path: `${__dirname}/src/pages/posts`
}
},
'gatsby-plugin-react-helmet', {
resolve: `gatsby-plugin-manifest`,
options: {
name: 'gatsby-starter-default',
short_name: 'starter',
start_url: '/',
background_color: '#663399',
theme_color: '#663399',
display: 'minimal-ui',
icon: 'src/img/moi.jpg', // This path is relative to the root of the site.
}
},
]
Package.json
<code>
{
"name": "gatsby-starter-default",
"description": "Gatsby default starter",
"version": "1.0.0",
"author": "Kyle Mathews ",
"dependencies": {
"aos": "^2.3.4",
"child_process": "^1.0.2",
"fs": "0.0.1-security",
"gatsby": "^2.0.75",
"gatsby-plugin-google-analytics": "^2.0.8",
"gatsby-plugin-gtag": "^1.0.4",
"gatsby-plugin-manifest": "^2.0.2",
"gatsby-plugin-offline": "^2.0.5",
"gatsby-plugin-react-helmet": "^3.0.0",
"gatsby-plugin-sharp": "^2.0.5",
"gatsby-source-filesystem": "^2.0.1",
"gatsby-transformer-remark": "^2.1.17",
"gatsby-transformer-sharp": "^2.1.1",
"instafeed.js": "^1.4.1",
"net": "^1.0.2",
"prop-types": "^15.6.2",
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-helmet": "^5.2.0",
"react-instafeed": "^0.4.0",
"react-lines-ellipsis": "^0.13.2",
"react-mdl": "^1.11.0",
"react-spinkit": "^3.0.0",
"tls": "0.0.1",
"typed.js": "^2.0.9",
"window": "^4.2.5"
},
"keywords": [
"gatsby"
],
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write '**/*.js'",
"test": "echo \"Error: no test specified\" && exit 1",
"deploy": "gatsby build --prefix-paths && gh-pages -b master -d public"
},
"devDependencies": {
"gh-pages": "^2.0.0",
"prettier": "^1.14.2"
},
"repository": {
"type": "git",
"url": "<a href="https://github.com/gatsbyjs/gatsby-starter-default" rel="nofollow noreferrer">https://github.com/gatsbyjs/gatsby-starter-default</a>"
}
}</p>
<p>
Спасибо!Прекрасный день!