簡體   English   中英

Netlify 不會部署,我正在嘗試將谷歌標簽管理器添加到 gatsby 網站但遇到困難

[英]Netlify won't deploy, I am trying to add google tag manager to a gatsby site but having difficulty

因此,我正在嘗試將google 營銷平台插件添加到 gatsby 站點,並按照說明將其應用到 gatsbyconfig.js 中,但是當我嘗試部署它時出現錯誤。 插件代碼本身似乎很好,因為沒有錯誤,但是一旦我嘗試部署它就會顯示“TypeError:{(中間值)(中間值)}不是函數”這是部署錯誤的圖像: https://imgur。 com/5RapNj4

抱歉,如果這是奇怪的格式,我真的很陌生。

 plugins: [
    // Google marketing platform plugin
  {
    resolve: 'gatsby-plugin-google-marketing-platform',
    options: {
      dataLayer: {
        // Preset dataLayer values
        gaPropertyId: '[UA-148228240-1]',
      },
      tagmanager: {
        id: '[GTM-M73LFW6]',
        params: {
          // GTM URL Parameters
          // Ex: https://www.googletagmanager.com/gtm.js?id=[ID]&gtm_cookies_win=x
          gtm_cookies_win: 'x'
        }
      },
      analytics: {
        id: '[UA-148228240-1]',
      },
      optimize: {
        id: '[GTM-57N8BWZ]',
      },
      includeInDevelopment: true,
    },
  },
    /*
     * Sharp Image Processing
     */
    `gatsby-plugin-sharp`,
    `gatsby-transformer-sharp`,

    /*
     *  Transform Markdown Files
     */
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        // CommonMark mode (default: true)
        commonmark: true,
        // Footnotes mode (default: true)
        footnotes: true,
        // Pedantic mode (default: true)
        pedantic: true,
        // GitHub Flavored Markdown mode (default: true)
        gfm: true,
        // Plugins configs
        plugins:     
          `gatsby-remark-relative-images`,

            resolve: `gatsby-remark-images`,
            options: {
              maxWidth: 1080,
              // linkImagesToOriginal: false,
              linkImagesToOriginal: true,
              tableOfContents: {
                heading: null,
                maxDepth: 2
              }
            }
          },

            resolve: 'gatsby-remark-copy-linked-files',
            options: {
              destinationDir: 'static'
            }
          }
        ],
        excerpt_separator: `<!-- end of excerpt -->`
      }
    ,

    /*
     *  Access to Filesystem
     */
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `src`,
        path: `${__dirname}/src`
      }
    },

    /*
     * Inline SVG Support
     */
    {
      resolve: `gatsby-plugin-react-svg`,
      options: {
        rule: {
          include: /\.inline\.svg$/
        }
      }
    },

    /*
     * SEO Metadata
     */
    `gatsby-plugin-react-helmet`,

    /*
     *  SASS
     */
    `gatsby-plugin-sass`,

    /*
     *  Styled Components
     */
    `gatsby-plugin-styled-components`,

    /*
     * Google Analytics
     */
    {
      resolve: `gatsby-plugin-google-analytics`,
      options: {
        trackingId: process.env.UA-148228240-1,
        // 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: process.env.GATSBY_GOOGLE_OPTIMIZE_ID,
        // Any additional create only fields (optional)
        sampleRate: 5,
        siteSpeedSampleRate: 10,
        cookieDomain: 'getroute.com',
        // Setting this field to true will enables the parsing
        // of cross-domain linker parmeters used to transfer state across domains. (optional)
        allowLinker: true
      }
    },

為什么不將 go 放入 Netlify 站點設置並將其添加到那里?

Go 在后處理下進行片段注入。

Site Settings > Build & Deploy > Post Processing

在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM