Skip to content
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

Facebook Pixel script and others not loading #29

Open
Tanisyr opened this issue May 22, 2024 · 1 comment
Open

Facebook Pixel script and others not loading #29

Tanisyr opened this issue May 22, 2024 · 1 comment

Comments

@Tanisyr
Copy link

Tanisyr commented May 22, 2024

Even though your code seems like it should be passing through any script not explicitly blocked in its settings, the app is effectively blocking other scripts that are being created dynamically. I have tried debugging this myself but to no avail. In particular there seems to be an issue in the modifyCreateElement function that is causing normal document.createElement('script') tags to not have their src attribute loaded properly. Have you encountered this before?

When I disable the app optimization my Facebook Pixel sales channel script executes properly again. I would like to be able to use both, please advise.

To reproduce, create a store with the Facebook & Instagram sales channel connected with a Facebook pixel and any other plugin to be optimized. Add the app optimization code and configure it to block the other plugin on the homepage. Using the Facebook Pixel Debugger observe how the pixel code is working on every page but the homepage.

@Tanisyr Tanisyr changed the title Facebook Pixel script not loading Facebook Pixel script and others not loading May 22, 2024
@Tanisyr
Copy link
Author

Tanisyr commented May 25, 2024

I found my issue. For some reason some of the Shopify code was passing a src attribute that was not a string, but an instance of TrustedScriptURL, which doesn't contain an indexOf method. This was causing your url comparison logic to error out and prevent the src attribute from being set correctly on certain script.

The fix is to change the line:

return stringIncludes(src, item.url);

to

return stringIncludes(src.toString(), item.url);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant