viernes, 14 de julio de 2017

El código de Statcounter en PrestaShop: 2 formas de insertarlo (sin módulos)

El código de Statcounter en PrestaShop: 2 formas de insertarlo (sin módulos)

Valencia, 14/07/2017, G,B,
Un apunte muy rápido, para que ya no se me vuelva a olvidar: el código de seguimiento del servicio de estadísticas de Statcounter, puede incluirse al final de la etiqueta </body> en el archivo footer.tpl del tema o theme activo de tu PrestaShop (al menos en la versión 1.6.x). También puede insertarse en el archivo header.tpl de tu tema o theme.

Recordad siempre hacer una copia de los archivos .tpl antes de modificarlos, por si algo saliera mal.

Dejo un ejemplo de esta segunda forma, en el que se incluye también el código de Google Analytics (EN VERDE), tras el de Statcounter (EN AZUL), al final de todo el código:
<!DOCTYPE HTML>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"{if isset($language_code) && $language_code} lang="{$language_code|escape:'html':'UTF-8'}"{/if}><![endif]-->
<!--[if IE 7]><html class="no-js lt-ie9 lt-ie8 ie7"{if isset($language_code) && $language_code} lang="{$language_code|escape:'html':'UTF-8'}"{/if}><![endif]-->
<!--[if IE 8]><html class="no-js lt-ie9 ie8"{if isset($language_code) && $language_code} lang="{$language_code|escape:'html':'UTF-8'}"{/if}><![endif]-->
<!--[if gt IE 8]> <html class="no-js ie9"{if isset($language_code) && $language_code} lang="{$language_code|escape:'html':'UTF-8'}"{/if}><![endif]-->
<html{if isset($language_code) && $language_code} lang="{$language_code|escape:'html':'UTF-8'}"{/if}><head>
<meta charset="utf-8" />
<title>{$meta_title|escape:'html':'UTF-8'}</title>
<!-- <title> TITULO DE LA WEB</title>  -->
{if isset($meta_description) AND $meta_description}
<meta name="description" content="{$meta_description|escape:'html':'UTF-8'}" />
{/if}
{if isset($meta_keywords) AND $meta_keywords}
<meta name="keywords" content="{$meta_keywords|escape:'html':'UTF-8'}" />
{/if}
<meta name="generator" content="PrestaShop" />
<meta name="robots" content="{if isset($nobots)}no{/if}index,{if isset($nofollow) && $nofollow}no{/if}follow" />
<meta name="viewport" content="width=device-width, minimum-scale=0.25, maximum-scale=1.0, initial-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="icon" type="image/vnd.microsoft.icon" href="{$favicon_url}?{$img_update_time}" />
<link rel="icon" type="image/vnd.microsoft.icon" href="favicon.ico" />
<link rel="shortcut icon" type="image/x-icon" href="{$favicon_url}?{$img_update_time}" />
<link rel="alternate" hreflang="es" href="http://paneldeco.com/es/" />
{if isset($css_files)}
{foreach from=$css_files key=css_uri item=media}
<link rel="stylesheet" href="{$css_uri}" media="{$media}" />
{/foreach}
{/if}
{if isset($js_defer) && !$js_defer && isset($js_files) && isset($js_def)}
{$js_def}
{foreach from=$js_files item=js_uri}
<script type="text/javascript" src="{$js_uri|escape:'html':'UTF-8'}"></script>
{/foreach}
{/if}
{$HOOK_HEADER}
<link rel="stylesheet" href="http{if Tools::usingSecureMode()}s{/if}://fonts.googleapis.com/css?family=Open+Sans:300,600&amp;subset=latin,latin-ext,cyrillic-ext" type="text/css" media="all" />
<link rel="stylesheet" href="http{if Tools::usingSecureMode()}s{/if}://fonts.googleapis.com/css?family=Lato:400,100,100italic,300,300italic,400italic,700italic,900,900italic,700&subset=latin,latin-ext" type="text/css" media="all" />
<!--[if IE 8]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
</head>
{if (($hide_left_column || $hide_right_column) && ($hide_left_column !='true' || $hide_right_column !='true')) && !$content_only}
{assign var="columns" value="2"}
{elseif (($hide_left_column && $hide_right_column) && ($hide_left_column =='true' && $hide_right_column =='true')) && !$content_only}
{assign var="columns" value="1"}
{elseif $content_only}
{assign var="columns" value="1"}
{else}
{assign var="columns" value="3"}
{/if}
<body{if isset($page_name)} id="{$page_name|escape:'html':'UTF-8'}"{/if} class="{if isset($page_name)}{$page_name|escape:'html':'UTF-8'}{/if}{if isset($body_classes) && $body_classes|@count} {implode value=$body_classes separator=' '}{/if}{if $hide_left_column} hide-left-column{else} show-left-column{/if}{if $hide_right_column} hide-right-column{else} show-right-column{/if}{if isset($content_only) && $content_only} content_only{/if} lang_{$lang_iso} {if !$content_only}{if $columns == 2} two-columns{elseif $columns == 3} three-columns{else} one-column{/if}{/if}">
{if !isset($content_only) || !$content_only}
    <!--[if IE 8]>
        <div style='clear:both;height:59px;padding:0 15px 0 15px;position:relative;z-index:10000;text-align:center;'><a href="//www.microsoft.com/windows/internet-explorer/default.aspx?ocid=ie6_countdown_bannercode"><img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today." /></a></div>
