first commit

This commit is contained in:
2024-11-05 12:22:50 +01:00
commit e5682a3912
19641 changed files with 2948548 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
drwxr-xr-x 4 30094 users 9 Oct 6 10:16 .
drwxr-xr-x 115 30094 users 117 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 9995 Sep 8 12:24 baecommercetracking.php
-rw-rw-r-- 1 30094 users 553 Sep 16 13:57 config_pl.xml
-rw-r--r-- 1 30094 users 0 Sep 8 12:24 index.php
-rw-r--r-- 1 30094 users 2719 Sep 8 12:24 logo.gif
-rw-r--r-- 1 30094 users 4305 Sep 8 12:24 logo.png
drwxr-xr-x 2 30094 users 8 Oct 6 10:16 translation
drwxr-xr-x 5 30094 users 6 Oct 6 10:16 views

View File

@@ -0,0 +1,253 @@
<?php
/**
* 2007-2020 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* http://opensource.org/licenses/osl-3.0.php
* 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 license@prestashop.com 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 <hatt@buy-addons.com>
* @copyright 2007-2020 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
* @since 1.6
*/
class BaEcommerceTracking extends Module
{
private $demoMode = false;
public function __construct()
{
$this->name = "baecommercetracking";
$this->tab = "analytics_stats";
$this->version = "1.0.6";
$this->author = "buy-addons";
$this->need_instance = 0;
$this->secure_key = Tools::encrypt($this->name);
$this->bootstrap = true;
$this->module_key = '602cd0bdd0899986aa08946c275edcc3';
parent::__construct();
$this->displayName = $this->l('Google and Facebook Conversion Tracking.');
$this->description = $this->l('Tracking Conversion from Google Analytics, Google Adword, Facebook Pixel.');
}
public function install()
{
if (parent::install() == false) {
return false;
}
if ($this->registerHook("displayFooter") == false
|| $this->registerHook("orderConfirmation") == false
|| $this->registerHook("displayHeader") == false
|| $this->registerHook("hookHeader") == false) {
return false;
}
return true;
}
public function uninstall()
{
if (parent::uninstall()) {
return true;
}
return true;
}
public function getContent()
{
$token=Tools::getAdminTokenLite('AdminModules');
$adminController=AdminController::$currentIndex;
$buttonSubmitSaveArr = array(
'baSaveAndStay',
'baSave',
'baAdwordsSaveAndStay',
'baAdwordsSave',
'baFacebookSave',
'baAdwordsSaveAndStay'
);
if ($this->demoMode==true) {
foreach ($buttonSubmitSaveArr as $buttonSubmitSave) {
if (Tools::isSubmit($buttonSubmitSave)) {
Tools::redirectAdmin($adminController.'&token='.$token.'&configure='.$this->name.'&demoMode=1');
}
}
}
if (Tools::isSubmit('baSaveAndStay')) {
$this->saveData();
} elseif (Tools::isSubmit('baSave')) {
$this->saveData();
Tools::redirectAdmin($adminController.'&token='.$token);
} elseif (Tools::isSubmit('baCancel')) {
Tools::redirectAdmin($adminController.'&token='.$token);
}
if (Tools::isSubmit('baAdwordsSaveAndStay')) {
$this->saveDataAdword();
} elseif (Tools::isSubmit('baAdwordsSave')) {
$this->saveDataAdword();
Tools::redirectAdmin($adminController.'&token='.$token);
} elseif (Tools::isSubmit('baAdwordsCancel')) {
Tools::redirectAdmin($adminController.'&token='.$token);
}
if (Tools::isSubmit('baFacebookSaveAndStay')) {
$this->saveDataFacebook();
} elseif (Tools::isSubmit('baFacebookSave')) {
$this->saveDataFacebook();
Tools::redirectAdmin($adminController.'&token='.$token);
} elseif (Tools::isSubmit('baFacebookCancel')) {
Tools::redirectAdmin($adminController.'&token='.$token);
}
$this->getDataAdword();
$this->getDataFacebook();
$baIdAnalytics=Configuration::get('baIdAnalytics');
$this->smarty->assign('baIdAnalytics', $baIdAnalytics);
$this->context->controller->addCSS($this->_path.'views/css/style.css');
$this->context->controller->addJS($this->_path.'views/js/admin.js');
$this->smarty->assign('demoMode', Tools::getValue('demoMode'));
return $this->display(__FILE__, 'views/templates/admin/baecommercetracking.tpl');
}
private function saveData()
{
$baIdAnalytics=Tools::getIsset("baIdAnalytics")?Tools::getValue("baIdAnalytics"):'';
Configuration::updateValue('baIdAnalytics', trim($baIdAnalytics));
}
private function saveDataAdword()
{
$baIdAdwords=Tools::getIsset("baIdAdwords")?Tools::getValue("baIdAdwords"):'';
Configuration::updateValue('baIdAdwords', trim($baIdAdwords));
$baIdAdwordsLabel=Tools::getIsset("baIdAdwordsLabel")?Tools::getValue("baIdAdwordsLabel"):'';
Configuration::updateValue('baIdAdwordsLabel', trim($baIdAdwordsLabel));
}
private function getDataAdword()
{
$baIdAdwords=Configuration::get('baIdAdwords');
$this->smarty->assign('baIdAdwords', $baIdAdwords);
$baIdAdwordsLabel=Configuration::get('baIdAdwordsLabel');
$this->smarty->assign('baIdAdwordsLabel', $baIdAdwordsLabel);
$languageDefault = $this->context->language->iso_code;
$this->smarty->assign('languageDefault', $languageDefault);
$currencyDefault = $this->context->currency->iso_code;
$this->smarty->assign('currencyDefault', $currencyDefault);
}
private function saveDataFacebook()
{
$facebookId=Tools::getIsset("facebookId")?Tools::getValue("facebookId"):'';
Configuration::updateValue('facebookId', Tools::htmlentitiesUTF8(trim($facebookId)));
}
private function getDataFacebook()
{
$facebookId=Configuration::get('facebookId');
$this->smarty->assign('facebookId', $facebookId);
}
public function getSKUProduct($product)
{
$sku='EAN_'.$product['product_ean13'];
if ($product['product_upc'] != "") {
$sku='UPC_'.$product['product_upc'];
} elseif ($product['product_reference'] != "") {
$sku='REFERENCE_'.$product['product_reference'];
} else {
$sku='PRODUCT_ID_'.$product['product_id'];
}
return $sku;
}
public function hookorderConfirmation($params)
{
if (Tools::version_compare(_PS_VERSION_, '1.7.0.0', '>')) {
$order = $params['order'];
} else {
$order = $params['objOrder'];
}
$this->context->smarty->assign('order', $order);
$idOrder = Order::getOrderByCartId($order->id_cart);
$this->context->smarty->assign('idOrder', $idOrder);
$productList = $order->getProducts();
foreach ($productList as $key => $product) {
$category = new Category($product['id_category_default'], $order->id_lang, $product['id_shop']);
$productList[$key]['category_name'] = $category->name;
}
//var_dump($productList);die;
$this->context->smarty->assign('productList', $productList);
$currency = new Currency($order->id_currency);
$this->context->smarty->assign('currency_iso_code', $currency->iso_code);
$totalTax = ($order->total_paid_tax_incl - $order->total_paid_tax_excl);
$this->context->smarty->assign('totalTax', $totalTax);
$language = new Language($order->id_lang);
$this->context->smarty->assign('language_iso_code', $language->iso_code);
$baIdAnalytics=Configuration::get('baIdAnalytics');
$this->context->smarty->assign('baIdAnalytics', $baIdAnalytics);
$PS_SHOP_NAME=Configuration::get('PS_SHOP_NAME');
$this->context->smarty->assign('PS_SHOP_NAME', $PS_SHOP_NAME);
$baIdAdwordsLabel=Configuration::get('baIdAdwordsLabel');
$this->context->smarty->assign('baIdAdwordsLabel', $baIdAdwordsLabel);
//Tracking google analytics
//End tracking google analytics
//Tracking google adword
$baIdAdwords=Configuration::get('baIdAdwords');
$this->context->smarty->assign('baIdAdwords', $baIdAdwords);
//End tracking google adword
//Tracking facebook
$facebookId = Configuration::get('facebookId');
$this->context->smarty->assign('facebookId', $facebookId);
//End Tracking facebook
return $this->display(__FILE__, 'views/templates/front/blockecommercetracking.tpl');
}
public function hookdisplayFooter($params)
{
$baIdAnalytics=Configuration::get('baIdAnalytics');
$this->context->smarty->assign('baIdAnalytics', $baIdAnalytics);
}
public function hookdisplayHeader(& $params)
{
return $this->hookHeader($params);
}
public function hookHeader($params)
{
$page_type = Tools::getValue('controller');
$stepoder = Tools::getValue("step");
$baIdAnalytics = Configuration::get('baIdAnalytics');
$currency_code = $this->context->currency->iso_code;
$facebookId = Configuration::get('facebookId');
$this->context->smarty->assign('facebookId', $facebookId);
$this->context->smarty->assign('bastepoder', $stepoder);
$this->context->smarty->assign('currency_code', $currency_code);
$this->context->smarty->assign('baIdAnalytics', $baIdAnalytics);
$this->context->smarty->assign('page_type', $page_type);
return $this->display(__FILE__, 'views/templates/front/blockecommercetracking2.tpl');
}
}

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>baecommercetracking</name>
<displayName><![CDATA[Google and Facebook Conversion Tracking.]]></displayName>
<version><![CDATA[1.0.6]]></version>
<description><![CDATA[Tracking Conversion from Google Analytics, Google Adword, Facebook Pixel.]]></description>
<author><![CDATA[buy-addons]]></author>
<tab><![CDATA[analytics_stats]]></tab>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,8 @@
drwxr-xr-x 2 30094 users 8 Oct 6 10:16 .
drwxr-xr-x 4 30094 users 9 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 43 Sep 8 12:24 de.php
-rw-r--r-- 1 30094 users 45 Sep 8 12:24 en.php
-rw-r--r-- 1 30094 users 43 Sep 8 12:24 es.php
-rw-r--r-- 1 30094 users 43 Sep 8 12:24 fr.php
-rw-r--r-- 1 30094 users 0 Sep 8 12:24 index.php
-rw-r--r-- 1 30094 users 43 Sep 8 12:24 it.php

