diff --git a/gatsby-config.js b/gatsby-config.js index eeadb71b..62863335 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -5,6 +5,20 @@ module.exports = { author: `Bitlogic.io`, }, plugins: [ + { + resolve: `gatsby-plugin-google-gtag`, + options: { + // You can add multiple tracking ids and a pageview event will be fired for all of them. + trackingIds: [ + "G-BKGQR6SJWV", // Google Analytics / G + ], + // This object is used for configuration specific to this plugin + pluginConfig: { + // Puts tracking script in the head instead of the body + head: true, + }, + }, + }, "gatsby-plugin-react-helmet", { @@ -37,6 +51,7 @@ module.exports = { `blog-page`, `bitway-page`, `contact-page`, + `global-config`, ], }, }, @@ -52,7 +67,7 @@ module.exports = { breakpoints: [750, 1080, 1366, 1920], backgroundColor: `transparent`, }, - }, + }, }, { resolve: `gatsby-plugin-manifest`, diff --git a/package.json b/package.json index 2704334f..8aa0455e 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "gatsby-image": "^3.11.0", "gatsby-plugin-gatsby-cloud": "^3.0.0", "gatsby-plugin-google-analytics": "^3.12.0", + "gatsby-plugin-google-gtag": "^3.13.0", "gatsby-plugin-google-marketing-platform": "^0.2.0", "gatsby-plugin-hubspot": "^1.3.5", "gatsby-plugin-image": "^1.12.0", @@ -34,6 +35,7 @@ "react-hubspot-form": "^1.3.7", "react-icons": "^4.2.0", "react-markdown": "^6.0.2", + "react-script-tag": "^1.1.2", "react-showdown": "^2.3.1", "sass": "^1.35.1" }, diff --git a/src/components/BitwayPage/Gallery/Gallery.js b/src/components/BitwayPage/Gallery/Gallery.js index 6336ac94..b1e8d1b2 100644 --- a/src/components/BitwayPage/Gallery/Gallery.js +++ b/src/components/BitwayPage/Gallery/Gallery.js @@ -1,6 +1,6 @@ import React from "react" import "./Gallery.scss" -import { getImage, GatsbyImage } from "gatsby-plugin-image" +import { getImage } from "gatsby-plugin-image" import { BgImage } from "gbimage-bridge" const layouts = { diff --git a/src/components/ContactPage/ContactContainer.js b/src/components/ContactPage/ContactContainer.js index b6031bce..66533a08 100644 --- a/src/components/ContactPage/ContactContainer.js +++ b/src/components/ContactPage/ContactContainer.js @@ -13,8 +13,8 @@ const Contact = () => { const { image, nameImage, title } = contactData?.allStrapiContactPage?.nodes[0] - const { formId, portalId } = contactData?.allStrapiContactPage?.nodes[0]?.contactForm - const { pageTitle, pageDescription, pageKeywords } = contactData?.allStrapiContactPage?.nodes[0]?.pageMetadata + const { formId, portalId } = contactData?.allStrapiContactPage?.nodes[0]?.contactForm || {} + const { pageTitle, pageDescription, pageKeywords } = contactData?.allStrapiContactPage?.nodes[0]?.pageMetadata || {} const contactImage = getImage(image?.localFile) diff --git a/src/components/HomePage/HomeContainer/HomeContainer.js b/src/components/HomePage/HomeContainer/HomeContainer.js index ce5cc943..9c185e8d 100644 --- a/src/components/HomePage/HomeContainer/HomeContainer.js +++ b/src/components/HomePage/HomeContainer/HomeContainer.js @@ -10,7 +10,7 @@ const Home = () => { const data = useHomePage() const homeSections = data?.allStrapiHome?.nodes[0]?.sections - const { pageTitle, pageDescription, pageKeywords } = data?.allStrapiHome?.nodes[0].pageMetadata + const { pageTitle, pageDescription, pageKeywords } = data?.allStrapiHome?.nodes[0].pageMetadata || {} return ( diff --git a/src/components/Seo/Seo.js b/src/components/Seo/Seo.js index c9db0bc2..1c758f6c 100644 --- a/src/components/Seo/Seo.js +++ b/src/components/Seo/Seo.js @@ -10,7 +10,6 @@ function Seo({ description, lang, meta, title, keywords }) { author, robots, siteMetadata: { siteDesc, siteKeywords, siteTitle }, - siteURL, } = data.allStrapiGlobalSeo.nodes[0] const metaDescription = description ? description : siteDesc diff --git a/src/components/layout.js b/src/components/layout.js index 9dd222a0..5f08a703 100644 --- a/src/components/layout.js +++ b/src/components/layout.js @@ -2,14 +2,31 @@ import * as React from "react" import Header from "./header" import "./layout.scss" import Footer from "./Footer/Footer" +import ScriptTag from "react-script-tag" +import useGlobalConfig from "../hooks/useGlobalConfig" const Layout = ({ children }) => { + const config = useGlobalConfig() + const scripts = config?.allStrapiGlobalConfig?.nodes.map(item => + item?.script?.map(script => + script.enable === true ? ( + + ) : null + ) + ) return ( <> + {scripts}
{children}
-