Skip to content

Commit

Permalink
MIM-1887 gtag and GA_TRACKING_ID removal (#2769)
Browse files Browse the repository at this point in the history
* highchart.es6 gtag removal

* AttachmentTablesFigures gtag removal

* Highchart.jsx gtag removal

* links.tsx gtag removal

* Table.tsx gtag removal

* nameSearch.jsx gtag removal

* searchResultView.tsx gtag removal

* error.html gtag removal

* ReactGA.tsx removal of file

* react-ga dependency removal

* GA_TRACKING_ID removal from all files

* Bump google-github-actions/auth from 2.1.2 to 2.1.3 (#2757)

Bumps [google-github-actions/auth](https://github.com/google-github-actions/auth) from 2.1.2 to 2.1.3.
- [Release notes](https://github.com/google-github-actions/auth/releases)
- [Changelog](https://github.com/google-github-actions/auth/blob/main/CHANGELOG.md)
- [Commits](google-github-actions/auth@v2.1.2...v2.1.3)

---
updated-dependencies:
- dependency-name: google-github-actions/auth
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update version number to v2.8.2

* [MIM-1950] MIM-1950:Fikset bug med tidssone for kommende publiseringer (#2756)

MIM-1950:Fikset bug med tidssone for kommende publiseringer

* Change env name in github action to make jira integration work properly (#2764)

* [MIM-1915] Added macro config for keyFigure (#2759)

* added macro config for keyFigure

* added styling to fix gap to text

* fixed formatting

* [MIM-1887] Mim 1887 removal of universal analytics (#2763)

* Updated comment for GA4 gtag config

* Fjernet UA script

* Changes to Commits

* Added type for renderShowButton onKeyDown event

* default.html - UA SCRIPT final removal

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: GitHub Actions Bot <>
Co-authored-by: Carina <47381367+ssb-cgn@users.noreply.github.com>
Co-authored-by: Anne-Siri <142512638+annesiri@users.noreply.github.com>
  • Loading branch information
4 people authored Jun 3, 2024
1 parent 021f809 commit 16373f4
Show file tree
Hide file tree
Showing 26 changed files with 23 additions and 242 deletions.
16 changes: 0 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@
"date-fns": "~3.6.0",
"highcharts-react-official": "~3.2.1",
"react-bootstrap": "~2.10.2",
"react-ga": "~3.3.1",
"react-select": "~5.8.0",
"redux": "~5.0.1",
"redux-logger": "~3.0.6",
Expand Down
44 changes: 0 additions & 44 deletions src/main/resources/assets/js/app/highchart.es6
Original file line number Diff line number Diff line change
Expand Up @@ -139,78 +139,40 @@ export function init() {
})
}

const category = 'Highcharts'
const action = 'Lastet ned highcharts'

config.exporting.menuItemDefinitions = {
printChart: {
onclick: function () {
const label = `${config.title.text} - Skriv ut graf`
gtag('event', action, {
event_category: category,
event_label: label,
})

this.print()
},
},
downloadPNG: {
onclick: function () {
const label = `${config.title.text} - Last ned som PNG`
gtag('event', action, {
event_category: category,
event_label: label,
})

this.exportChartLocal() //png is default
},
},
downloadJPEG: {
onclick: function () {
const label = `${config.title.text} - Last ned som JPEG`
gtag('event', action, {
event_category: category,
event_label: label,
})

this.exportChartLocal({
type: 'image/jpeg',
})
},
},
downloadPDF: {
onclick: function () {
const label = `${config.title.text} - Last ned som PDF`
gtag('event', action, {
event_category: category,
event_label: label,
})

this.exportChartLocal({
type: 'application/pdf',
})
},
},
downloadSVG: {
onclick: function () {
const label = `${config.title.text} - Last ned som SVG`
gtag('event', action, {
event_category: category,
event_label: label,
})

this.exportChartLocal({
type: 'image/svg+xml',
})
},
},
downloadXLS: {
onclick: function () {
const label = `${config.title.text} - Last ned som XLS`
gtag('event', action, {
event_category: category,
event_label: label,
})
const rows = this.getDataRows(true)
const xlsxRows = rows.slice(1).map(function (row) {
return row.map(function (column) {
Expand All @@ -230,12 +192,6 @@ export function init() {
},
downloadCSV: {
onclick: function () {
const label = `${config.title.text} - Last ned som CSV`
gtag('event', action, {
event_category: category,
event_label: label,
})

this.downloadCSV()
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export type AttachmentTablesFiguresProps = {
showAll: string
showLess: string
appName: string
GA_TRACKING_ID: string | null
title: string
}

Expand Down
1 change: 0 additions & 1 deletion src/main/resources/lib/types/partTypes/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export interface LinksProps {
linkType?: 'regular' | 'profiled' | 'header'
text?: string
description?: string
GA_TRACKING_ID?: string
isPDFAttachment?: boolean
attachmentTitle?: string
}
1 change: 0 additions & 1 deletion src/main/resources/lib/types/partTypes/nameSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,4 @@ export interface NameSearchProps {
close: string
}
language: string
GA_TRACKING_ID: string | null
}
1 change: 0 additions & 1 deletion src/main/resources/lib/types/partTypes/searchResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export interface SearchResultProps {
contentTypePhrases: Array<ContentTypePhrase>
contentTypes: Array<Facet>
subjects: Array<Facet>
GA_TRACKING_ID: string | null
contentTypeUrlParam: string | undefined
subjectUrlParam: string | undefined
searchResultSRText: string
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/lib/types/partTypes/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export interface TableProps {
sourceTableLabel: string
statBankWebUrl: string
hiddenTitle: string | undefined
GA_TRACKING_ID: string | null
}

export interface TableStandardSymbolLink {
Expand Down
15 changes: 0 additions & 15 deletions src/main/resources/react4xp/ReactGA.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions src/main/resources/react4xp/_entries/AttachmentTablesFigures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
} from '../../lib/types/partTypes/attachmentTablesFigures'

import Table from '../table/Table'
import { addGtagForEvent } from '/react4xp/ReactGA'

function AttachmentTableFigures(props: AttachmentTablesFiguresProps) {
const [isHidden, setIsHidden] = useState(true)
Expand All @@ -29,19 +28,6 @@ function AttachmentTableFigures(props: AttachmentTablesFiguresProps) {
}
}

function toggleAccordion(isOpen: boolean, index: number) {
const { contentType, subHeader, open } = accordions[index]

if (isOpen && contentType === `${props.appName}:table` && props.GA_TRACKING_ID) {
addGtagForEvent(
props.GA_TRACKING_ID,
'Utvidet vedleggstabell',
'Statistikkside vedleggstabeller',
`${subHeader} ${open}`
)
}
}

function getButtonBreakpoint() {
if (accordions.length > 5) {
return ''
Expand Down Expand Up @@ -127,7 +113,6 @@ function AttachmentTableFigures(props: AttachmentTablesFiguresProps) {
header={accordion.open}
subHeader={accordion.subHeader}
openByDefault={anchor && accordion.id && accordion.id === anchor}
onToggle={(isOpen: boolean) => toggleAccordion(isOpen, index)}
>
{renderAccordionBody(accordion)}
</Accordion>
Expand Down
14 changes: 0 additions & 14 deletions src/main/resources/react4xp/table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { default as isEmpty } from 'ramda/es/isEmpty'
import { NumericFormat } from 'react-number-format'
import { Alert } from 'react-bootstrap'
import { ChevronLeft, ChevronRight } from 'react-feather'
import { addGtagForEvent } from '/react4xp/ReactGA'
import { type TableProps } from '../../lib/types/partTypes/table'
import { PreliminaryData, type TableCellUniform } from '../../lib/types/xmlParser'

Expand Down Expand Up @@ -156,10 +155,6 @@ function Table(props: TableProps) {
}

function downloadTableAsCSV() {
if (props.GA_TRACKING_ID) {
addGtagForEvent(props.GA_TRACKING_ID, 'Lastet ned csv tabell', 'Statistikkside tabeller', 'Last ned csv tabell')
}

if (window && window.downloadTableFile) {
window.downloadTableFile(tableRef.current, {
type: 'csv',
Expand All @@ -172,15 +167,6 @@ function Table(props: TableProps) {
}

function downloadTableAsExcel() {
if (props.GA_TRACKING_ID) {
addGtagForEvent(
props.GA_TRACKING_ID,
'Lastet ned excell tabell',
'Statistikkside tabeller',
'Last ned excell tabell'
)
}

if (window && window.downloadTableFile) {
window.downloadTableFile(tableRef.current, {
type: 'xlsx',
Expand Down
39 changes: 18 additions & 21 deletions src/main/resources/site/error/error.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
<!DOCTYPE html>
<html data-th-lang="${language.code}">
<head>
<script async="true" data-th-if="${GA_TRACKING_ID}" data-th-src="|https://www.googletagmanager.com/gtag/js?id=${GA_TRACKING_ID}|"></script>
<script th:inline="javascript" data-th-if="${GA_TRACKING_ID}">
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', /*[[${GA_TRACKING_ID}]]*/);
</script>

<meta http-equiv="Content-Type" content="text/html;" charset="UTF-8"/>
<title data-th-text="${pageTitle}">Side ikke funnet / Page not found</title>
<meta name="viewport" content="width=device-width"/>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans%7COpen+Sans:700%7CRoboto:700%7CRoboto+Condensed:700"/>
<link rel="stylesheet" data-th-href="${stylesUrl}"/>
<link rel="alternate" data-th-if="${alternateLanguageVersionUrl}" data-th-href="${alternateLanguageVersionUrl}" data-th-hreflang="${language.alternate}"/>
</head>
<body class="xp-page" data-th-classappend="${bodyClasses}">
<div class="container">
<div data-th-utext="${contentHtml}" data-th-remove="tag"></div>
</div>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html;" charset="UTF-8" />
<title data-th-text="${pageTitle}">Side ikke funnet / Page not found</title>
<meta name="viewport" content="width=device-width" />
<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Open+Sans%7COpen+Sans:700%7CRoboto:700%7CRoboto+Condensed:700" />
<link rel="stylesheet" data-th-href="${stylesUrl}" />
<link rel="alternate" data-th-if="${alternateLanguageVersionUrl}" data-th-href="${alternateLanguageVersionUrl}"
data-th-hreflang="${language.alternate}" />
</head>

<body class="xp-page" data-th-classappend="${bodyClasses}">
<div class="container">
<div data-th-utext="${contentHtml}" data-th-remove="tag"></div>
</div>
</body>

</html>
1 change: 0 additions & 1 deletion src/main/resources/site/error/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ function getMainErrorBody(status: number, contentHtml: string, language: Languag
language,
pageTitle: status === 404 ? 'Side ikke funnet / Page not found' : 'Siden feilet / Page error',
bodyClasses: '',
GA_TRACKING_ID: app.config && app.config.GA_TRACKING_ID ? app.config.GA_TRACKING_ID : null,
contentHtml,
}
const mainErrorBody = render(mainErrorView, mainErrorModel)
Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/site/macros/links/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { prepareText } from '/site/parts/links/links'
import { type TableLink } from '/site/mixins/tableLink'
import { type HeaderLink } from '/site/mixins/headerLink'
import { type ProfiledLink } from '/site/mixins/profiledLink'
import { GA_TRACKING_ID } from '/site/pages/default/default'
import { type Links as LinksConfig } from '.'

export function macro(context: XP.MacroContext<LinksConfig>) {
Expand Down Expand Up @@ -62,7 +61,6 @@ export function macro(context: XP.MacroContext<LinksConfig>) {
children: content ? prepareText(content, linkText) : linkText,
href: contentUrl,
linkType: 'header',
GA_TRACKING_ID: GA_TRACKING_ID,
isPDFAttachment,
attachmentTitle,
}
Expand Down
12 changes: 0 additions & 12 deletions src/main/resources/site/pages/default/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,6 @@
</script>
<!-- End Google Tag Manager -->

<!-- UA GA tracking script with added GA4 gtag config -->
<script defer data-th-if="${GA_TRACKING_ID}"
data-th-src="|https://www.googletagmanager.com/gtag/js?id=${GA_TRACKING_ID}|"></script>

<script th:inline="javascript" data-th-if="${GA_TRACKING_ID}">
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', [[${ GA_TRACKING_ID }]], { 'anonymize_ip': true });
</script>

<script data-th-src="${jsLibsUrl}" defer="defer"></script>

<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta data-th-if="${page.data.metaDescription}" name="description" data-th-content="${page.data.metaDescription}" />
Expand Down
3 changes: 0 additions & 3 deletions src/main/resources/site/pages/default/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ const previewOverride: object = {
contentList: 'relatedFactPage',
}

export const GA_TRACKING_ID: string | null = app.config?.GA_TRACKING_ID || null
export const GTM_TRACKING_ID: string | null = app.config?.GTM_TRACKING_ID || null
export const GTM_AUTH: string | null = app.config?.GTM_AUTH || null

Expand Down Expand Up @@ -254,7 +253,6 @@ export function get(req: XP.Request): XP.Response {
language,
statbankWeb: statbankFane,
...statBankContent,
GA_TRACKING_ID,
GTM_TRACKING_ID,
GTM_AUTH,
headerBody: header?.body,
Expand Down Expand Up @@ -719,7 +717,6 @@ interface DefaultModel {
ieUrl: string
language: Language
statbankWeb: boolean
GA_TRACKING_ID: string | null
GTM_TRACKING_ID: string | null
GTM_AUTH: string | null
jsonLd: Article | undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
type AttachmentTablesFiguresData,
type AttachmentTablesFiguresProps,
} from '/lib/types/partTypes/attachmentTablesFigures'
import { GA_TRACKING_ID } from '/site/pages/default/default'
import { type Statistics } from '/site/content-types'
import { getProps } from '/site/parts/table/table'
import { preview as highchartPreview } from '/site/parts/highchart/highchart'
Expand Down Expand Up @@ -72,7 +71,6 @@ function getTablesAndFiguresComponent(page: Content<Statistics>, req: XP.Request
showAll: phrases.showAll,
showLess: phrases.showLess,
appName: app.name,
GA_TRACKING_ID: GA_TRACKING_ID,
title,
}

Expand Down
Loading

0 comments on commit 16373f4

Please sign in to comment.