Skip to content

Improvements to MTM tracker to allow full _paq functionality #594

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

Merged
merged 8 commits into from
Feb 7, 2023

Conversation

snake14
Copy link
Contributor

@snake14 snake14 commented Jan 20, 2023

Description:

This is to remedy the fact that _paq.push doesn't work reliably while using MTM.

Review

@snake14
Copy link
Contributor Author

snake14 commented Feb 2, 2023

@AltamashShaikh Any ideas what is causing the JavaScript build to fail? It appears to have started with the previous commit, but I'm not seeing what in that commit would cause the failure.

@snake14 snake14 marked this pull request as ready for review February 2, 2023 02:50
@AltamashShaikh
Copy link
Contributor

@AltamashShaikh Any ideas what is causing the JavaScript build to fail? It appears to have started with the previous commit, but I'm not seeing what in that commit would cause the failure.

Seeing the same issue in FormAnalytics build and trying to figure out, @sgiehl do you have any idea why this is breaking ?

Copy link
Contributor

@AltamashShaikh AltamashShaikh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snake14 looks good, but why haven't we made any changes for ecommerce to work ?
Also can you add an example html here to test this functionality better ?

@snake14
Copy link
Contributor Author

snake14 commented Feb 2, 2023

@snake14 looks good, but why haven't we made any changes for ecommerce to work ? Also can you add an example html here to test this functionality better ?

@AltamashShaikh I didn't think that any specific changes were necessary to make ecommerce work because it's using the default Tracker from js/piwik.js. Did you test tracking ecommerce using _paq.push?

@@ -117,39 +128,167 @@
}
configuredTrackers[variableName] = tracker;

var requireCookieConsentIndex = disableBrowserFeatureDetectionIndex
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also can we document this, whenever any new config is supported we should not forget to add new variable here and support it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Do you think it would be best to note it in the developer documentation, the FAQ, or both? Any specific page recommendations?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Developer documentation should be fine

Copy link
Contributor

@AltamashShaikh AltamashShaikh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snake14 Left few suggestion for comments and doc and was able to test with the resources you shared and looks good to me

Copy link
Contributor

@AltamashShaikh AltamashShaikh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for adding the documentation all looks good 👍

@snake14
Copy link
Contributor Author

snake14 commented Feb 7, 2023

Thank you @AltamashShaikh . I went ahead and created a documentation PR, so I'm going to merge this PR.

@snake14 snake14 merged commit 395dd84 into 4.x-dev Feb 7, 2023
@snake14 snake14 deleted the pg-1718-fixing-tag-manager-tracker-issue branch February 7, 2023 04:17
@sgiehl
Copy link
Member

sgiehl commented Feb 7, 2023

@snake14 @AltamashShaikh It doesn't look like a useful move to simply merge a PR that is known to break the tests.
This might be fine if tests are failing randomly or it's known the failure is caused by something else. But in this case it's clear the javascript tests started to fail with 9fb7e80
So some changes in that commit are making problems. I'm not deep enough in the javascript of the TagManager, but I would assume that resetting window._paq might cause the trouble. If you need help with solving that, maybe @tsteur can assist.

@snake14
Copy link
Contributor Author

snake14 commented Feb 7, 2023

@sgiehl We weren't sure since the errors were identical to the JavaScript build errors in other plugin branches. Plus, the changes have been tested by Altamash, Thomas, and myself without issue. Is the issue in the code or is the build too brittle? I can try a slightly different approach around window._paq, but I don't know if that's the root issue.

Edit: I created a new PR and tried a few changes to make sure that I wasn't reassigning window._paq or _paq. It looks like the build is passing now. Thank you for the suggestion @sgiehl . I'm still seeing some 404 errors in the build's output, but I need to move on from this issue.

@AltamashShaikh
Copy link
Contributor

@sgiehl Thanks for pointing it out and we will be careful next time, actually I did test this on local and it seems to passing so we thought it as a recent random JS tests failing on github-actions and proceeded ahead

@sgiehl
Copy link
Member

sgiehl commented Feb 8, 2023

@AltamashShaikh If you think something fails randomly simply try to rerun the job a couple of times and see if its really random or fails always...

@bx80 bx80 changed the title Starting to make improvement to MTM tracker to allow full _paq functionality Improvements to MTM tracker to allow full _paq functionality Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants