Skip to content

Commit bf1a215

Browse files
author
Manoj
authored
Merge pull request #10 from SoftwareAG/feature/analytics
Added facebook pixel analytics
2 parents d0dd512 + 383e80e commit bf1a215

File tree

4 files changed

+75
-9
lines changed

4 files changed

+75
-9
lines changed

gatsby-config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,17 @@ const plugins = [
128128
})
129129
,
130130
},
131+
},
132+
{
133+
resolve: `gatsby-plugin-gdpr-cookies`,
134+
options: {
135+
facebookPixel: {
136+
pixelId: '757069165097356',
137+
cookieName: 'gatsby-gdpr-facebook-pixel',
138+
},
139+
// defines the environments where the tracking should be available - default is ["production"]
140+
environments: ['production', 'development']
141+
},
131142
}
132143
];
133144

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"gatsby-image": "^2.4.7",
2626
"gatsby-link": "^2.2.27",
2727
"gatsby-plugin-emotion": "^4.1.18",
28+
"gatsby-plugin-gdpr-cookies": "^1.0.7",
2829
"gatsby-plugin-local-search": "^1.1.1",
2930
"gatsby-plugin-manifest": "^2.2.33",
3031
"gatsby-plugin-material-ui": "^2.1.9",
@@ -46,6 +47,7 @@
4647
"match-all": "^1.2.5",
4748
"prop-types": "^15.7.2",
4849
"react": "^16.12.0",
50+
"react-cookie-consent": "^5.1.2",
4951
"react-dom": "^16.12.0",
5052
"react-feather": "^2.0.3",
5153
"react-github-btn": "^1.1.1",

src/components/layout.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import React from 'react';
22
import styled from '@emotion/styled';
33
import {MDXProvider} from '@mdx-js/react';
4-
54
import ThemeProvider from './theme/themeProvider';
65
import mdxComponents from './mdxComponents';
76
import Sidebar from './sidebar';
87
import RightSidebar from './rightSidebar';
98
import config from '../../config.js';
9+
import CookieConsent from 'react-cookie-consent';
1010

