• Priority: 0
  • Status: Closed
  • Theme: Venedor
  • Assigned To: Fred
  • Private: No
  • Open Date: 04.10.21, 12:36
  • Opened by: Craig
  • Closed by: Anonymous Submitter
  • Closed on:
  • Reason: Not a bug

Ticket #22371 - Google Tag Manager

Hi, i want to place a google tags manager container code into my site like below, please advise what */templates/layouts files should i use? I want for the moble AMP as well so assume i need to do this twice? Thanks In PS web directory open file layout-both-columns.tpl at /themes/*your_theme_name*/templates/layouts and put there container code provided by Google.
After head <code><!– Google Tag Manager –>
{literal}
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({’gtm.start’:
new Date().getTime(),event:’gtm.js’});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!=’dataLayer’?’&l=’+l:’‘;j.async=true;j.src=
https://www.googletagmanager.com/gtm.js?id=‘+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,’script’,’dataLayer’,’
*your_id*’);</script>
{/literal}
<!– End Google Tag Manager –>
After <body> or <body id=”….. <!– Google Tag Manager (noscript) –>
<noscript><iframe src=”https://www.googletagmanager.com/ns.html?id=
*your_id***” height=”0” width=”0” style=”display:none;visibility:hidden”></iframe></noscript>
<!– End Google Tag Manager (noscript) –></code>
5. At PS admin interface set to recompile template, clean cache and wait for up to 3 days for Google to see your integration.

Comments

Fred 08 Oct 2021, 10:58

1. You are doing everything right. Add that code into the file

/themes/venedor/templates/layouts/layout-both-columns.tpl

2. As for the AMP, you don’t need to add any code. Just go to AMP settings and enable Google Tag Manager