I'm creating a shopify app but im facing some issues while working with script-tag api
I have created a script tag using this code:
router.get("/scripts-tag/create",async (ctx)=>{
ctx.body = await client.post({
path: 'script_tags',
data: {"script_tag":{"event":"onload","src":"https://xxxxx.ngrok.io/_next/static/chunks/pages/script-tag.js"}},
type: DataType.JSON,
});
})
With this response:
"body": {
"script_tag": {
"id": 173210206277,
"src": "https://xxxxx.ngrok.io/_next/static/chunks/pages/script-tag.js",
"event": "onload",
"created_at": "2022-02-08T22:39:43+05:00",
"updated_at": "2022-02-08T22:39:43+05:00",
"display_scope": "all",
"cache": false
}
},
"headers": {}
}
script-tag.js:
import React from "react";
export default function scriptTag(){
alert("hello")
}
i have also used this code before:
alert("hello world")
but the the real issue i'm facing is when i'm opening the store

you can see in the above image that script is loaded in store page but the script code is not executed.