Open fabiograsso opened 4 years ago
Hello again,
I've found the issue, and it's related to function inject_event
in facebook-commerce-pixel-event.php
: here you're invoking wc_enqueue_js
that insert the pixel event code between other Woocomerce js code. This will ignore wc_facebook_pixel_script_attributes
.
I propose to change behaviour of inject_event
in order to not use wc_enqueue_js
but print the full code with <script ...>
and </script>
.
I've made also a pull request with this changes: #1274
π Isolate the bug
βοΈ Describe the bug
I'm trying to fix an issue with my Cookie consent script (managed by Iubenda) that I've discussed here in issue #857 (link to my comment) and #301 (link to my comment). But leaving aside for a moment the reason why I need this (block cookie), I need to change the code around
"<script"
issued by your plugin and for doing this I've found a bug/limitation.My idea is to change the HTML code provided by your script, by changing the filter
wc_facebook_pixel_script_attributes
. But it seems that only some pieces of your HTML code are changed while some events are still using the original code.πΆββοΈ Steps to reproduce
Add this function in theme's function.php:
βοΈ Expected behavior
At this point I'm expecting that all the Javascript code inserted by your plugin will be changed. But I've found that was only changed the JS load script and the PageView event:
This is fine, but the other events (in page footer) have still the original code with type="text/javascript", example:
π Logs
I have no useful logs to share
Do you have any suggestion on how can I change all the scripts type?