@diosmosis opened this Pull Request on November 3rd 2022 Member


This PR adds the ability to use queueRequest() with a full tracker request URL (ie, the result of getRequest()). The primary use case is when there is asynchronous code that is used to determine the contents of the request, and we want to make sure the correct parameters are used when the async code finishes. For example:

function myPluginTrackSomething(..., customizeParameter) {
    var tracker = getAsyncTracker(); // only one tracker just for the example
    var url = tracker.getRequest(...);
    customizeParameter(..., function (newParam) {
        tracker.queueRequest(url + '&param=' + encodeURIComponent(newParam), true);

Prevents the following type of error:

  1. user loads a SPA. myPluginTrackSomething() is called, which initiates the customizer callback
  2. user changes the page, track pageview is called
  3. customizer callback finishes and queueRequest is called. But since we use getRequest() beforehand, the URL uses the correct action name/URL, etc.


@github-actions[bot] commented on November 11th 2022 Contributor

This issue is in "needs review" but there has been no activity for 7 days. ping @matomo-org/core-reviewers

@sgiehl commented on November 11th 2022 Member

@diosmosis would you solve the conflicts?

@diosmosis commented on November 11th 2022 Member

@sgiehl updated

@diosmosis commented on November 11th 2022 Member

added a test as well

This Pull Request was closed on November 15th 2022
Powered by GitHub Issue Mirror