Skip to content

Commit 61e934b

Browse files
committed
fb comments, mixpanel, hotjar, google tag manager, tawk, crisp, olark integration added
1 parent b86101c commit 61e934b

File tree

4 files changed

+1139
-18
lines changed

4 files changed

+1139
-18
lines changed

gatsby-config.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
// loading env
2+
const activeEnv = process.env.NODE_ENV || 'development'
3+
console.log(`Using environment config: '${activeEnv}'`)
4+
require("dotenv").config({
5+
path: `.env.${activeEnv}`,
6+
})
7+
18
let siteConfig;
29
let wordpressConfig;
310

@@ -60,6 +67,65 @@ if (process.env.GA) {
6067
});
6168
}
6269

70+
if (process.env.GATSBY_MIXPANEL_TOKEN) {
71+
gatsbyPlugins.unshift({
72+
resolve: `gatsby-plugin-mixpanel`,
73+
options: {
74+
apiToken: process.env.GATSBY_MIXPANEL_TOKEN,
75+
enableOnDevMode: true,
76+
pageViews: 'all'
77+
},
78+
});
79+
}
80+
81+
if (process.env.GATSBY_HOTJAR_ID) {
82+
gatsbyPlugins.unshift({
83+
resolve: `gatsby-plugin-hotjar`,
84+
options: {
85+
id: process.env.GATSBY_HOTJAR_ID,
86+
sv: process.env.GATSBY_HOTJAR_SV
87+
}
88+
});
89+
}
90+
91+
if (process.env.GATSBY_GTAG_MANAGER_ID) {
92+
gatsbyPlugins.unshift({
93+
resolve: `gatsby-plugin-google-tagmanager`,
94+
options: {
95+
id: process.env.GATSBY_GTAG_MANAGER_ID,
96+
includeInDevelopment: true
97+
},
98+
});
99+
}
100+
101+
if (process.env.GATSBY_TAWK_ID) {
102+
gatsbyPlugins.unshift({
103+
resolve: `gatsby-plugin-tawk`,
104+
options: {
105+
tawkId: process.env.GATSBY_TAWK_ID,
106+
}
107+
});
108+
}
109+
110+
if (process.env.GATSBY_CRISP_ID) {
111+
gatsbyPlugins.unshift({
112+
resolve: `gatsby-plugin-crisp-chat`,
113+
options: {
114+
websiteId: process.env.GATSBY_CRISP_ID,
115+
enableDuringDevelop: true
116+
}
117+
});
118+
}
119+
120+
if (process.env.GATSBY_OLARK_ID) {
121+
gatsbyPlugins.unshift({
122+
resolve: `gatsby-plugin-olark`,
123+
options: {
124+
olarkSiteID: process.env.GATSBY_OLARK_ID,
125+
}
126+
});
127+
}
128+
63129
module.exports = {
64130
plugins: gatsbyPlugins,
65131
};

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,20 @@
1616
},
1717
"dependencies": {
1818
"@draftbox-co/gatsby-wordpress-theme-libre": "^1.0.26",
19+
"dotenv": "^8.2.0",
1920
"gatsby": "2.20.24",
21+
"gatsby-plugin-crisp-chat": "^3.2.2",
2022
"gatsby-plugin-disqus": "^1.1.4",
2123
"gatsby-plugin-google-analytics": "^2.2.2",
24+
"gatsby-plugin-google-tagmanager": "^2.3.5",
25+
"gatsby-plugin-hotjar": "^1.0.1",
2226
"gatsby-plugin-mailchimp": "^5.1.2",
27+
"gatsby-plugin-mixpanel": "^3.1.6",
28+
"gatsby-plugin-olark": "^1.0.0",
2329
"gatsby-plugin-segment-js": "^3.1.0",
30+
"gatsby-plugin-tawk": "^1.0.0",
2431
"react": "^16.13.0",
25-
"react-dom": "^16.13.0"
32+
"react-dom": "^16.13.0",
33+
"react-facebook": "^8.1.4"
2634
}
2735
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from "react";
2+
import { FacebookProvider, Comments } from 'react-facebook';
3+
4+
const FbComments = props => {
5+
console.log({ props });
6+
return process.env.FB_APP_ID ? (
7+
<FacebookProvider appId={process.env.FB_APP_ID}>
8+
<Comments width={"100%"} href={props.href}/>
9+
</FacebookProvider>
10+
) : (
11+
<></>
12+
);
13+
return ;
14+
};
15+
16+
export default FbComments;

0 commit comments

Comments
 (0)