8
0

clear outdated files

# Conflicts:
#	copy_this/modules/d3/d3_googleanalytics/metadata.php
#	copy_this/modules/d3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_ecommerce.tpl
Dieser Commit ist enthalten in:
Daniel Seifert 2019-09-19 00:03:42 +02:00 committet von Daniel Seifert
Ursprung 83d1a2a37e
Commit e25e1d3a34
9 geänderte Dateien mit 14 neuen und 466 gelöschten Zeilen

Datei anzeigen

@ -18,6 +18,8 @@
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
*/
use D3\ModCfg\Application\Model\d3utils;
/**
* Metadata version
*/
@ -74,26 +76,16 @@ $aModule = array(
'd3_google_trustedstore_articlelister' =>
'd3/d3_googleanalytics/models/d3_google_trustedstore_articlelister.php',
),
'templates' => array(
'd3_googleanalytics.tpl' => 'd3/d3_googleanalytics/views/tpl/widget/d3_googleanalytics.tpl',
'd3ga_universal.tpl' => 'd3/d3_googleanalytics/views/tpl/widget/d3ga_universal.tpl',
'd3ga_universal_custom.tpl' =>
'd3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_custom.tpl',
'd3ga_universal_ecommerce.tpl' =>
'd3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_ecommerce.tpl',
'd3ga_universal_adwords.tpl' =>
'd3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_adwords.tpl',
'd3ga_universal_adwordscode.tpl' =>
'd3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_adwordscode.tpl',
'd3ga_universal_remarketing.tpl' =>
'd3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_remarketing.tpl',
'd3ga_universal_campaigncode.tpl' =>
'd3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_campaigncode.tpl',
'd3ga_universal_trustedstore.tpl' =>
'd3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_trustedstore.tpl',
'templates' => array(
'd3ga_universal_adwordscode.tpl' => 'd3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_adwordscode.tpl',
'd3ga_universal_remarketing.tpl' => 'd3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_remarketing.tpl',
'd3ga_universal_campaigncode.tpl' => 'd3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_campaigncode.tpl',
'd3ga_universal_trustedstore.tpl' => 'd3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_trustedstore.tpl',
'd3ga_gtag.tpl' => 'd3/d3_googleanalytics/views/tpl/widget/d3ga_gtag.tpl',
'd3ga_gtag_ecommerce.tpl' => 'd3/d3_googleanalytics/views/tpl/widget/inc/d3ga_gtag_ecommerce.tpl',
'd3ga_gtag_adwords.tpl' => 'd3/d3_googleanalytics/views/tpl/widget/inc/d3ga_gtag_adwords.tpl',
'd3ga_gtag_custom.tpl' => 'd3/d3_googleanalytics/views/tpl/widget/inc/d3ga_gtag_custom.tpl',
'd3_cfg_googleanalytics_main.tpl' => 'd3/d3_googleanalytics/views/admin/tpl/d3_cfg_googleanalytics_main.tpl',
'd3_cfg_googleanalytics_adwords.tpl' => 'd3/d3_googleanalytics/views/admin/tpl/d3_cfg_googleanalytics_adwords.tpl',

Datei anzeigen

@ -79,8 +79,6 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
}
$oParentView->addTplParam('sD3GATTpl', $this->d3getGATTpl());
$oParentView->addTplParam('sD3GACreateParameter', $this->d3getCreateParameters());
$oParentView->addTplParam('sAFEGetMoreUrls', $this->afGetMoreUrls());
$oParentView->addTplParam('sD3GASendPageViewParameter', $this->d3getSendPageViewParameters());
$oParentView->addTplParam('sD3CurrentShopUrl', $this->d3GetCreateCurrentShopUrl());
@ -119,20 +117,6 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
return $this->_sModId;
}
/**
* @return string
*/
public function d3getGATTpl()
{
if (d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'async') {
return 'd3_googleanalytics.tpl';
} elseif (d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'universaal') {
return 'd3ga_universal.tpl';
} elseif (d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'gtag') {
return 'd3ga_gtag.tpl';
}
}
/**
* @return string
*/
@ -249,36 +233,6 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
return $blIsSsl || $aLanguageUrls[$oVal->id] != $aLanguageUrls[oxRegistry::getLang()->getBaseLanguage()];
}
/**
* @return string
*/
public function d3getCreateParameters()
{
$aParameter = array();
if (d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'gtag') {
$aParameter = $this->_d3getCreateAnonymizeIpParameter($aParameter);
/** @var oxUBase $oCurrentView */
$oCurrentView = oxRegistry::getConfig()->getActiveView();
$oCurrentView->getIsOrderStep();
$aParameter = $this->_d3getGtagSendPageViewPageParameter($oCurrentView, $aParameter);
}
$aParameter = $this->_d3getCreateDomainNameParameter($aParameter);
$aParameter = $this->_d3getCreateCookiePathParameter($aParameter);
$aParameter = $this->_d3getCreateDomainLinkerParameter($aParameter);
$aParameter = $this->_d3getCreateSpeedSamplerateParameter($aParameter);
$aParameter = $this->_d3getCreateSamplerateParameter($aParameter);
if (count($aParameter)) {
return ", {".implode(',', $aParameter)."}";
}
return '';
}
/**
* @return string
*/

