Add dynamic Javascript

Add dynamic Javascript

Erezson
Visitor
1 0 1

Hi everyone!

I have question regarding Shopify application. I need to add custom remote Javascript to storefront on ALL pages. For example: https://example.com/example.js?param=hash. Where hash - dynamic some unique string we generate for user’s store.
With ScriptTag REST API it is easy task. But Shopify now require to use app blocks. For custom JS it is recommended to use app embed block.

The question here is how can we dynamically add remote Javascript with specific params using embed app block? We already created app embed block and we know user should enable it after app installation, but we don’t understand how can we automatically add dynamic js (so how to pass specific param from our app to app embed block).

Thanks! 

Reply 1 (1)

AndyHung
Shopify Partner
63 0 16

Hello @Erezson ,

I'm facing the same your issue. Did you have any solution? Please help me

Best Regards