diff --git a/.env.local b/.env.local index 4d33e329..67f37565 100644 --- a/.env.local +++ b/.env.local @@ -46,7 +46,8 @@ RELAYPATH = "dev-pedw-hc" //RELAYPATH = "prod-pedw-hc" -GOOGLE_TAG_MANAGER = GTM-T78CBC3 +//GOOGLE_TAG_MANAGER = GTM-T78CBC3 +GOOGLE_TAG_MANAGER = G-GTWW3JT03Z SHOWLOGIN = true SHOWREPRESENTATIONS = true SHOWFILEUPLOAD = "false" diff --git a/components/case/documents.js b/components/case/documents.js index 506e987b..8f11dc85 100644 --- a/components/case/documents.js +++ b/components/case/documents.js @@ -7,6 +7,7 @@ import { connect } from "react-redux"; import transLookup from "../../data/lookuptranslations.json"; import { formatDates } from "../utils"; import PaginationControl from "./pagination"; +import { sendGAEvent } from "@next/third-parties/google"; import { getSearchDocumentDetails, @@ -66,9 +67,6 @@ const DocumentDetails = (props) => { console.log(currentDate); var valid = startDate < currentDate && endDate > currentDate; - - console.log(valid); - ShowDocLinks = valid; }; @@ -307,7 +305,17 @@ const DocumentDetails = (props) => { } key={key} onClick={() => { - toggleDownLoadLink(key); + toggleDownLoadLink(key), + sendGAEvent( + "event", + "DownloadedFile", + { + caseReference: + props.caseReference, + filename: + detailsObj.pinswg_name, + } + ); }} > diff --git a/components/homepage/casesearch.js b/components/homepage/casesearch.js index 4b54d385..fe5b1cb6 100644 --- a/components/homepage/casesearch.js +++ b/components/homepage/casesearch.js @@ -3,6 +3,7 @@ import Link from "next/link"; import { useRouter } from "next/router"; import { connect } from "react-redux"; import { Field, reduxForm } from "redux-form"; +import { sendGAEvent } from "@next/third-parties/google"; const required = (errorMsg) => (value) => value || typeof value === "number" ? undefined : errorMsg; @@ -126,7 +127,19 @@ let CaseSearch = (props) => { />
-
diff --git a/components/myportal/searchcases.js b/components/myportal/searchcases.js index 7703da85..e30c7908 100644 --- a/components/myportal/searchcases.js +++ b/components/myportal/searchcases.js @@ -3,6 +3,7 @@ import Link from "next/link"; import { useRouter } from "next/router"; import { connect } from "react-redux"; import { Field, reduxForm } from "redux-form"; +import { sendGAEvent } from "@next/third-parties/google"; const required = (errorMsg) => (value) => value || typeof value === "number" ? undefined : errorMsg; @@ -132,7 +133,19 @@ let CaseSearch = (props) => { />
-
diff --git a/components/search/searchresults.js b/components/search/searchresults.js index 0166a03d..c907b604 100644 --- a/components/search/searchresults.js +++ b/components/search/searchresults.js @@ -34,6 +34,8 @@ import { getWatchedCasesProxy, } from "../../actions"; +import { sendGAEvent } from "@next/third-parties/google"; + const SearchResults = (props) => { const { searchString, @@ -261,28 +263,36 @@ const SearchResults = (props) => { } className="govuk-link--no-underline" onClick={() => { - setCurrentReference({ - "ticketnumber": - item.ticketnumber, - "currentReference": - item.title, - "currentType": - "searchResultsObj", - "incidentid": - item.incidentid, - "appealType": - item.pinswg_appealcasetype, - "showLoginCheck": - props.showLoginCheck, - "specialistProcess": - detailsObj.pinswg_speacialistcaseprocess != - null || - detailsObj.pinswg_specialistcaseprocess != - null - ? detailsObj.pinswg_speacialistcaseprocess || - detailsObj.pinswg_specialistcaseprocess - : "", - }); + sendGAEvent( + "event", + "CaseViewed", + { + caseReference: + item.ticketnumber, + } + ), + setCurrentReference({ + "ticketnumber": + item.ticketnumber, + "currentReference": + item.title, + "currentType": + "searchResultsObj", + "incidentid": + item.incidentid, + "appealType": + item.pinswg_appealcasetype, + "showLoginCheck": + props.showLoginCheck, + "specialistProcess": + detailsObj.pinswg_speacialistcaseprocess != + null || + detailsObj.pinswg_specialistcaseprocess != + null + ? detailsObj.pinswg_speacialistcaseprocess || + detailsObj.pinswg_specialistcaseprocess + : "", + }); }} > diff --git a/components/tracking/index.js b/components/tracking/index.js index 76e5d5b1..392ef305 100644 --- a/components/tracking/index.js +++ b/components/tracking/index.js @@ -1,21 +1,37 @@ import Script from "next/script"; import React, { Fragment } from "react"; +import { GoogleTagManager } from "@next/third-parties/google"; export const Tracking = ({ googleTagManagerID, nonce }) => ( - + <> +