View File

@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();

View File

@@ -0,0 +1,5 @@
<?php
global $_MODULE;
$_MODULE = array();

View File

@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();

View File

@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();

View File

@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();

View File

@@ -0,0 +1,6 @@
drwxr-xr-x 5 30094 users 6 Oct 6 10:16 .
drwxr-xr-x 4 30094 users 9 Oct 6 10:16 ..
drwxr-xr-x 2 30094 users 4 Oct 6 10:16 css
-rw-r--r-- 1 30094 users 0 Sep 8 12:24 index.php
drwxr-xr-x 2 30094 users 4 Oct 6 10:16 js
drwxr-xr-x 4 30094 users 5 Oct 6 10:16 templates

View File

@@ -0,0 +1,4 @@
drwxr-xr-x 2 30094 users 4 Oct 6 10:16 .
drwxr-xr-x 5 30094 users 6 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 0 Sep 8 12:24 index.php
-rw-r--r-- 1 30094 users 652 Sep 8 12:24 style.css

View File

@@ -0,0 +1,32 @@
.bootstrap.panel{
width:100%;
float:left;
}
.form_config .control-label{
text-align:right;
margin-top:4px;
}
.form_config .panel-footer{
display: block;
float: left;
width: 100%;
margin: 0 !important;
background:none !important;
border:0;
}
#content.bootstrap .form_config .ba_title_selection{
margin: 0px 0 15px !important;
width: 100% ;
float: left;
padding: 0;
}
.ba_title_selection{
margin: 0px 0 15px !important;
width: 100%;
float: left;
padding: 0;
}
#wrapperViewCodeAdword,#wrapperViewCodeFacebook{
display:none;
}
.bootstrap .alert.alert-danger:before{top:23px;}

