Skip to content

Commit 7095058

Browse files
authored
[Feature] Google Analytics
Merge pull request #29 from adrcav/main
2 parents 9616b8b + 45f7a62 commit 7095058

5 files changed

Lines changed: 34 additions & 0 deletions

File tree

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GATSBY_GA_ID=

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ typings/
5353

5454
# dotenv environment variable files
5555
.env*
56+
!.env.example
5657

5758
# gatsby files
5859
.cache/

gatsby-config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
require("dotenv").config({
2+
path: `.env.${process.env.NODE_ENV}`,
3+
});
4+
5+
const { GATSBY_GA_ID } = process.env;
6+
17
module.exports = {
28
siteMetadata: {
39
title: `UFRPE Devs`,
@@ -35,5 +41,11 @@ module.exports = {
3541
icon: `src/images/icon.png`,
3642
},
3743
},
44+
{
45+
resolve: `gatsby-plugin-google-gtag`,
46+
options: {
47+
trackingIds: [GATSBY_GA_ID],
48+
},
49+
},
3850
],
3951
};

package-lock.json

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"@emotion/styled": "^11.3.0",
1313
"framer-motion": "^4.1.17",
1414
"gatsby": "^3.13.1",
15+
"gatsby-plugin-google-gtag": "^3.14.0",
1516
"gatsby-plugin-image": "^1.13.0",
1617
"gatsby-plugin-manifest": "^3.13.0",
1718
"gatsby-plugin-offline": "^4.13.0",

0 commit comments

Comments
 (0)