Load the api init script before the tracker so values are populated #355
+4
−1
Conversation
What advantage does changing it to priority 9 make? The move to change the order in which it is registered should be enough. |
It makes no functional difference in this change -- it just calls out that it should occur in that order as a visual hint. If the lines were to be inadvertently reversed e.g in a future refactoring, it would not break the load order. |
So, add a code comment, rather than change the behaviour to something less standard? |
done |
jblz
added a commit
that referenced
this pull request
Aug 9, 2021
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
jblz commentedAug 3, 2021
Description
The function that enqueues the tracker script from the CDN is currently firing prior to the one that enqueues the API init script.
This change reverses that and makes explicit via the
add_action
's$priority
param that it should run in that order.Motivation and Context
The
global.PARSELY.onload
function has to be populated prior to the tracker being loaded so it can actually be called and the/profile
API call conditionally fired.See:
wp-parsely/src/js/lib/init-api/index.js
Lines 18 to 30 in 12976fb
How Has This Been Tested?
On a sandboxed version of blog.parse.ly
Screenshots (if appropriate):
Types of changes
Bug fix (non-breaking change which fixes an issue)