<![endif]-->
{if isset($restricted_country_mode) && $restricted_country_mode}
<div id="restricted-country">
<p>{l s='You cannot place a new order from your country.'}{if isset($geolocation_country) && $geolocation_country} <span class="bold">{$geolocation_country|escape:'html':'UTF-8'}</span>{/if}</p>
</div>
{/if}
<div id="page">
<div class="header-container">
<header id="header">
<div class="banner">
<div class="container">
<div class="row">
{hook h="displayBanner"}
</div>
</div>
</div>
<div class="nav">
<div class="container">
<div class="row">
<div id="header_logo">
<a href="{if isset($force_ssl) && $force_ssl}{$base_dir_ssl}{else}{$base_dir}{/if}" title="{$shop_name|escape:'html':'UTF-8'}">
<img class="logo img-responsive" src="{$logo_url}" alt="{$shop_name|escape:'html':'UTF-8'}"{if isset($logo_image_width) && $logo_image_width} width="{$logo_image_width}"{/if}{if isset($logo_image_height) && $logo_image_height} height="{$logo_image_height}"{/if}/>
</a>
</div>                                     <div style="float: left;">
<span class="col-sm-12" style="color:  #fff;font-size: 17px;padding-top: 25px;padding-bottom: 15px;padding-left: 30px;">
<i class="fa fa-phone"></i>
<strong>(+55) 55555555</strong>
</span>
<br>
<span class="col-sm-12" style="color:  #fff;font-size: 17px;padding-left: 30px;">
<strong>email@email.com</strong>
</span>
<br>
<span class="col-sm-12" style="color:  #fff;font-size: 24px;padding-left: 30px;PADDING-TOP: 15px;">
<strong>UN TEXTO</strong>
</span>
</div>
<div style="float: left;">
<span class="col-sm-12" style="color:  #fff;font-size: 17px;padding-top: 25px;padding-bottom: 15px;padding-left: 50px;">
<strong>OTRO TEXTO</strong>
</span>
<br>
<span class="col-sm-12" style="color:  #fff;font-size: 17px;padding-left: 50px;">
<strong>DIRECCION</strong>
</span>
<br>
<span class="col-sm-12" style="color:  #fff;font-size: 18px;padding-left: 50px;PADDING-TOP: 15px;">
<strong>DIRECCION</strong>
</span>
</div>
<nav>
{hook h="displayNav"}</nav>
</div>
</div>
</div>
<div>
<div class="container">
<div class="row">
{if isset($HOOK_TOP)}{$HOOK_TOP}{/if}
</div>
</div>
</div>
</header>
</div>
<div class="columns-container">
<div id="slider_row" class="row">
<div id="top_column" class="center_column col-xs-12">{hook h="displayTopColumn"}</div>
</div> <div id="columns" class="container">
{if $page_name !='index' && $page_name !='pagenotfound'}
{include file="$tpl_dir./breadcrumb.tpl"}
{/if}
<div class="row">
                    <div class="large-left col-sm-{12 - $right_column_size}">
                        <div class="row">
                            <div id="center_column" class="center_column col-xs-12 col-sm-{12 - $left_column_size}">
{/if}
{strip}
<!-- Start of StatCounter Code for Default Guide -->
<script type="text/javascript">
var sc_project=XXXXXXXX;
var sc_invisible=1;
var sc_security="xxxxxxxx";
var scJsHost = (("https:" == document.location.protocol) ?
"https://secure." : "http://www.");
document.write("<sc"+"ript type='text/javascript' src='" +
scJsHost+
"statcounter.com/counter/counter.js'></"+"script>");
</script>
<noscript><div class="statcounter"><a title="free hit
counter" href="http://statcounter.com/free-hit-counter/"
target="_blank"><img class="statcounter"
src="//c.statcounter.com/XXXXXXXX/0/xxxxxxxx/1/" alt="free
hit counter"></a></div></noscript>
<!-- End of StatCounter Code for Default Guide -->
{/strip}

{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','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXXXXX-X', 'auto'); ga('send', 'pageview'); </script>
{/literal}

0 comentarios: