From 5359dc344b02d59e79c84c538716a73063db5ecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9ssica=20Novo?= <50515278+JessicaNovo@users.noreply.github.com> Date: Mon, 18 May 2020 10:00:33 +0100 Subject: [PATCH] #41 tested the google tag manager to id shops clicked --- gatsby-config.js | 20 +++++++++++++++++++- package.json | 1 + src/components/Shops/Card.jsx | 20 +++++++++++++------- yarn.lock | 14 ++++++++++++++ 4 files changed, 47 insertions(+), 8 deletions(-) diff --git a/gatsby-config.js b/gatsby-config.js index 7da1dbd..9d6b7e2 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -180,7 +180,25 @@ module.exports = { { resolve: 'gatsby-plugin-google-analytics', options: { - trackingId: 'UA-162021632-1', + // trackingId: 'UA-162021632-1', + trackingId: 'UA-166369673-1', // I put my account just to test the tagmanager + }, + }, + { + resolve: 'gatsby-plugin-google-tagmanager', + options: { + id: 'GTM-52RL5N9', // I put my account just to test the tagmanager + + // Include GTM in development. + // Defaults to false meaning GTM will only be loaded in production. + includeInDevelopment: true, + + // datalayer to be set before GTM is loaded + // should be an object or a function that is executed in the browser + // Defaults to null + defaultDataLayer: { + platform: 'gatsby', + }, }, }, { diff --git a/package.json b/package.json index 6c4bf65..4c2f3c8 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "gatsby-node-helpers": "^0.3.0", "gatsby-plugin-alias-imports": "^1.0.5", "gatsby-plugin-google-analytics": "^2.2.2", + "gatsby-plugin-google-tagmanager": "^2.3.1", "gatsby-plugin-manifest": "^2.2.48", "gatsby-plugin-material-ui": "^2.1.6", "gatsby-plugin-netlify-cms": "^4.2.4", diff --git a/src/components/Shops/Card.jsx b/src/components/Shops/Card.jsx index f3f4516..fde5e5d 100644 --- a/src/components/Shops/Card.jsx +++ b/src/components/Shops/Card.jsx @@ -69,29 +69,35 @@ const ShopsCard = ({ shop }) => { }) } disableRipple onClick={ handleExpandClick } + id={ `click-tracker__${shop.name}__action-area` } + data-shop={ shop.name } > - - + + { shop.name } - + { shop.location.join(', ') } - + { shop.businessType.join(', ') } - + { shop.product }