Jump to content

Where - Google Analytics - Prestashop 1.7


jbeltran

Recommended Posts

  • 2 weeks later...
  • 4 weeks later...
  • 1 month later...

Hello, in the previous version there was a free module where to insert only the UA.

In this version, there is no module yet.

 

Where is the best place and how to insert the google code?

 

Thank you.

suitable module from the previous version

Link to comment
Share on other sites

  • 2 months later...
  • 3 months later...

/ themes /YOUR THEME / templates / _partials  / head.tpl

 

insert to head.tpl

 

{literal}
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js,ga');

  ga('create', 'YOUR SCRIPT-1', 'auto');
  ga('send', 'pageview');

</script>
{/literal}

 

WORKING 100%

  • Like 2
Link to comment
Share on other sites

  • 1 year later...

Scusatemi, io ho la versione 1.7.4.4

ma nel file head.tpl non c'è: {literal} ... {/literal}

questo è il mio head.tpl:

{block name='head_charset'}
  <meta charset="utf-8">
{/block}
{block name='head_ie_compatibility'}
  <meta http-equiv="x-ua-compatible" content="ie=edge">
{/block}

{block name='head_seo'}
  <title>{block name='head_seo_title'}{$page.meta.title}{/block}</title>
  <meta name="description" content="{block name='head_seo_description'}{$page.meta.description}{/block}">
  <meta name="keywords" content="{block name='head_seo_keywords'}{$page.meta.keywords}{/block}">
  {if $page.meta.robots !== 'index'}
    <meta name="robots" content="{$page.meta.robots}">
  {/if}
  {if $page.canonical}
    <link rel="canonical" href="{$page.canonical}">
  {/if}
  {block name='head_hreflang'}
      {foreach from=$urls.alternative_langs item=pageUrl key=code}
            <link rel="alternate" href="{$pageUrl}" hreflang="{$code}">
      {/foreach}
  {/block}
{/block}

{block name='head_viewport'}
  <meta name="viewport" content="width=device-width, initial-scale=1">
{/block}

{block name='head_icons'}
  <link rel="icon" type="image/vnd.microsoft.icon" href="{$shop.favicon}?{$shop.favicon_update_time}">
  <link rel="shortcut icon" type="image/x-icon" href="{$shop.favicon}?{$shop.favicon_update_time}">
{/block}

{block name='stylesheets'}
  {include file="_partials/stylesheets.tpl" stylesheets=$stylesheets}
{/block}

{block name='javascript_head'}
  {include file="_partials/javascript.tpl" javascript=$javascript.head vars=$js_custom_vars}
{/block}

{block name='hook_header'}
  {$HOOK_HEADER nofilter}
{/block}

{block name='hook_extra'}{/block}

ho provato ad inserirlo su: 

{block name='hook_extra'}

*** Google Analytics ***

{/block}

Ma non funziona, non da errore ma non funziona.

Dato che vorrei inserire pure Yandex Metrica, devo per forza trovare il sistema giusto, manuale!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...