Google Adwords

Тема в разделе "PrestaShop", создана пользователем vlavin, 10 июн 2020.

  1. vlavin

    vlavin

    Регистрация:
    15 апр 2019
    Сообщения:
    20
    Симпатии:
    1
    Всем привет.
    Нужна помощь, нужно вставить этот код между тэгами head head , но не могу понять в каком файле (PS 1.7.6.1)
    Код:
    <!-- Global site tag (gtag.js) - Google Ads: 655XXXX25 -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=AW-655742925"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'AW-655XXXX25');
    </script>
    
    <script>
      gtag('event', 'page_view', {
        'send_to': 'AW-655XXXX25',
        'value': 'replace with value',
        'items': [{
          'id': 'replace with value',
          'google_business_vertical': 'retail'
        }]
      });
    </script>
     
    Lasted edited by : 10 июн 2020
  2. $iD

    $iD Команда форума

    Регистрация:
    13 мар 2012
    Сообщения:
    3.581
    Симпатии:
    1.482
    или через theme/partial/header.tpl
    или установить через Modules and services -> Google Analytics
     
  3. vlavin

    vlavin

    Регистрация:
    15 апр 2019
    Сообщения:
    20
    Симпатии:
    1


    не подскажете куда иммено вставить
    Код:
    {* AngarTheme *}
    
    {block name='header_banner'}
      <div class="header-banner">
        {hook h='displayBanner'}
      </div>
    {/block}
    
    {block name='header_nav'}
      <nav class="header-nav">
        <div class="container">
          <div class="row">
              <div class="col-md-12 col-xs-12">
                {hook h='displayNav1'}
    
                {hook h='displayNav2'}
              </div>
          </div>
        </div>
      </nav>
    {/block}
    
    {block name='header_top'}
      <div class="header-top">
        <div class="container">
          <div class="row">
            <a href="{$urls.base_url}" class="col-md-4 hidden-sm-down2" id="_desktop_logo">
                <img class="logo img-responsive" src="{$shop.logo}" alt="{$shop.name}">
            </a>
            {hook h='displayTop'}
            <div class="clearfix"></div>
          </div>
        </div>
    
        <div id="rwd_menu" class="hidden-md-up">
            <div class="container">
                <div id="menu-icon2" class="rwd_menu_item"><i class="material-icons d-inline">&#xE5D2;</i></div>
                <div id="search-icon" class="rwd_menu_item"><i class="material-icons search">&#xE8B6;</i></div>
                <div id="user-icon" class="rwd_menu_item"><i class="material-icons logged">&#xE7FF;</i></div>
                <div id="_mobile_cart" class="rwd_menu_item"></div>
            </div>
            <div class="clearfix"></div>
        </div>
    
        <div class="container">
            <div id="mobile_top_menu_wrapper2" class="rwd_menu_open hidden-md-up" style="display:none;">
                <div class="js-top-menu mobile" id="_mobile_top_menu"></div>
            </div>
    
            <div id="mobile_search_wrapper" class="rwd_menu_open hidden-md-up" style="display:none;">
                <div id="_mobile_search_widget"></div>
            </div>
    
            <div id="mobile_user_wrapper" class="rwd_menu_open hidden-md-up" style="display:none;">
                <div id="_mobile_user_info"></div>
            </div>
        </div>
      </div>
      {hook h='displayNavFullWidth'}
    {/block}
     
    Lasted edited by : 11 июн 2020
  4. $iD

    $iD Команда форума

    Регистрация:
    13 мар 2012
    Сообщения:
    3.581
    Симпатии:
    1.482
    Виноват, не header.tpl, а head.tpl
    в самый конец.
     
    vlavin нравится это.
  5. vlavin

    vlavin

    Регистрация:
    15 апр 2019
    Сообщения:
    20
    Симпатии:
    1
    выдает ошибку

    1/1) SmartyCompilerException
    Syntax error in template "file:/Applications/MAMP/htdocs/Aprodom/themes/AngarTheme/templates/_partials/head.tpl" on line 72 "function gtag(){dataLayer.push(arguments);}" - Unexpected ".", expected one of: "}"


    не могу понять где проблема, код скопировал с google

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

    gtag('config', 'UA-XXXXXXXX-1');
    </script>
     
  6. $iD

    $iD Команда форума

    Регистрация:
    13 мар 2012
    Сообщения:
    3.581
    Симпатии:
    1.482
    Код:
    {block name='hook_extra'}
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-1"></script>
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    
    gtag('config', 'UA-XXXXXXXX-1');
    </script>
    {/block}
    Так попробуйте.
     
  7. vlavin

    vlavin

    Регистрация:
    15 апр 2019
    Сообщения:
    20
    Симпатии:
    1
    не помогло
    Код:
    (1/1) SmartyCompilerException
    Syntax error in template "file:/Applications/MAMP/htdocs/Aprodom/themes/AngarTheme/templates/_partials/head.tpl" on line 72 "function gtag(){dataLayer.push(arguments);}" - Unexpected ".", expected one of: "}"
    
    in smarty_internal_templatecompilerbase.php line 72
    at Smarty_Internal_TemplateCompilerBase->trigger_template_error()in smarty_internal_templateparser.php line 3425
    at Smarty_Internal_Templateparser->yy_syntax_error(45, '.')in smarty_internal_templateparser.php line 3490
    at Smarty_Internal_Templateparser->doParse(45, '.')in smarty_internal_smartytemplatecompiler.php line 128
    at Smarty_Internal_SmartyTemplateCompiler->doCompile('{** * 2007-2017 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License 3.0 (AFL-3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * https://opensource.org/licenses/AFL-3.0 * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @AUTHOR PrestaShop SA <[email protected]> * @copyright 2007-2017 PrestaShop SA * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) * International Registered Trademark & Property of PrestaShop SA *}{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}{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}{block name=\'hook_extra\'}<!-- Global site tag (gtag.js) - Google Analytics --><script async src="https://www.googletagmanager.com/gtag/js?id=UA-162136431-1"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag(\'js\', new Date());gtag(\'config\', \'UA-162136431-1\');</script>{/block}', true)in smarty_internal_templatecompilerbase.php line 481
    at Smarty_Internal_TemplateCompilerBase->compileTemplateSource(object(SmartyDevTemplate), false, null)in smarty_internal_templatecompilerbase.php line 404
    at Smarty_Internal_TemplateCompilerBase->compileTemplate(object(SmartyDevTemplate))in smarty_template_compiled.php line 184
    at Smarty_Template_Compiled->compileTemplateSource(object(SmartyDevTemplate))in smarty_template_compiled.php line 141
    at Smarty_Template_Compiled->process(object(SmartyDevTemplate))in smarty_template_compiled.php line 105
    at Smarty_Template_Compiled->render(object(SmartyDevTemplate))in smarty_internal_template.php line 216
    at Smarty_Internal_Template->render()in smarty_internal_template.php line 385
    at Smarty_Internal_Template->_subTemplateRender('file:_partials/head.tpl', null, 'layouts/layout-left-column.tpl', 0, 3600, array(), 0, false)in 12910fc79d35a5e341fb44480011a0016060dbe0_2.file.layout-both-columns.tpl.php line 238
    at Block_3988308725ee2794f8aadb7_88696224->callBlock(object(SmartyDevTemplate))in smarty_internal_runtime_inheritance.php line 248
    at Smarty_Internal_Runtime_Inheritance->callBlock(object(Block_3988308725ee2794f8aadb7_88696224), object(SmartyDevTemplate))in smarty_internal_runtime_inheritance.php line 184
    at Smarty_Internal_Runtime_Inheritance->process(object(SmartyDevTemplate), object(Block_3988308725ee2794f8aadb7_88696224))in smarty_internal_runtime_inheritance.php line 156
    at Smarty_Internal_Runtime_Inheritance->instanceBlock(object(SmartyDevTemplate), 'Block_3988308725ee2794f8aadb7_88696224', 'head')in 12910fc79d35a5e341fb44480011a0016060dbe0_2.file.layout-both-columns.tpl.php line 40
    at content_5ee2794fa285a4_61199071(object(SmartyDevTemplate))in smarty_template_resource_base.php line 123
    at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))in smarty_template_compiled.php line 114
    at Smarty_Template_Compiled->render(object(SmartyDevTemplate))in smarty_internal_template.php line 216
    at Smarty_Internal_Template->render()in smarty_internal_template.php line 385
    at Smarty_Internal_Template->_subTemplateRender('layouts/layout-both-columns.tpl', null, 'layouts/layout-left-column.tpl', 0, 3600, array(), 2, false, null, null)in smarty_internal_runtime_inheritance.php line 125
    at Smarty_Internal_Runtime_Inheritance->endChild(object(SmartyDevTemplate), 'layouts/layout-both-columns.tpl')in e1dc6d80b909e6b1f96af92114112b9d9e8c0e72_2.file.layout-left-column.tpl.php line 38
    at content_5ee2794f89bf90_69026785(object(SmartyDevTemplate))in smarty_template_resource_base.php line 123
    at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))in smarty_template_compiled.php line 114
    at Smarty_Template_Compiled->render(object(SmartyDevTemplate))in smarty_internal_template.php line 216
    at Smarty_Internal_Template->render()in smarty_internal_template.php line 385
    at Smarty_Internal_Template->_subTemplateRender('layouts/layout-left-column.tpl', null, 'layouts/layout-left-column.tpl', 0, 3600, array(), 2, false, null, null)in smarty_internal_runtime_inheritance.php line 125
    at Smarty_Internal_Runtime_Inheritance->endChild(object(SmartyDevTemplate), 'layouts/layout-left-column.tpl')in 163009cec776ebb6c89026cbcca2474746ce9733_2.file.page.tpl.php line 33
    at content_5ee2794f87feb4_90359600(object(SmartyDevTemplate))in smarty_template_resource_base.php line 123
    at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))in smarty_template_compiled.php line 114
    at Smarty_Template_Compiled->render(object(SmartyDevTemplate))in smarty_internal_template.php line 216
    at Smarty_Internal_Template->render()in smarty_internal_template.php line 385
    at Smarty_Internal_Template->_subTemplateRender('page.tpl', null, 'layouts/layout-left-column.tpl', 0, 3600, array(), 2, false, null, null)in smarty_internal_runtime_inheritance.php line 125
    at Smarty_Internal_Runtime_Inheritance->endChild(object(SmartyDevTemplate), 'page.tpl')in cbf4f3431c7f656eb5cb07fa009be2286b11ebb0_2.file.index.tpl.php line 35
    at content_5ee2794f858342_29298149(object(SmartyDevTemplate))in smarty_template_resource_base.php line 123
    at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))in smarty_template_compiled.php line 114
    at Smarty_Template_Compiled->render(object(SmartyDevTemplate))in smarty_internal_template.php line 216
    at Smarty_Internal_Template->render(false, 0)in smarty_internal_templatebase.php line 232
    at Smarty_Internal_TemplateBase->_execute(object(SmartyDevTemplate), null, 'layouts/layout-left-column.tpl', null, 0)in smarty_internal_templatebase.php line 116
    at Smarty_Internal_TemplateBase->fetch('index.tpl', null, 'layouts/layout-left-column.tpl', null, false, true, false)in SmartyDev.php line 40
    at SmartyDev->fetch('index.tpl', null, 'layouts/layout-left-column.tpl')in FrontController.php line 683
    at FrontControllerCore->smartyOutputContent('index.tpl')in FrontController.php line 667
    at FrontControllerCore->display()in Controller.php line 312
    at ControllerCore->run()in Dispatcher.php line 515
    at DispatcherCore->dispatch()in index.php line 28
     
    Lasted edited by : 11 июн 2020
  8. $iD

    $iD Команда форума

    Регистрация:
    13 мар 2012
    Сообщения:
    3.581
    Симпатии:
    1.482
    Код:
    {literal}
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-1"></script>
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    
    gtag('config', 'UA-XXXXXXXX-1');
    {/literal}
    тогда так.

    устанавливать престу не хочется.
     
  9. vlavin

    vlavin

    Регистрация:
    15 апр 2019
    Сообщения:
    20
    Симпатии:
    1
    Не подскажете куда google вставлят код когда настрйка analytics делается через модуль
     
  10. $iD

    $iD Команда форума

    Регистрация:
    13 мар 2012
    Сообщения:
    3.581
    Симпатии:
    1.482
    сам код вставлять через модуль не нужно. Нужно вставить только Tracking ID.

    Заходите в настойки модуля и вставляете код. всё.