How to load script tag only on specific page ? (PHP)

jek
New Member
1 0 0

Sorry for the dumb question, but I am using PHP to add script tag to the storefront and wonder how to execute it only on a specific page such as the product page? Not on all storefront pages

I'm adding like this:

 

$script_array = array(
'script_tag' => array(
'event' => 'onload', 
'src' => 'https://feeltrify.000webhostapp.com/scripts/shopify.js'
)
);

$scriptTag = shopify_call($token, $shop, "/admin/api/2021-07/script_tags.json", $script_array, 'POST');
$scriptTag = json_decode($scriptTag['response'], JSON_PRETTY_PRINT);

 

0 Likes