fix remarketing tracking via Analytics

Cette révision appartient à :
Daniel Seifert 2017-03-09 08:30:51 +00:00
Parent 99c0927d5d
révision 294961da40
4 fichiers modifiés avec 43 ajouts et 11 suppressions

Voir le fichier

@ -10,19 +10,19 @@
[{assign var="iDimensionCount" value=0}]
[{if $oD3GASettings->getValue('blD3GAUseAnalyticsRemarketing')}]
[{* dimension 2 set payment type *}]
[{* dimension 1 set product ids *}]
[{assign var="iDimensionCount" value=$iDimensionCount+1}]
[{if $oViewConf->getActiveClassName() == 'thankyou'}]
[{if $sD3GARemarketingProdId2}]
ga(
'set',
'dimension[{$iDimensionCount}]',
[{$sD3GARemarketingProdId}]
[{$sD3GARemarketingProdId2}]
);
[{/if}]
[{* dimension 2 set payment type *}]
[{* dimension 2 set page type *}]
[{assign var="iDimensionCount" value=$iDimensionCount+1}]
[{if $oViewConf->getActiveClassName() == 'thankyou'}]
[{if $sD3GARemarketingPageType}]
ga(
'set',
'dimension[{$iDimensionCount}]',
@ -30,9 +30,9 @@
);
[{/if}]
[{* dimension 2 set payment type *}]
[{* dimension 3 set product total price *}]
[{assign var="iDimensionCount" value=$iDimensionCount+1}]
[{if $oViewConf->getActiveClassName() == 'thankyou'}]
[{if $sD3GARemarketingPrice}]
ga(
'set',
'dimension[{$iDimensionCount}]',

Voir le fichier

@ -32,6 +32,18 @@ class d3_google_remarketing_articlelister
return $this->_getProductList($aArticleList);
}
/**
* @param oxwArticleDetails $oView
*
* @return array
*/
public function getOxwarticledetailsProdList($oView)
{
$aArticleList = array();
$aArticleList[] = $oView->getProduct();
return $this->_getProductList($aArticleList);
}
/**
* @param alist $oView
*

Voir le fichier

@ -30,6 +30,18 @@ class d3_google_trustedstore_articlelister
return $this->_getProductList($aArticleList);
}
/**
* @param oxwArticleDetails $oView
*
* @return array
*/
public function getOxwarticledetailsProdList($oView)
{
$aArticleList = array();
$aArticleList[] = $oView->getProduct();
return $this->_getProductList($aArticleList);
}
/**
* @param alist $oView
*

Voir le fichier

@ -29,6 +29,7 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
'manufacturerlist' => 'category',
'vendorlist' => 'category',
'details' => 'product',
'oxwarticledetails' => 'product',
'basket' => 'cart',
'order' => 'purchase',
);
@ -67,6 +68,7 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
if ($oSet->getValue('blD3GASetRemarketing') || $oSet->getValue('blD3GAUseAnalyticsRemarketing')) {
$aInfos = $this->d3GetGAProdInfos();
$oParentView->addTplParam('sD3GARemarketingProdId', $this->d3GetGAProdIdList($aInfos['aArtIdList']));
$oParentView->addTplParam('sD3GARemarketingProdId2', $this->d3GetGAProdIdList($aInfos['aArtIdList'], false));
$oParentView->addTplParam(
'sD3GARemarketingPrice',
$aInfos['dPrice'] > 0 ? number_format($aInfos['dPrice'], 2, '.', ''): ''
@ -388,7 +390,9 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
if (method_exists($oArticleLister, $sMethodName)) {
stopProfile(__METHOD__);
return call_user_func(array($oArticleLister, $sMethodName), $oCurrentView);
$aRet = call_user_func(array($oArticleLister, $sMethodName), $oCurrentView);
stopProfile(__METHOD__);
return $aRet;
}
stopProfile(__METHOD__);
@ -401,12 +405,16 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
*
* @return string
*/
public function d3GetGAProdIdList($aArticleIds)
public function d3GetGAProdIdList($aArticleIds, $blFormatArray = true)
{
if (count($aArticleIds)) {
return "['".implode("', '", $aArticleIds)."']";
return $blFormatArray ?
"['".implode("', '", $aArticleIds)."']" :
"'".implode(", ", $aArticleIds)."'";
} else {
return "''";
return $blFormatArray ?
"''" :
false;
}
}