1111
const Wrapper = styled('div')`
1212
display: flex;
1313
width: 100%;
1414
justify-content: space-between;
15-
background: ${({ theme }) => theme.colors.background};
15+
background: ${({theme}) => theme.colors.background};
1616
1717
.sideBarUL li a {
18-
color: ${({ theme }) => theme.colors.text};
18+
color: ${({theme}) => theme.colors.text};
1919
}
2020
2121
.sideBarUL .item > a:hover {
@@ -37,10 +37,10 @@ const Content = styled('main')`
3737
margin-right: 0px;
3838
padding-top: 2rem;
3939
// width: 860px;
40-
background: ${({ theme }) => theme.colors.background};
40+
background: ${({theme}) => theme.colors.background};
4141
4242
table tr {
43-
background: ${({ theme }) => theme.colors.background};
43+
background: ${({theme}) => theme.colors.background};
4444
}
4545
4646
@media only screen and (max-width: 1023px) {
@@ -71,25 +71,33 @@ const RightSideBarWidth = styled('div')`
7171
flex-shrink: 0;
7272
`;
7373

74-
const Layout = ({ children, location }) => (
74+
const Layout = ({children, location}) => (
7575
<ThemeProvider location={location}>
7676
<MDXProvider components={mdxComponents}>
7777
<Wrapper>
7878
<LeftSideBarWidth className={'hiddenMobile'}>
79-
<Sidebar location={location} />
79+
<Sidebar location={location}/>
8080
</LeftSideBarWidth>
8181
{config.sidebar.title ? (
8282
<div
8383
className={'sidebarTitle sideBarShow'}
84-
dangerouslySetInnerHTML={{ __html: config.sidebar.title }}
84+
dangerouslySetInnerHTML={{__html: config.sidebar.title}}
8585
/>
8686
) : null}
8787
<Content>
8888
<MaxWidth>{children}</MaxWidth>
8989
</Content>
9090
<RightSideBarWidth className={'hiddenMobile'}>
91-
<RightSidebar location={location} />
91+
<RightSidebar location={location}/>
9292
</RightSideBarWidth>
93+
<CookieConsent
94+
enableDeclineButton
95+
location="bottom"
96+
buttonText="I understand and accept the use of cookies"
97+
declineButtonText="I do not accept the use of cookies"
98+
cookieName="gatsby-gdpr-facebook-pixel">
99+
We are always working to improve this website for our users. To do this, we use the anonymous data provided by Cookies.
100+
</CookieConsent>
93101
</Wrapper>
94102
</MDXProvider>
95103
</ThemeProvider>

yarn.lock

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,6 +1731,10 @@
17311731
version "2.1.1"
17321732
resolved "https://registry.yarnpkg.com/@types/configstore/-/configstore-2.1.1.tgz#cd1e8553633ad3185c3f2f239ecff5d2643e92b6"
17331733

1734+
"@types/cookie@^0.3.3":
1735+
version "0.3.3"
1736+
resolved "https://registry.yarnpkg.com/@types/cookie/-/cookie-0.3.3.tgz#85bc74ba782fb7aa3a514d11767832b0e3bc6803"
1737+
17341738
"@types/debug@^0.0.30":
17351739
version "0.0.30"
17361740
resolved "https://registry.yarnpkg.com/@types/debug/-/debug-0.0.30.tgz#dc1e40f7af3b9c815013a7860e6252f6352a84df"
@@ -1825,6 +1829,10 @@
18251829
version "8.10.61"
18261830
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.61.tgz#d299136ce54bcaf1abaa4a487f9e4bedf6b0d393"
18271831

1832+
"@types/object-assign@^4.0.30":
1833+
version "4.0.30"
1834+
resolved "https://registry.yarnpkg.com/@types/object-assign/-/object-assign-4.0.30.tgz#8949371d5a99f4381ee0f1df0a9b7a187e07e652"
1835+
18281836
"@types/parse-json@^4.0.0":
18291837
version "4.0.0"
18301838
resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
@@ -3825,6 +3833,10 @@ cookie@0.4.0:
38253833
version "0.4.0"
38263834
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba"
38273835

3836+
cookie@^0.4.0:
3837+
version "0.4.1"
3838+
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.1.tgz#afd713fe26ebd21ba95ceb61f9a8116e50a537d1"
3839+
38283840
copy-concurrently@^1.0.0:
38293841
version "1.0.5"
38303842
resolved "https://registry.yarnpkg.com/copy-concurrently/-/copy-concurrently-1.0.5.tgz#92297398cae34937fcafd6ec8139c18051f0b5e0"
@@ -6065,6 +6077,16 @@ gatsby-plugin-emotion@^4.1.18:
60656077
"@babel/runtime" "^7.10.2"
60666078
"@emotion/babel-preset-css-prop" "^10.0.27"
60676079

6080+
gatsby-plugin-gdpr-cookies@^1.0.7:
6081+
version "1.0.7"
6082+
resolved "https://registry.yarnpkg.com/gatsby-plugin-gdpr-cookies/-/gatsby-plugin-gdpr-cookies-1.0.7.tgz#9bc5d4ce4143e316a9bb0572a54695336616c78d"
6083+
dependencies:
6084+
"@babel/runtime" "^7.8.4"
6085+
common-tags "^1.8.0"
6086+
minimist "^1.2.5"
6087+
react-ga "^2.7.0"
6088+
universal-cookie "^4.0.3"
6089+
60686090
gatsby-plugin-local-search@^1.1.1:
60696091
version "1.1.1"
60706092
resolved "https://registry.yarnpkg.com/gatsby-plugin-local-search/-/gatsby-plugin-local-search-1.1.1.tgz#3483af8b104e0463887d4d98504ecae90048bbab"
@@ -8305,6 +8327,10 @@ jpeg-js@^0.3.4:
83058327
version "0.3.7"
83068328
resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.3.7.tgz#471a89d06011640592d314158608690172b1028d"
83078329

8330+
js-cookie@^2.2.1:
8331+
version "2.2.1"
8332+
resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.1.tgz#69e106dc5d5806894562902aa5baec3744e9b2b8"
8333+
83088334
js-message@1.0.5:
83098335
version "1.0.5"
83108336
resolved "https://registry.yarnpkg.com/js-message/-/js-message-1.0.5.tgz#2300d24b1af08e89dd095bc1a4c9c9cfcb892d15"
@@ -11032,6 +11058,12 @@ rc@^1.2.7, rc@^1.2.8:
1103211058
minimist "^1.2.0"
1103311059
strip-json-comments "~2.0.1"
1103411060

11061+
react-cookie-consent@^5.1.2:
11062+
version "5.1.2"
11063+
resolved "https://registry.yarnpkg.com/react-cookie-consent/-/react-cookie-consent-5.1.2.tgz#553c4851f8be1e3a91f40f36f350e99b47276731"
11064+
dependencies:
11065+
js-cookie "^2.2.1"
11066+
1103511067
react-dev-utils@^4.2.3:
1103611068
version "4.2.3"
1103711069
resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-4.2.3.tgz#5b42d9ea58d5e9e017a2f57a40a8af408a3a46fb"
@@ -11078,6 +11110,10 @@ react-feather@^2.0.3:
1107811110
dependencies:
1107911111
prop-types "^15.7.2"
1108011112

11113+
react-ga@^2.7.0:
11114+
version "2.7.0"
11115+
resolved "https://registry.yarnpkg.com/react-ga/-/react-ga-2.7.0.tgz#24328f157f31e8cffbf4de74a3396536679d8d7c"
11116+
1108111117
react-github-btn@^1.1.1:
1108211118
version "1.2.0"
1108311119
resolved "https://registry.yarnpkg.com/react-github-btn/-/react-github-btn-1.2.0.tgz#464066f999a77c0eed27980260601b51cbe15614"
@@ -13421,6 +13457,15 @@ unist-util-visit@^1.0.0, unist-util-visit@^1.1.0, unist-util-visit@^1.4.1:
1342113457
dependencies:
1342213458
unist-util-visit-parents "^2.0.0"
1342313459

13460+
universal-cookie@^4.0.3:
13461+
version "4.0.3"
13462+
resolved "https://registry.yarnpkg.com/universal-cookie/-/universal-cookie-4.0.3.tgz#c2fa59127260e6ad21ef3e0cdd66ad453cbc41f6"
13463+
dependencies:
13464+
"@types/cookie" "^0.3.3"
13465+
"@types/object-assign" "^4.0.30"
13466+
cookie "^0.4.0"
13467+
object-assign "^4.1.1"
13468+
1342413469
universalify@^0.1.0:
1342513470
version "0.1.2"
1342613471
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"

0 commit comments

Comments
 (0)