I want to add the script in the head.phtml but i need the product's id, SKU. So i only want it to work when is on the product Detail page.

  • You can setup rules in google tag manager so it only triggers on the the product page
    – PaddyD
    Commented Nov 7, 2019 at 15:32

1 Answer 1


I have found the solution:

$_product = Mage::registry("current_product")
    if ($_product && $_product->getId()) :
        //google tag code here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.