Closed E-VANCE closed 3 years ago
Hi Henning,
The reason why WPP's script doesn't use defer/async is to make sure the plugin can track pageviews as soon as the browser is able to download and parse its script. This also reduces the chances of other scripts interfering.
You can add the async/defer attribute without having to modify plugin's code though. For example, I'm using the script_loader_tag
filter hook to do so on my own website.
OK, gotcha – early parsing for a plugin like yours to ensure the views are counted properly makes sense. Will defer via script_loader_tag
and many thanks for your feedback.
Keep up the great work, much appreciated!
I noticed that Google PageSpeed advises to defer the parsing of JS in order to improve on the loading speed – is there a (technical) reason for WPP not to implement this by heart? Maybe the views won't be counted properly...?
I know that I can overwrite the loading in my WP instance / add the async-tag, just wanted to check in beforehand.
Thanks & regards, Henning