View File

@@ -0,0 +1,4 @@
drwxr-xr-x 2 30094 users 4 Oct 6 10:16 .
drwxr-xr-x 5 30094 users 6 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 4751 Sep 8 12:24 admin.js
-rw-r--r-- 1 30094 users 0 Sep 8 12:24 index.php

View File

@@ -0,0 +1,87 @@
/**
* 2007-2020 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (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:
* http://opensource.org/licenses/afl-3.0.php
* 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 license@buy-addons.com 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 Buy-addons <contact@buy-addons.com>
* @copyright 2007-2020 Buy-addons
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
jQuery(document).ready(function(){
jQuery('#btnTestYourCodeAdword').click(function(){
console.log('aaaaa');
var idAdword = jQuery('#idAdword').val();
var LabelAdword = jQuery('#LabelAdword').val();
var languageDefault = jQuery('#languageDefault').val();
var currencyDefault = jQuery('#currencyDefault').val();
var codeAword = encodeHtmlEntity('<!-- Google Code for code1 Conversion Page -->')+'<br />';
codeAword+=encodeHtmlEntity('<script type="text/javascript">')+'<br />';
codeAword+=encodeHtmlEntity('/* <![CDATA[ */')+'<br />';
codeAword+='var google_conversion_id = '+idAdword+';<br />';
codeAword+='var google_conversion_language = "'+languageDefault+'";<br />';
codeAword+='var google_conversion_format = "3";<br />';
codeAword+='var google_conversion_color = "ffffff";<br />';
codeAword+='var google_conversion_label = "'+LabelAdword+'";<br />';
codeAword+='var google_conversion_value = 1.00;<br/>';
codeAword+='var google_conversion_currency = "'+currencyDefault+'";<br />';
codeAword+='var google_remarketing_only = false;<br />';
codeAword+='/* ]]> */<br/>';
codeAword+=encodeHtmlEntity('</script>')+'<br />';
codeAword+=encodeHtmlEntity('<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">');
codeAword+=encodeHtmlEntity('</script>')+'<br />';
codeAword+=encodeHtmlEntity('<noscript>')+'<br />';
codeAword+=encodeHtmlEntity('<div style="display:inline;">')+'<br />';
codeAword+=encodeHtmlEntity('<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/'+idAdword+'/?value=1.00&amp;currency_code='+currencyDefault+'&amp;label='+LabelAdword+'&amp;guid=ON&amp;script=0"/>')+'<br />';
codeAword+=encodeHtmlEntity('</div>')+'<br />';
codeAword+=encodeHtmlEntity('</noscript>');
jQuery('#wrapperViewCodeAdword').show();
jQuery('#viewCodeAdword').html(codeAword);
});
jQuery('#btnTestYourCodeFacebook').click(function(){
var idFacebook = jQuery('#facebookId').val();
var codeFacebook = encodeHtmlEntity("<!-- Facebook Pixel Code -->")+"<br/>";
codeFacebook += encodeHtmlEntity("<script>")+"<br/>";
codeFacebook += encodeHtmlEntity(" !function(f,b,e,v,n,t,s)")+"<br/>";
codeFacebook += encodeHtmlEntity(" {if(f.fbq)return;n=f.fbq=function(){n.callMethod?")+"<br/>";
codeFacebook += encodeHtmlEntity(" n.callMethod.apply(n,arguments):n.queue.push(arguments)};")+"<br/>";
codeFacebook += encodeHtmlEntity(" if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';")+"<br/>";
codeFacebook += encodeHtmlEntity(" n.queue=[];t=b.createElement(e);t.async=!0;")+"<br/>";
codeFacebook += encodeHtmlEntity(" t.src=v;s=b.getElementsByTagName(e)[0];")+"<br/>";
codeFacebook += encodeHtmlEntity(" s.parentNode.insertBefore(t,s)}(window, document,'script',")+"<br/>";
codeFacebook += encodeHtmlEntity(" 'https://connect.facebook.net/en_US/fbevents.js');")+"<br/>";
codeFacebook += encodeHtmlEntity(" fbq('init', '"+idFacebook+"');")+"<br/>";
codeFacebook += encodeHtmlEntity(" fbq('track', 'PageView');")+"<br/>";
codeFacebook += encodeHtmlEntity("</script>")+"<br/>";
codeFacebook += encodeHtmlEntity('<noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id='+idFacebook+'&ev=PageView&noscript=1"/></noscript>')+"<br/>";
codeFacebook += encodeHtmlEntity('<!-- End Facebook Pixel Code -->');
jQuery('#wrapperViewCodeFacebook').show();
jQuery('#viewCodeFacebook').html(codeFacebook);
});
});
var encodeHtmlEntity = function(str) {
var buf = [];
for (var i=str.length-1;i>=0;i--) {
buf.unshift(['&#', str[i].charCodeAt(), ';'].join(''));
}
return buf.join('');
};

