Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Matomo JS Tracker work in strict mode #14791

Closed
alexyeunghk01 opened this issue Aug 19, 2019 · 5 comments · Fixed by #16498
Closed

Make Matomo JS Tracker work in strict mode #14791

alexyeunghk01 opened this issue Aug 19, 2019 · 5 comments · Fixed by #16498
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.

Comments

@alexyeunghk01
Copy link

as I am using es6 module and import piwik.js via npm package, every dependency are in js strict mode
It will show error ReferenceError: JSON_PIWIK is not defined

Can we wrap all global variables with window.? It seems can fix the issue easily, I am ok to open PR to do it

@Findus23
Copy link
Member

Hi,

Quick question: How are you using piwik.js via npm package? As far as I know there is no npm module for the tracking code.

@tsteur
Copy link
Member

tsteur commented Aug 19, 2019

Sure feel free to do a PR 👍 That should be fine to prefix it with window.

@tsteur tsteur added this to the Backlog (Help wanted) milestone Aug 19, 2019
@tsteur tsteur added the Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. label Aug 19, 2019
@Findus23 Findus23 added the Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. label May 23, 2020
@nina-py
Copy link
Contributor

nina-py commented Sep 30, 2020

I think this ticket should be closed as there is nothing to do - the JSON_PIWIK variable is long gone from the codebase: https://github.com/matomo-org/matomo/pull/15785/files

@Findus23
Copy link
Member

Findus23 commented Sep 30, 2020

It would still be great if someone could test if importing matomo.js as an npm package works correctly and if this was the only thing breaking it.

@tsteur
Copy link
Member

tsteur commented Sep 30, 2020

Did a quick test and what was missing was still prefixing some variables with window which I fixed in #16498

diosmosis pushed a commit that referenced this issue Sep 30, 2020
* Make JS tracker work in strict mode

fix #14791

* rebuilt piwik.js
@mattab mattab changed the title Support piwik in strict mode? Make Matomo JS Tracker work in strict mode Nov 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants