Magento 1.9.1
Porto theme

We are running an Adwords campaing and we were given the following code to place into the Magento shopping cart in order to track how successful the campaign is:

<!-- Global site tag (gtag.js) - Google Analytics --> 
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-118694738-1"></script> 
  window.dataLayer = window.dataLayer || []; 
  function gtag(){dataLayer.push(arguments);} 
  gtag('js', new Date());

  gtag('config', 'UA-113694994-1'); 

I've tried putting this in the CMS home page,

  1. In the "Porto - Settings Panel" under Customization Settings --> Custom Style

  2. Under GENERAL --) DESIGN --) HTML HEAD --) Miscellaneous Scripts but it does not seem to work.

Where is the best place to place this code within Magento?

  • Check the answer & give feedback ;) May 15, 2018 at 6:04

1 Answer 1


Search for checkout/cart.phtml file (if I've understood your requirements right it should be placed only in cart page) in your app/design/frontend folder

You'll probably find more than one result, due to Magento theme fallback system https://www.classyllama.com/blog/depth-look-magento-theme-fallback




Locate which one is being rendered in your project, and place that Analytics JS code there

Your Answer

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

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