Datei anzeigen

@ -4,7 +4,7 @@
[{if $mod_d3_googleanalytics}]
[{block name="BaseAnalytics"}]
[{include file=$sD3GATTpl}]
[{include file="d3ga_gtag.tpl"}]
[{oxstyle include=$oViewConf->getModuleUrl('d3_googleanalytics', 'out/src/d3_googleanalytics.css')}]
[{if $blD3GAIsMobile}]
[{oxstyle include=$oViewConf->getModuleUrl('d3_googleanalytics', 'out/src/d3_googleanalytics_mobile.css')}]

Datei anzeigen

@ -1,224 +0,0 @@
[{if $blD3GoogleAnalyticsActive && $oD3GASettings->getValue('sD3GAId')}]
[{if $oViewConf->getActiveClassName() == 'thankyou'}]
[{assign var="order" value=$oView->getOrder()}]
[{assign var="oPayment" value=$order->getPayment()}]
[{assign var="oDelSet" value=$order->getDelSet()}]
[{assign var="aVoucherSerieList" value=$order->d3getVoucherSerieList()}]
[{assign var="oUser" value=$oView->getUser()}]
[{/if}]
[{block name="AsyncAnalytics"}]
[{capture name="d3GATrackCode"}]
[{strip}]
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '[{$oD3GASettings->getValue('sD3GAId')}]']);
[{if $oD3GASettings->getValue('blD3GAAnonymizeIP')}]
_gaq.push(['_gat._anonymizeIp']);
[{/if}]
[{if $oD3GASettings->getValue('sD3GASetDomainName')}]
_gaq.push(['_setDomainName', '[{$oD3GASettings->getValue('sD3GASetDomainName')}]']);
_gaq.push(['_setAllowHash', false]);
[{else}]
_gaq.push(['_setDomainName', 'none']);
[{/if}]
[{if $oD3GASettings->getValue('sD3GASetCookiePath')}]
_gaq.push(['_setCookiePath', '[{$oD3GASettings->getValue('sD3GASetCookiePath')}]']);
[{/if}]
[{if $oD3GASettings->getValue('iD3GASiteSpeedSampleRate')}]
_gaq.push(['_setSiteSpeedSampleRate', [{$oD3GASettings->getValue('iD3GASiteSpeedSampleRate')}]]);
[{/if}]
[{if $oD3GASettings->getValue('iD3GASampleRate')}]
_gaq.push(['_setSampleRate', '[{$oD3GASettings->getValue('iD3GASampleRate')}]']);
[{/if}]
[{if $oD3GASettings->getValue('blD3GAAllowDomainLinker')}]
_gaq.push(['_setAllowLinker', true]);
[{/if}]
[{if $oD3GASettings->getValue('blD3GASetClientInfo')}]
_gaq.push(['_setClientInfo', false]);
[{else}]
_gaq.push(['_setClientInfo', true]);
[{/if}]
[{if $oD3GASettings->getValue('blD3GASetDetectFlash')}]
_gaq.push(['_setDetectFlash', false]);
[{else}]
_gaq.push(['_setDetectFlash', true]);
[{/if}]
[{if $oD3GASettings->getValue('blD3GASetDetectTitle')}]
_gaq.push(['_setDetectTitle', false]);
[{else}]
_gaq.push(['_setDetectTitle', true]);
[{/if}]
[{if !$oD3GASettings->getValue('blD3GASetAdWordsCampaignTrack')}]
_gaq.push(['_setCampaignTrack', true]);
[{else}]
_gaq.push(['_setCampaignTrack', false]);
[{/if}]
[{if !$oD3GASettings->getValue('blD3GASetAdWordsCampaignTrack') && $oD3GASettings->getValue('sD3GASetCampaignCookieTimeout')}]
_gaq.push(['_setCampaignCookieTimeout', '[{$oD3GASettings->getValue('sD3GASetCampaignCookieTimeout')}]']);
[{/if}]
[{if !$oD3GASettings->getValue('blD3GASetAdWordsCampaignTrack') && $oD3GASettings->getValue('sD3GASetCampNameKey')}]
_gaq.push(['_setCampNameKey', '[{$oD3GASettings->getValue('sD3GASetCampNameKey')}]']);
[{/if}]
[{if !$oD3GASettings->getValue('blD3GASetAdWordsCampaignTrack') && $oD3GASettings->getValue('sD3GASetCampMediumKey')}]
_gaq.push(['_setCampMediumKey', '[{$oD3GASettings->getValue('sD3GASetCampMediumKey')}]']);
[{/if}]
[{if !$oD3GASettings->getValue('blD3GASetAdWordsCampaignTrack') && $oD3GASettings->getValue('sD3GASetCampSourceKey')}]
_gaq.push(['_setCampSourceKey', '[{$oD3GASettings->getValue('sD3GASetCampSourceKey')}]']);
[{/if}]
[{if !$oD3GASettings->getValue('blD3GASetAdWordsCampaignTrack') && $oD3GASettings->getValue('sD3GASetCampTermKey')}]
_gaq.push(['_setCampTermKey', '[{$oD3GASettings->getValue('sD3GASetCampTermKey')}]']);
[{/if}]
[{if !$oD3GASettings->getValue('blD3GASetAdWordsCampaignTrack') && $oD3GASettings->getValue('sD3GASetCampContentKey')}]
_gaq.push(['_setCampContentKey', '[{$oD3GASettings->getValue('sD3GASetCampContentKey')}]']);
[{/if}]
[{if !$oD3GASettings->getValue('blD3GASetAdWordsCampaignTrack') && $oD3GASettings->getValue('sD3GASetCampContentKey')}]
_gaq.push(['_setCampNOKey', 'ga_nooverride']);
[{/if}]
[{if $oD3GASettings->getValue('blD3GAUseCustomVars')}]
[{**** add custom variables here ****}]
[{if $oxcmp_user}]
_gaq.push(['_setCustomVar',
1, [{*// This custom var is set to slot #1. Required parameter.*}]
'Geschlecht', [{*// The name of the custom variable. Required parameter.*}]
[{if $oxcmp_user->oxuser__oxsal->value == 'MR'}]'male'[{elseif $oxcmp_user->oxuser__oxsal->value == 'MRS'}]'female'[{/if}],
[{*// The value of the custom variable. Required parameter.*}]
1 [{*// Sets the scope to visitor-level. Optional parameter.*}]
]);
[{/if}]
[{if $oViewConf->getActiveClassName() == 'thankyou' && $oPayment}]
_gaq.push(['_setCustomVar',2,'Zahlungsart', '[{$oPayment->getFieldData('oxdesc')}]' , 3]);
[{/if}]
[{if $oViewConf->getActiveClassName() == 'thankyou' && $oDelSet}]
_gaq.push(['_setCustomVar',3,'Versandart', '[{$oDelSet->getFieldData('oxtitle')}]' , 3]);
[{/if}]
[{if $oViewConf->getActiveClassName() == 'thankyou' && $aVoucherSerieList}]
[{foreach from=$aVoucherSerieList item="oVoucherSerie"}]
_gaq.push(['_setCustomVar',4,'Gutschein', '[{$oVoucherSerie->getFieldData('oxserienr')}]', 3]);
[{/foreach}]
[{/if}]
[{if $oViewConf->getActiveClassName() == 'thankyou' && $order}]
_gaq.push(['_setCustomVar',5,'Waehrung', '[{$order->getFieldData('oxcurrency')}]' , 3]);
[{/if}]
[{if $oViewConf->getActiveClassName() == 'thankyou'}]
_gaq.push(['_setCustomVar',5,'Neukunde', '[{$oView->isNewCustomer()}]',3]);
[{/if}]
[{/if}]
_gaq.push(['_trackPageview' [{$sD3GASendPageViewParameter}]]);
[{if $oD3GASettings->getValue('blD3GATrackPageLoadTime')}]
_gaq.push(['_trackPageLoadTime']);
[{/if}]
[{if $oD3GASettings->getValue('sD3GACookiePathCopy')}]
_gaq.push(['_cookiePathCopy', '[{$oD3GASettings->getValue('sD3GACookiePathCopy')}]']);
[{/if}]
[{if $oD3GASettings->getValue('blD3GASendECommerce') && $oViewConf->getActiveClassName() == 'thankyou'}]
[{assign var="currate" value=$order->oxorder__oxcurrate->value}]
_gaq.push(['_addTrans',
'[{$order->oxorder__oxordernr->value}]', [{* // order ID - required *}]
'[{$oxcmp_shop->oxshops__oxname->value|escape:"quotes"}]', [{* // affiliation or store name *}]
[{if $oD3GASettings->getValue('blD3GAUseNetto')}]
'[{math equation="s / r" s=$order->getOrderNetSum() r=$currate format="%.2f"}]', [{* // total - required - has to be gross sum *}]
[{else}]
'[{math equation="s / r" s=$order->getTotalOrderSum() r=$currate format="%.2f"}]', [{* // total - required *}]
[{/if}]
'[{math equation="s - r" s=$order->getTotalOrderSum() r=$order->getOrderNetSum() format="%.2f"}]', [{* // tax *}]
'[{math equation="s / r" s=$order->oxorder__oxdelcost->value r=$currate format="%.2f"}]', [{* // shipping *}]
'[{$order->oxorder__oxbillcity->value|escape:"quotes"}]', [{* // city *}]
'[{$order->oxorder__oxbillstate->value|escape:"quotes"}]', [{* // state or province *}]
'[{$order->oxorder__oxbillcountry->value|escape:"quotes"}]' [{* // country *}]
]);
[{foreach from=$order->getOrderArticles() item=oOrderArticle}]
_gaq.push(['_addItem',
'[{$order->oxorder__oxordernr->value}]', [{* // order ID - required *}]
'[{$oOrderArticle->oxorderarticles__oxartnum->value|escape:"quotes"}]', [{* // SKU/code *}]
'[{$oOrderArticle->oxorderarticles__oxtitle->value|escape:"quotes"}]', [{* // product name *}]
'[{$oOrderArticle->oxorderarticles__d3_galocator->value|escape:"quotes"}]', [{* // category or variation *}]
[{*'[{$oOrderArticle->oxorderarticles__oxselvariant->value}]', [{* // category or variation *}]
[{if $oD3GASettings->getValue('blD3GAUseNetto')}]
[{assign var="oPrice" value=$oOrderArticle->getPrice()}]
'[{math equation="s / r" s=$oPrice->getNettoPrice() r=$currate format="%.2f"}]', [{* // unit price - required *}]
[{else}]
'[{$oOrderArticle->oxorderarticles__oxprice->value}]', [{* // unit price - required - is not currency depended *}]
[{/if}]
'[{$oOrderArticle->oxorderarticles__oxamount->value}]' [{* // quantity - required *}]
]);
[{/foreach}]
_gaq.push(['_trackTrans']);
[{/if}]
[{* bounce optimization*}]
[{block name="d3ga_bounceoptimization"}]
[{if $oD3GASettings->getValue('blUseBounceRateOptimization')}]
setTimeout('_gaq.push([\'_trackEvent\', \'NoBounce\', \'Over defined seconds\'])',[{$iD3GASendNoBounceEventTime}]);
[{if $oD3GASettings->getValue('blSendNoBounceEventScroll')}]
window.addEventListener ?
window.addEventListener('scroll', testScroll, false) :
window.attachEvent('onscroll', testScroll);
var scrollCount = 0;
function testScroll() {
++scrollCount;
if (scrollCount == 2) {
_gaq.push(['_trackEvent', 'window', 'scrolled']);
}
}
[{/if}]
[{/if}]
[{/block}]
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
[{if $oD3GASettings->getValue('blD3GAUseRemarketing')}]
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
[{else}]
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
[{/if}]
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
[{if (false == $oD3GASettings->getValue('blD3GASetCampaignOnThankyouOnly') || $oViewConf->getActiveClassName() == 'thankyou') &&
$oD3GASettings->getValue('blD3GASetCampaignTrack') && $oD3GASettings->getValue('sD3GACampaignCode')}]
[{$oD3GASettings->getValue('sD3GACampaignCode')}]
[{/if}]
[{/strip}]
[{/capture}]
[{if $oViewConf->getActiveClassName() == 'thankyou'}]
[{$oView->logCode($smarty.capture.d3GATrackCode)}]
[{/if}]
[{$smarty.capture.d3GATrackCode}]
[{/block}]
[{/if}]

Datei anzeigen

@ -153,6 +153,10 @@
[{include file="d3ga_gtag_ecommerce.tpl"}]
[{include file="d3ga_gtag_adwords.tpl"}]
[{include file="d3ga_gtag_custom.tpl"}]
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/events *}]
[{* login, logout, toBasket, fromBasket, sendContact *}]
gtag('event', 'ACTION', { 'event_category': 'CATEGORY', 'event_label': 'LABEL', 'value': 'VALUE' });
@ -162,32 +166,6 @@ gtag('event', 'ACTION', { 'event_category': 'CATEGORY', 'event_label': 'LABEL',
gtag ('event', 'age_dimension', {'age': 12});
</script>
---------------------------------------------------------------------
<script type="text/javascript">
(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', '[{$oD3GASettings->getValue('sD3GAId')}]', '[{$sD3CurrentShopUrl}]' [{$sD3GACreateParameter}]);
[{include file="d3ga_universal_adwords.tpl"}]
[{include file="d3ga_universal_custom.tpl"}]
</script>
[{*/strip*}]
[{/capture}]

Datei anzeigen

@ -1,105 +0,0 @@
[{if $blD3GoogleAnalyticsActive && $oD3GASettings->getValue('sD3GAId')}]
[{capture name="d3GATrackCode"}]
[{strip}]
[{if $oD3GASettings->getValue('blD3GAUseOptOut')}]
[{block name="d3ga_optoutscript"}]
<script type="text/javascript">
var gaProperty = '[{$oD3GASettings->getValue('sD3GAId')}]';
var disableStr = 'ga-disable-' + gaProperty;
if (document.cookie.indexOf(disableStr + '=true') > -1) {
window[disableStr] = true;
}
function gaOptout() {
document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
window[disableStr] = true;
}
</script>
[{/block}]
[{/if}]
<script type="text/javascript">
(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', '[{$oD3GASettings->getValue('sD3GAId')}]', '[{$sD3CurrentShopUrl}]' [{$sD3GACreateParameter}]);
[{if $oD3GASettings->getValue('blD3GAAllowDomainLinker')}]
ga('require', 'linker');
ga('linker:autoLink', [[{$sAFEGetMoreUrls}]]);
[{/if}]
[{if $oD3GASettings->getValue('blD3GAAnonymizeIP')}]
ga('set', 'anonymizeIp', true);
[{/if}]
[{include file="d3ga_universal_adwords.tpl"}]
[{include file="d3ga_universal_custom.tpl"}]
[{if $oD3GASettings->getValue('blD3GAUseRemarketing')}]
ga('require', 'displayfeatures');
[{/if}]
[{* bounce optimization*}]
[{block name="d3ga_bounceoptimization"}]
[{if $oD3GASettings->getValue('blUseBounceRateOptimization')}]
setTimeout('ga(\'send\', \'event\', \'NoBounce\', \'Over defined seconds\')',[{$iD3GASendNoBounceEventTime}]);
[{if $oD3GASettings->getValue('blSendNoBounceEventScroll')}]
window.addEventListener ?
window.addEventListener('scroll', testScroll, false) :
window.attachEvent('onscroll', testScroll);
var scrollCount = 0;
function testScroll() {
++scrollCount;
if (scrollCount == 2) {
ga('send', 'event', 'window', 'scrolled');
}
}
[{/if}]
[{/if}]
[{/block}]
ga('send', 'pageview' [{$sD3GASendPageViewParameter}]);
[{include file="d3ga_universal_ecommerce.tpl"}]
[{if $oD3GASettings->getValue('blD3GATrackPageLoadTime')}]
[{block name="d3ga_trackpageloadtime"}]
var perfData = window.performance.timing;
var pageLoadTime =
Math.round(
(
(perfData.domComplete > 0 ? perfData.domComplete : perfData.responseEnd) - perfData.navigationStart
) / 1000
);
ga('set', 'metric1', pageLoadTime);
[{*ga('send', 'event', 'Page Load Time', loadTime, {'nonInteraction': true});*}]
[{/block}]
[{/if}]
</script>
[{/strip}]
[{/capture}]
[{if $oViewConf->getActiveClassName() == 'thankyou'}]
[{$oView->logCode($smarty.capture.d3GATrackCode)}]
[{/if}]
[{$smarty.capture.d3GATrackCode}]
[{/if}]

Datei anzeigen

@ -1,47 +0,0 @@
[{if $oD3GASettings->getValue('blD3GASendECommerce') && $oViewConf->getActiveClassName() == 'thankyou'}][{strip}]
[{block name="UniversalEcommerceOrder"}]
[{assign var="order" value=$oView->getOrder()}]
ga('require', 'ecommerce');
[{assign var="currate" value=$order->oxorder__oxcurrate->value}]
[{if $oD3GASettings->getValue('blD3GAUseNetto')}]
[{math equation="s / r" s=$order->getOrderNetSum() r=$currate format="%.2f" assign="sTotal"}] [{* // total - required - has to be gross sum *}]
[{else}]
[{math equation="s / r" s=$order->getTotalOrderSum() r=$currate format="%.2f" assign="sTotal"}] [{* // total - required *}]
[{/if}]
[{math equation="s - r" s=$order->getTotalOrderSum() r=$order->getOrderNetSum() format="%.2f" assign="sTax"}]
[{math equation="s / r" s=$order->oxorder__oxdelcost->value r=$currate format="%.2f" assign="sShipping"}]
ga('ecommerce:addTransaction', {
'id': '[{$order->oxorder__oxordernr->value}]', [{* Transaction ID. Required *}]
'affiliation': '[{$oxcmp_shop->oxshops__oxname->value|escape:"quotes"}]', [{* Affiliation or store name *}]
'revenue': '[{$sTotal}]', [{* Gesamtwert *}]
'shipping': '[{$sShipping}]', [{* Versand *}]
'tax': '[{$sTax}]' [{* Steuer *}]
});
[{foreach from=$order->getOrderArticles() item=oOrderArticle}]
[{block name="UniversalEcommerceOrderArticle"}]
[{if $oD3GASettings->getValue('blD3GAUseNetto')}]
[{assign var="oPrice" value=$oOrderArticle->getPrice()}]
[{math equation="s / r" s=$oPrice->getNettoPrice() r=$currate format="%.2f" assign="sPrice"}]
[{else}]
[{assign var="sPrice" value=$oOrderArticle->oxorderarticles__oxprice->value}]
[{/if}]
ga('ecommerce:addItem', {
'id': '[{$order->oxorder__oxordernr->value}]', [{* Transaktions-ID *}]
'name': '[{$oOrderArticle->oxorderarticles__oxtitle->value|escape:"quotes"}]', [{* Produktname *}]
'sku': '[{$oOrderArticle->oxorderarticles__oxartnum->value|escape:"quotes"}]', [{* SKU/Code *}]
'category': '[{$oOrderArticle->oxorderarticles__d3_galocator->value|escape:"quotes"}]', [{* Kategorie oder Ausführung *}]
[{*'category': '[{$oOrderArticle->oxorderarticles__oxselvariant->value}]', [{* Kategorie oder Ausführung *}]
'price': '[{$sPrice}]', [{* Preis pro Einheit *}]
'quantity': '[{$oOrderArticle->oxorderarticles__oxamount->value}]' [{* Menge *}]
});
[{/block}]
[{/foreach}]
ga('ecommerce:send');
[{/block}]
[{/strip}][{/if}]