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}
-
{/*© {new Date().getFullYear()}, Built with*/}
>
diff --git a/src/hooks/useGlobalConfig.js b/src/hooks/useGlobalConfig.js
new file mode 100644
index 00000000..74930910
--- /dev/null
+++ b/src/hooks/useGlobalConfig.js
@@ -0,0 +1,20 @@
+import { useStaticQuery, graphql } from "gatsby"
+
+const useGlobalConfig = () => {
+ const query = useStaticQuery(graphql`
+ {
+ allStrapiGlobalConfig {
+ nodes {
+ script {
+ enable
+ name
+ src
+ }
+ }
+ }
+ }
+ `)
+ return query
+}
+
+export default useGlobalConfig
diff --git a/src/schema/schema.js b/src/schema/schema.js
index 35c0a1b3..58edfcf4 100644
--- a/src/schema/schema.js
+++ b/src/schema/schema.js
@@ -740,6 +740,55 @@ type LocalFile {
localFile: File @link(from: "localFile___NODE")
}
+type StrapiGlobalConfig implements Node {
+ id: ID!
+ parent: Node
+ children: [Node!]!
+ internal: Internal!
+ published_at(
+ formatString: String
+
+ fromNow: Boolean
+
+ # Returns the difference between this date and the current time. Defaults to "milliseconds" but you can also pass in as the measurement "years", "months", "weeks", "days", "hours", "minutes", and "seconds".
+ difference: String
+
+ # Configures the locale Moment.js will use to format the date.
+ locale: String
+ ): Date
+ created_at(
+ formatString: String
+
+ fromNow: Boolean
+
+ # Returns the difference between this date and the current time. Defaults to "milliseconds" but you can also pass in as the measurement "years", "months", "weeks", "days", "hours", "minutes", and "seconds".
+ difference: String
+
+ # Configures the locale Moment.js will use to format the date.
+ locale: String
+ ): Date
+ updated_at(
+ formatString: String
+
+ fromNow: Boolean
+
+ # Returns the difference between this date and the current time. Defaults to "milliseconds" but you can also pass in as the measurement "years", "months", "weeks", "days", "hours", "minutes", and "seconds".
+ difference: String
+
+ # Configures the locale Moment.js will use to format the date.
+ locale: String
+ ): Date
+ script: [StrapiGlobalConfigScript]
+ strapiId: Int
+}
+
+type StrapiGlobalConfigScript {
+ id: Int
+ name: String
+ enable: Boolean
+ src: String
+}
+
`
diff --git a/yarn.lock b/yarn.lock
index fa6ef0e6..475f6d1f 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -10775,6 +10775,11 @@ react-refresh@^0.9.0:
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.9.0.tgz#71863337adc3e5c2f8a6bfddd12ae3bfe32aafbf"
integrity sha512-Gvzk7OZpiqKSkxsQvO/mbTN1poglhmAV7gR/DdIrRrSMXraRQQlfikRJOr3Nb9GTMPC5kof948Zy6jJZIFtDvQ==
+react-script-tag@^1.1.2:
+ version "1.1.2"
+ resolved "https://registry.yarnpkg.com/react-script-tag/-/react-script-tag-1.1.2.tgz#be0fa3a22dfae8165d083f6bc1ff6f9799b20d44"
+ integrity sha512-4oR9ntvGfX4igiP77vK310ru5Oa77xO7CeYB3Xi9lu0qsikpGpK1Kq1WMFocvy8U4fQFq8ovtrZS/8adfCziFw==
+
react-showdown@^2.3.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/react-showdown/-/react-showdown-2.3.1.tgz#c1d4644e3c351ae131da49d8ba081db812c7ca80"