matomo-org / matomo-org/matomo-for-wordpress

Wrong script tag in Matomo Tag Manager

Open
#573 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
PHP
Stars
145
Forks
35
Avg merge
2d 2h
Merged PRs (30d)
6

Description

Hi support,

the generated script from google tag manager is <script >. it should be <script>

Expected Behavior

Having this content
`

<script> var _mtm = _mtm || []; _mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'}); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.async=true; g.src="https://host.com/wp-content/uploads/matomo/container_RldkJr.js"; s.parentNode.insertBefore(g,s); </script>`

Current Behavior

We get this content:
`

<script > var _mtm = _mtm || []; _mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'}); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.async=true; g.src="https://host.com/wp-content/uploads/matomo/container_RldkJr.js"; s.parentNode.insertBefore(g,s); </script>`

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the repository for the generated Matomo Tag Manager snippet, especially "mtm.startTime" or the script tag output. Compare the generation path with the expected and current snippets in this issue, then verify that the output uses <script> without the extra space.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
analytics, web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.