View File

@@ -0,0 +1,5 @@
drwxr-xr-x 4 30094 users 5 Oct 6 10:16 .
drwxr-xr-x 5 30094 users 6 Oct 6 10:16 ..
drwxr-xr-x 2 30094 users 4 Oct 6 10:16 admin
drwxr-xr-x 2 30094 users 5 Oct 6 10:16 front
-rw-r--r-- 1 30094 users 0 Sep 8 12:24 index.php

View File

@@ -0,0 +1,4 @@
drwxr-xr-x 2 30094 users 4 Oct 6 10:16 .
drwxr-xr-x 4 30094 users 5 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 6758 Sep 8 12:24 baecommercetracking.tpl
-rw-r--r-- 1 30094 users 0 Sep 8 12:24 index.php

View File

@@ -0,0 +1,135 @@
{*
* 2007-2020 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (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:
* http://opensource.org/licenses/afl-3.0.php
* 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 license@buy-addons.com 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 Buy-addons <contact@buy-addons.com>
* @copyright 2007-2020 Buy-addons
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{if $demoMode=="1"}
<div class="bootstrap ba_error">
<div class="module_error alert alert-danger">
{l s='You are use ' mod='baecommercetracking'}
<strong>{l s='Demo Mode' mod='baecommercetracking'}</strong>
{l s=', so some buttons, functions will be disabled because of security. ' mod='baecommercetracking'}<br />
{l s='You can use them in Live mode after you puchase our module. ' mod='baecommercetracking'}<br />
{l s='Thanks !' mod='baecommercetracking'}
</div>
</div>
{/if}
<div class="bootstrap form_config">
<form action="" method="POST">
<input type="hidden" value="{$languageDefault|escape:'htmlall':'UTF-8'}" id="languageDefault"/>
<input type="hidden" value="{$currencyDefault|escape:'htmlall':'UTF-8'}" id="currencyDefault"/>
<div style="width: 100%;float: left;" class="panel">
<h3 style="margin-top:-16px !important;" class="ba_title_selection"><i class="icon-bar-chart"></i> {l s='Google Analytics' mod='baecommercetracking'}</h3>
<div class="col-md-12">
<lable class="col-md-3 control-label">{l s='Tracking ID' mod='baecommercetracking'}: </lable>
<div class="col-md-5">
<input type="text" name="baIdAnalytics" value="{$baIdAnalytics|escape:'htmlall':'UTF-8'}">
</div>
</div>
<div class="panel-footer">
<button type="submit" value="1" name="baCancel" class="btn btn-default pull-left">
<i class="process-icon-cancel"></i> {l s='Cancel' mod='baecommercetracking'}
</button>
<button type="submit" value="1" name="baSave" class="btn btn-default pull-right">
<i class="process-icon-save"></i> {l s='Save' mod='baecommercetracking'}
</button>
<button type="submit" name="baSaveAndStay" class="btn btn-default pull-right">
<i class="process-icon-save"></i> {l s='Save and stay' mod='baecommercetracking'}
</button>
</div>
</div>
<div style="width: 100%;float: left;" class="panel">
<h3 class="ba_title_selection"><i class="icon-bar-chart"></i> {l s='Google Adwords Conversion Tracking' mod='baecommercetracking'}</h3>
<div class="col-md-12" style="margin-bottom: 7px;">
<lable class="col-md-3 control-label">{l s='Add your Google Conversion Tracking ID' mod='baecommercetracking'}: </lable>
<div class="col-md-5">
<input id="idAdword" type="text" name="baIdAdwords" value="{$baIdAdwords|escape:'htmlall':'UTF-8'}">
</div>
</div>
<div class="col-md-12" style="margin-bottom: 7px;">
<lable class="col-md-3 control-label">{l s='Add your Google Conversion Tracking Label' mod='baecommercetracking'}: </lable>
<div class="col-md-5">
<input id="LabelAdword" type="text" name="baIdAdwordsLabel" value="{$baIdAdwordsLabel|escape:'htmlall':'UTF-8'}">
</div>
</div>
<div class="col-md-12" style="margin-bottom: 7px;">
<lable class="col-md-3 control-label">{l s='Test your code' mod='baecommercetracking'}: </lable>
<div class="col-md-5">
<input type="button" value="{l s='Click Here' mod='baecommercetracking'}" class="btn btn-info" id="btnTestYourCodeAdword">
</div>
</div>
<div class="col-md-12" style="margin-bottom: 7px;" id="wrapperViewCodeAdword">
<lable class="col-md-3 control-label">{l s='View Code' mod='baecommercetracking'}: </lable>
<div class="col-md-5">
<pre id="viewCodeAdword">
</pre>
</div>
</div>
<div class="panel-footer">
<button type="submit" value="1" name="baAdwordsCancel" class="btn btn-default pull-left">
<i class="process-icon-cancel"></i> {l s='Cancel' mod='baecommercetracking'}
</button>
<button type="submit" value="1" name="baAdwordsSave" class="btn btn-default pull-right">
<i class="process-icon-save"></i> {l s='Save' mod='baecommercetracking'}
</button>
<button type="submit" name="baAdwordsSaveAndStay" class="btn btn-default pull-right">
<i class="process-icon-save"></i> {l s='Save and stay' mod='baecommercetracking'}
</button>
</div>
</div>
<div style="width: 100%;float: left;" class="panel">
<h3 class="ba_title_selection"><i class="icon-bar-chart"></i> {l s='Facebook Pixel' mod='baecommercetracking'}</h3>
<div class="col-md-12" style="margin-bottom: 7px;">
<lable class="col-md-3 control-label">{l s='Facebook ID' mod='baecommercetracking'}: </lable>
<div class="col-md-5">
<input id="facebookId" type="text" name="facebookId" value="{$facebookId|escape:'htmlall':'UTF-8'}">
</div>
</div>
<div class="col-md-12" style="margin-bottom: 7px;">
<lable class="col-md-3 control-label">{l s='Test your code' mod='baecommercetracking'}: </lable>
<div class="col-md-5">
<input type="button" value="{l s='Click Here' mod='baecommercetracking'}" class="btn btn-info" id="btnTestYourCodeFacebook">
</div>
</div>
<div class="col-md-12" style="margin-bottom: 7px;" id="wrapperViewCodeFacebook">
<lable class="col-md-3 control-label">{l s='View Code' mod='baecommercetracking'}: </lable>
<div class="col-md-5">
<pre id="viewCodeFacebook">
</pre>
</div>
</div>
<div class="panel-footer">
<button type="submit" value="1" name="baFacebookCancel" class="btn btn-default pull-left">
<i class="process-icon-cancel"></i> {l s='Cancel' mod='baecommercetracking'}
</button>
<button type="submit" value="1" name="baFacebookSave" class="btn btn-default pull-right">
<i class="process-icon-save"></i> {l s='Save' mod='baecommercetracking'}
</button>
<button type="submit" name="baFacebookSaveAndStay" class="btn btn-default pull-right">
<i class="process-icon-save"></i> {l s='Save and stay' mod='baecommercetracking'}
</button>
</div>
</div>
</form>
</div>

View File

@@ -0,0 +1,5 @@
drwxr-xr-x 2 30094 users 5 Oct 6 10:16 .
drwxr-xr-x 4 30094 users 5 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 4903 Sep 8 12:24 blockecommercetracking.tpl
-rw-r--r-- 1 30094 users 2641 Sep 8 12:24 blockecommercetracking2.tpl
-rw-r--r-- 1 30094 users 0 Sep 8 12:24 index.php

View File

@@ -0,0 +1,108 @@
{*
* 2007-2020 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (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:
* http://opensource.org/licenses/afl-3.0.php
* 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 license@buy-addons.com 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 Buy-addons <contact@buy-addons.com>
* @copyright 2007-2020 Buy-addons
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<script>
{literal}
(
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');
{/literal}
ga('require', 'ecommerce');
ga('ecommerce:addTransaction', {
'id': '{$idOrder|escape:'htmlall':'UTF-8'}',
'affiliation': '{$PS_SHOP_NAME|escape:'htmlall':'UTF-8'}',
'revenue': '{$order->total_paid_tax_incl|escape:'htmlall':'UTF-8'}',
'shipping': '{$order->total_shipping_tax_incl|escape:'htmlall':'UTF-8'}',
'tax': '{$totalTax|escape:'htmlall':'UTF-8'}',
'currency': '{$currency_iso_code|escape:'htmlall':'UTF-8'}' // local currency code.
});
{foreach $productList as $product}
{assign var="sku" value="EAN_"|cat:$product.product_ean13}
{if $product.product_upc != ""}
{assign var="sku" value="UPC_"|cat:$product.product_upc}
{elseif $product.product_reference != ""}
{assign var="sku" value="REFERENCE_"|cat:$product.product_reference}
{else}
{assign var="sku" value="PRODUCT_ID_"|cat:$product.product_id}
{/if}
ga('ecommerce:addItem', {
'id': '{$idOrder|escape:'htmlall':'UTF-8'}',
'name': '{$product.product_name|escape:'htmlall':'UTF-8'}, Reference: {$product.product_reference|escape:'htmlall':'UTF-8'}',
'sku': '{$sku|escape:'htmlall':'UTF-8'}',
'category': '{$product.category_name|escape:'htmlall':'UTF-8'}',
'price': '{$product.total_price_tax_incl|escape:'htmlall':'UTF-8'}',
'quantity': '{$product.product_quantity|escape:'htmlall':'UTF-8'}',
'currency': '{$currency_iso_code|escape:'htmlall':'UTF-8'}'
});
{/foreach}
ga('ecommerce:send');
ga('ecommerce:clear');
</script><br/>
<!-- Google Code for code1 Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = {$baIdAdwords|escape:'htmlall':'UTF-8'};
var google_conversion_language = "{$language_iso_code|escape:'htmlall':'UTF-8'}";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "{$baIdAdwordsLabel|escape:'htmlall':'UTF-8'}";
var google_conversion_value = {$order->total_paid_tax_incl|escape:'htmlall':'UTF-8'};
var google_conversion_currency = "{$currency_iso_code|escape:'htmlall':'UTF-8'}";
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/{$baIdAdwords|escape:'htmlall':'UTF-8'}/?value={$order->total_paid_tax_incl|escape:'htmlall':'UTF-8'}&amp;currency_code={$currency_iso_code|escape:'htmlall':'UTF-8'}&amp;label={$baIdAdwordsLabel|escape:'htmlall':'UTF-8'}&amp;guid=ON&amp;script=0"/>
</div>
</noscript>
<!-- Facebook Pixel Code -->
<script>
{literal}
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
{/literal}
fbq('init', '{$facebookId|escape:"htmlall":"UTF-8"}');
fbq('track', 'Purchase');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id={$facebookId|escape:"htmlall":"UTF-8"}&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->

View File

@@ -0,0 +1,76 @@
{*
* 2007-2020 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (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:
* http://opensource.org/licenses/afl-3.0.php
* 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 license@buy-addons.com 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 Buy-addons <contact@buy-addons.com>
* @copyright 2007-2020 Buy-addons
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<script>
{literal}
(
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');
{/literal}
ga('create', '{$baIdAnalytics|escape:'htmlall':'UTF-8'}', 'auto');
ga('send', 'pageview');
</script>
<!-- Facebook Pixel Code -->
<script>
{literal}
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
{/literal}
fbq('init', '{$facebookId|escape:"htmlall":"UTF-8"}');
fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id={$facebookId|escape:"htmlall":"UTF-8"}&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->
{if ($page_type == 'order' && $bastepoder == false) || ($page_type == 'cart')}
<script>
fbq('track', 'AddToCart');
</script>
{/if}
{if $page_type == 'search'}
<script>
fbq('track', 'Search');
</script>
{/if}
{if $page_type == 'orderconfirmation' || $page_type == 'order-confirmation'}
<script>
fbq('track', 'Purchase');
</script>
{/if}