Analytics scripts are injected to page multiple times

Expected Behavior

Page contains scripts only once

Actual Behavior

Some scripts duplicate whenever some actions are made in the site.
For example changing between Near you and Favorites tabs in the front page. Probably some init script is being run in the wrong place.
One duplicating script is at the beginning of the head html tag. Another is at the end of the body tag.
The scripts are related to Google Tag Manager and Matomo

Steps to Reproduce

Steps:

  • Navigate to reittiopas.hsl.fi

  • Open dev tools (F12)

  • Open elements viewer

  • Change to Favorites tab

  • There will be additional script tags at the end of html body and beginning of head

  • Do more actions on the site to get more duplicates

Environment

Does not work in local dev environment.
I was able to reproduce in reittiopas.hsl.fi
Tested on chrome and firefox

Description

Some initialization scripts for analytics gathering are duplicated whenever actions are made on the page.

Assignee

Tarmo Asikainen

Reporter

Tarmo Asikainen

More details from

None

Priority

Medium

Recurrence

At will

User Agent

Chrome

Components

Story Points

None

Labels

None

Epic Link

Configure