fix empty page title, extract ecommerce tracking
This commit is contained in:
parent
752a1f54ee
commit
05f679d17f
@ -1,9 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
|
||||||
|
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
||||||
|
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||||
use Doctrine\DBAL\DBALException;
|
use Doctrine\DBAL\DBALException;
|
||||||
use OxidEsales\Eshop\Application\Controller\FrontendController;
|
use OxidEsales\Eshop\Application\Controller\FrontendController;
|
||||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||||
|
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,12 +49,18 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return null
|
* @return null
|
||||||
|
* @throws DBALException
|
||||||
|
* @throws DatabaseConnectionException
|
||||||
|
* @throws DatabaseErrorException
|
||||||
|
* @throws d3ShopCompatibilityAdapterException
|
||||||
|
* @throws d3_cfg_mod_exception
|
||||||
|
* @throws StandardException
|
||||||
*/
|
*/
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
$ret = parent::render();
|
$ret = parent::render();
|
||||||
|
|
||||||
$oSet = \D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_d3getModId());
|
$oSet = d3_cfg_mod::get($this->_d3getModId());
|
||||||
|
|
||||||
if ($oSet->isActive()) {
|
if ($oSet->isActive()) {
|
||||||
/** @var $oParentView FrontendController */
|
/** @var $oParentView FrontendController */
|
||||||
@ -60,8 +70,10 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
|
|||||||
$oParentView->addTplParam('oD3GAActCurrency', Registry::getConfig()->getActShopCurrencyObject());
|
$oParentView->addTplParam('oD3GAActCurrency', Registry::getConfig()->getActShopCurrencyObject());
|
||||||
$oParentView->addTplParam('sD3GAPageLocation', $oParentView->getBaseLink());
|
$oParentView->addTplParam('sD3GAPageLocation', $oParentView->getBaseLink());
|
||||||
$oParentView->addTplParam('sD3GAPagePath', str_replace(Registry::getConfig()->getShopUrl(), '', $oParentView->getBaseLink()));
|
$oParentView->addTplParam('sD3GAPagePath', str_replace(Registry::getConfig()->getShopUrl(), '', $oParentView->getBaseLink()));
|
||||||
$oParentView->addTplParam('sD3GAPageTitle', $oParentView->getTitle());
|
// prevent overwriting with empty title from later loaded widgets
|
||||||
|
if ($oParentView->getTitle() && false == $oParentView->getViewDataElement('sD3GAPageTitle')) {
|
||||||
|
$oParentView->addTplParam('sD3GAPageTitle', $oParentView->getTitle());
|
||||||
|
}
|
||||||
if (Registry::getSession()->getUser() && ($sUserId = Registry::getSession()->getUser()->getId())) {
|
if (Registry::getSession()->getUser() && ($sUserId = Registry::getSession()->getUser()->getId())) {
|
||||||
$oParentView->addTplParam('sD3GAUserId', md5($sUserId));
|
$oParentView->addTplParam('sD3GAUserId', md5($sUserId));
|
||||||
}
|
}
|
||||||
@ -112,11 +124,11 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
|
|||||||
*/
|
*/
|
||||||
public function d3getGATTpl()
|
public function d3getGATTpl()
|
||||||
{
|
{
|
||||||
if (\D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'async') {
|
if (d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'async') {
|
||||||
return 'd3_googleanalytics.tpl';
|
return 'd3_googleanalytics.tpl';
|
||||||
} elseif (\D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'universaal') {
|
} elseif (d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'universaal') {
|
||||||
return 'd3ga_universal.tpl';
|
return 'd3ga_universal.tpl';
|
||||||
} elseif (\D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'gtag') {
|
} elseif (d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'gtag') {
|
||||||
return 'd3ga_gtag.tpl';
|
return 'd3ga_gtag.tpl';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,7 +138,7 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
|
|||||||
*/
|
*/
|
||||||
public function d3GetCreateCurrentShopUrl()
|
public function d3GetCreateCurrentShopUrl()
|
||||||
{
|
{
|
||||||
if (\D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('blD3GAAllowDomainLinker')) {
|
if (d3_cfg_mod::get($this->_sModId)->getValue('blD3GAAllowDomainLinker')) {
|
||||||
return 'auto';
|
return 'auto';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +158,7 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
|
|||||||
*/
|
*/
|
||||||
public function afGetMoreUrls()
|
public function afGetMoreUrls()
|
||||||
{
|
{
|
||||||
if (false == \D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('blD3GAAllowDomainLinker')) {
|
if (false == d3_cfg_mod::get($this->_sModId)->getValue('blD3GAAllowDomainLinker')) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,7 +256,7 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
|
|||||||
{
|
{
|
||||||
$aParameter = array();
|
$aParameter = array();
|
||||||
|
|
||||||
if (\D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'gtag') {
|
if (d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'gtag') {
|
||||||
$aParameter = $this->_d3getCreateAnonymizeIpParameter($aParameter);
|
$aParameter = $this->_d3getCreateAnonymizeIpParameter($aParameter);
|
||||||
|
|
||||||
/** @var oxUBase $oCurrentView */
|
/** @var oxUBase $oCurrentView */
|
||||||
@ -272,11 +284,11 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
|
|||||||
*/
|
*/
|
||||||
public function d3getSendPageViewParameters()
|
public function d3getSendPageViewParameters()
|
||||||
{
|
{
|
||||||
if (\D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'async') {
|
if (d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'async') {
|
||||||
return $this->_d3getAsyncSendpageViewParameters();
|
return $this->_d3getAsyncSendpageViewParameters();
|
||||||
} elseif (\D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'universal') {
|
} elseif (d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'universal') {
|
||||||
return $this->_d3getUniversalSendPageViewParameters();
|
return $this->_d3getUniversalSendPageViewParameters();
|
||||||
} elseif (\D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'gtag') {
|
} elseif (d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'gtag') {
|
||||||
return $this->_d3getGtagSendPageViewParameters();
|
return $this->_d3getGtagSendPageViewParameters();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -473,10 +485,10 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
|
|||||||
*/
|
*/
|
||||||
protected function _d3getCreateDomainNameParameter($aParameter)
|
protected function _d3getCreateDomainNameParameter($aParameter)
|
||||||
{
|
{
|
||||||
if (\D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetDomainName')) {
|
if (d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetDomainName')) {
|
||||||
$aParameter[] = "'cookieDomain': '" . \D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetDomainName') . "'";
|
$aParameter[] = "'cookieDomain': '" . d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetDomainName') . "'";
|
||||||
$aParameter[] = "'legacyCookieDomain': '" .
|
$aParameter[] = "'legacyCookieDomain': '" .
|
||||||
\D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetDomainName') . "'";
|
d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetDomainName') . "'";
|
||||||
|
|
||||||
return $aParameter;
|
return $aParameter;
|
||||||
}
|
}
|
||||||
@ -491,8 +503,8 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
|
|||||||
*/
|
*/
|
||||||
protected function _d3getCreateCookiePathParameter($aParameter)
|
protected function _d3getCreateCookiePathParameter($aParameter)
|
||||||
{
|
{
|
||||||
if (\D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetCookiePath')) {
|
if (d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetCookiePath')) {
|
||||||
$aParameter[] = "'cookiePath': '" . \D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetCookiePath') . "'";
|
$aParameter[] = "'cookiePath': '" . d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetCookiePath') . "'";
|
||||||
|
|
||||||
return $aParameter;
|
return $aParameter;
|
||||||
}
|
}
|
||||||
@ -507,7 +519,7 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
|
|||||||
*/
|
*/
|
||||||
protected function _d3getCreateDomainLinkerParameter($aParameter)
|
protected function _d3getCreateDomainLinkerParameter($aParameter)
|
||||||
{
|
{
|
||||||
if (\D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('blD3GAAllowDomainLinker')) {
|
if (d3_cfg_mod::get($this->_sModId)->getValue('blD3GAAllowDomainLinker')) {
|
||||||
$aParameter[] = "'allowLinker': true";
|
$aParameter[] = "'allowLinker': true";
|
||||||
|
|
||||||
return $aParameter;
|
return $aParameter;
|
||||||
@ -523,9 +535,9 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
|
|||||||
*/
|
*/
|
||||||
protected function _d3getCreateSpeedSamplerateParameter($aParameter)
|
protected function _d3getCreateSpeedSamplerateParameter($aParameter)
|
||||||
{
|
{
|
||||||
if (\D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('iD3GASiteSpeedSampleRate')) {
|
if (d3_cfg_mod::get($this->_sModId)->getValue('iD3GASiteSpeedSampleRate')) {
|
||||||
$aParameter[] = "'siteSpeedSampleRate': " .
|
$aParameter[] = "'siteSpeedSampleRate': " .
|
||||||
\D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('iD3GASiteSpeedSampleRate');
|
d3_cfg_mod::get($this->_sModId)->getValue('iD3GASiteSpeedSampleRate');
|
||||||
|
|
||||||
return $aParameter;
|
return $aParameter;
|
||||||
}
|
}
|
||||||
@ -540,8 +552,8 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
|
|||||||
*/
|
*/
|
||||||
protected function _d3getCreateSamplerateParameter($aParameter)
|
protected function _d3getCreateSamplerateParameter($aParameter)
|
||||||
{
|
{
|
||||||
if (\D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('iD3GASampleRate')) {
|
if (d3_cfg_mod::get($this->_sModId)->getValue('iD3GASampleRate')) {
|
||||||
$aParameter[] = "'sampleRate': " . \D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('iD3GASampleRate');
|
$aParameter[] = "'sampleRate': " . d3_cfg_mod::get($this->_sModId)->getValue('iD3GASampleRate');
|
||||||
|
|
||||||
return $aParameter;
|
return $aParameter;
|
||||||
}
|
}
|
||||||
@ -558,7 +570,7 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
|
|||||||
*/
|
*/
|
||||||
protected function _d3getCreateAnonymizeIpParameter($aParameter)
|
protected function _d3getCreateAnonymizeIpParameter($aParameter)
|
||||||
{
|
{
|
||||||
if (\D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('blD3GAAnonymizeIP')) {
|
if (d3_cfg_mod::get($this->_sModId)->getValue('blD3GAAnonymizeIP')) {
|
||||||
$aParameter[] = "'anonymize_ip': true'";
|
$aParameter[] = "'anonymize_ip': true'";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,7 +623,7 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
|
|||||||
*/
|
*/
|
||||||
protected function _d3getUniversalSendPageViewDebugParameter($aParameter)
|
protected function _d3getUniversalSendPageViewDebugParameter($aParameter)
|
||||||
{
|
{
|
||||||
if (\D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->hasDebugMode()) {
|
if (d3_cfg_mod::get($this->_sModId)->hasDebugMode()) {
|
||||||
$aParameter[] = "
|
$aParameter[] = "
|
||||||
'hitCallback': function() {
|
'hitCallback': function() {
|
||||||
alert('analytics.js done sending data');
|
alert('analytics.js done sending data');
|
||||||
@ -644,7 +656,7 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
|
|||||||
*/
|
*/
|
||||||
public function d3GetSendNoBounceEventTime()
|
public function d3GetSendNoBounceEventTime()
|
||||||
{
|
{
|
||||||
$iTime = \D3\ModCfg\Application\Model\Configuration\d3_cfg_mod::get($this->_sModId)->getValue('iSendNoBounceEventTime');
|
$iTime = d3_cfg_mod::get($this->_sModId)->getValue('iSendNoBounceEventTime');
|
||||||
|
|
||||||
if (isset($iTime) && is_int($iTime)) {
|
if (isset($iTime) && is_int($iTime)) {
|
||||||
return $iTime;
|
return $iTime;
|
||||||
|
@ -109,6 +109,7 @@
|
|||||||
}
|
}
|
||||||
[{/if}]
|
[{/if}]
|
||||||
|
|
||||||
|
[{* track page load time *}]
|
||||||
[{if $oD3GASettings->getValue('blD3GATrackPageLoadTime')}]
|
[{if $oD3GASettings->getValue('blD3GATrackPageLoadTime')}]
|
||||||
[{block name="d3ga_trackpageloadtime"}]
|
[{block name="d3ga_trackpageloadtime"}]
|
||||||
let perfData = window.performance.timing;
|
let perfData = window.performance.timing;
|
||||||
@ -125,8 +126,7 @@
|
|||||||
[{/block}]
|
[{/block}]
|
||||||
[{/if}]
|
[{/if}]
|
||||||
|
|
||||||
|
[{* bounce optimization *}]
|
||||||
[{* bounce optimization*}]
|
|
||||||
[{block name="d3ga_bounceoptimization"}]
|
[{block name="d3ga_bounceoptimization"}]
|
||||||
[{if $oD3GASettings->getValue('blUseBounceRateOptimization')}]
|
[{if $oD3GASettings->getValue('blUseBounceRateOptimization')}]
|
||||||
setTimeout("gtag('event', 'NoBounce', {" +
|
setTimeout("gtag('event', 'NoBounce', {" +
|
||||||
@ -151,6 +151,8 @@
|
|||||||
[{/if}]
|
[{/if}]
|
||||||
[{/block}]
|
[{/block}]
|
||||||
|
|
||||||
|
[{include file="d3ga_gtag_ecommerce.tpl"}]
|
||||||
|
|
||||||
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/events *}]
|
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/events *}]
|
||||||
[{* login, logout, toBasket, fromBasket, sendContact *}]
|
[{* login, logout, toBasket, fromBasket, sendContact *}]
|
||||||
gtag('event', 'ACTION', { 'event_category': 'CATEGORY', 'event_label': 'LABEL', 'value': 'VALUE' });
|
gtag('event', 'ACTION', { 'event_category': 'CATEGORY', 'event_label': 'LABEL', 'value': 'VALUE' });
|
||||||
@ -159,164 +161,6 @@ gtag('event', 'ACTION', { 'event_category': 'CATEGORY', 'event_label': 'LABEL',
|
|||||||
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/custom-dims-mets *}]
|
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/custom-dims-mets *}]
|
||||||
gtag ('event', 'age_dimension', {'age': 12});
|
gtag ('event', 'age_dimension', {'age': 12});
|
||||||
|
|
||||||
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/ecommerce *}]
|
|
||||||
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
|
|
||||||
gtag('event', 'purchase', {
|
|
||||||
"transaction_id": "24.031608523954162",
|
|
||||||
"affiliation": "Google online store",
|
|
||||||
"value": 23.07,
|
|
||||||
"currency": "USD",
|
|
||||||
"tax": 1.24,
|
|
||||||
"shipping": 0,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"id": "P12345",
|
|
||||||
"name": "Android Warhol T-Shirt",
|
|
||||||
"list_name": "Search Results",
|
|
||||||
"brand": "Google",
|
|
||||||
"category": "Apparel/T-Shirts",
|
|
||||||
"variant": "Black",
|
|
||||||
"list_position": 1,
|
|
||||||
"quantity": 2,
|
|
||||||
"price": '2.0'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "P67890",
|
|
||||||
"name": "Flame challenge TShirt",
|
|
||||||
"list_name": "Search Results",
|
|
||||||
"brand": "MyBrand",
|
|
||||||
"category": "Apparel/T-Shirts",
|
|
||||||
"variant": "Red",
|
|
||||||
"list_position": 2,
|
|
||||||
"quantity": 1,
|
|
||||||
"price": '3.0'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
|
|
||||||
gtag('event', 'view_item_list', {
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"id": "P12345",
|
|
||||||
"name": "Android Warhol T-Shirt",
|
|
||||||
"list_name": "Search Results",
|
|
||||||
"brand": "Google",
|
|
||||||
"category": "Apparel/T-Shirts",
|
|
||||||
"variant": "Black",
|
|
||||||
"list_position": 1,
|
|
||||||
"quantity": 2,
|
|
||||||
"price": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "P67890",
|
|
||||||
"name": "Flame challenge TShirt",
|
|
||||||
"list_name": "Search Results",
|
|
||||||
"brand": "MyBrand",
|
|
||||||
"category": "Apparel/T-Shirts",
|
|
||||||
"variant": "Red",
|
|
||||||
"list_position": 2,
|
|
||||||
"quantity": 1,
|
|
||||||
"price": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
|
|
||||||
gtag('event', 'view_item', {
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"id": "P12345",
|
|
||||||
"name": "Android Warhol T-Shirt",
|
|
||||||
"list_name": "Search Results",
|
|
||||||
"brand": "Google",
|
|
||||||
"category": "Apparel/T-Shirts",
|
|
||||||
"variant": "Black",
|
|
||||||
"list_position": 1,
|
|
||||||
"quantity": 2,
|
|
||||||
"price": '2.0'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
|
|
||||||
gtag('event', 'add_to_cart', {
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"id": "P12345",
|
|
||||||
"name": "Android Warhol T-Shirt",
|
|
||||||
"list_name": "Search Results",
|
|
||||||
"brand": "Google",
|
|
||||||
"category": "Apparel/T-Shirts",
|
|
||||||
"variant": "Black",
|
|
||||||
"list_position": 1,
|
|
||||||
"quantity": 2,
|
|
||||||
"price": '2.0'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
|
|
||||||
gtag('event', 'remove_from_cart', {
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"id": "P12345",
|
|
||||||
"name": "Android Warhol T-Shirt",
|
|
||||||
"list_name": "Search Results",
|
|
||||||
"brand": "Google",
|
|
||||||
"category": "Apparel/T-Shirts",
|
|
||||||
"variant": "Black",
|
|
||||||
"list_position": 1,
|
|
||||||
"quantity": 2,
|
|
||||||
"price": '2.0'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
|
|
||||||
gtag('event', 'begin_checkout', {
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"id": "P12345",
|
|
||||||
"name": "Android Warhol T-Shirt",
|
|
||||||
"list_name": "Search Results",
|
|
||||||
"brand": "Google",
|
|
||||||
"category": "Apparel/T-Shirts",
|
|
||||||
"variant": "Black",
|
|
||||||
"list_position": 1,
|
|
||||||
"quantity": 2,
|
|
||||||
"price": '2.0'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"coupon": ""
|
|
||||||
});
|
|
||||||
|
|
||||||
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
|
|
||||||
gtag('event', 'checkout_progress', {
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"id": "P12345",
|
|
||||||
"name": "Android Warhol T-Shirt",
|
|
||||||
"list_name": "Search Results",
|
|
||||||
"brand": "Google",
|
|
||||||
"category": "Apparel/T-Shirts",
|
|
||||||
"variant": "Black",
|
|
||||||
"list_position": 1,
|
|
||||||
"quantity": 2,
|
|
||||||
"price": '2.0'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"coupon": "SUMMER_DISCOUNT"
|
|
||||||
});
|
|
||||||
|
|
||||||
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
|
|
||||||
gtag('event', 'set_checkout_option', {
|
|
||||||
"checkout_step": 1,
|
|
||||||
"checkout_option": "shipping method",
|
|
||||||
"value": "USPS"
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
@ -342,8 +186,6 @@ gtag('event', 'ACTION', { 'event_category': 'CATEGORY', 'event_label': 'LABEL',
|
|||||||
[{include file="d3ga_universal_adwords.tpl"}]
|
[{include file="d3ga_universal_adwords.tpl"}]
|
||||||
|
|
||||||
[{include file="d3ga_universal_custom.tpl"}]
|
[{include file="d3ga_universal_custom.tpl"}]
|
||||||
|
|
||||||
[{*[{include file="d3ga_universal_ecommerce.tpl"}]*}]
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
[{*/strip*}]
|
[{*/strip*}]
|
||||||
|
@ -1,3 +1,164 @@
|
|||||||
|
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/ecommerce *}]
|
||||||
|
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
|
||||||
|
gtag('event', 'purchase', {
|
||||||
|
"transaction_id": "24.031608523954162",
|
||||||
|
"affiliation": "Google online store",
|
||||||
|
"value": 23.07,
|
||||||
|
"currency": "USD",
|
||||||
|
"tax": 1.24,
|
||||||
|
"shipping": 0,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"id": "P12345",
|
||||||
|
"name": "Android Warhol T-Shirt",
|
||||||
|
"list_name": "Search Results",
|
||||||
|
"brand": "Google",
|
||||||
|
"category": "Apparel/T-Shirts",
|
||||||
|
"variant": "Black",
|
||||||
|
"list_position": 1,
|
||||||
|
"quantity": 2,
|
||||||
|
"price": '2.0'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "P67890",
|
||||||
|
"name": "Flame challenge TShirt",
|
||||||
|
"list_name": "Search Results",
|
||||||
|
"brand": "MyBrand",
|
||||||
|
"category": "Apparel/T-Shirts",
|
||||||
|
"variant": "Red",
|
||||||
|
"list_position": 2,
|
||||||
|
"quantity": 1,
|
||||||
|
"price": '3.0'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
|
||||||
|
gtag('event', 'view_item_list', {
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"id": "P12345",
|
||||||
|
"name": "Android Warhol T-Shirt",
|
||||||
|
"list_name": "Search Results",
|
||||||
|
"brand": "Google",
|
||||||
|
"category": "Apparel/T-Shirts",
|
||||||
|
"variant": "Black",
|
||||||
|
"list_position": 1,
|
||||||
|
"quantity": 2,
|
||||||
|
"price": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "P67890",
|
||||||
|
"name": "Flame challenge TShirt",
|
||||||
|
"list_name": "Search Results",
|
||||||
|
"brand": "MyBrand",
|
||||||
|
"category": "Apparel/T-Shirts",
|
||||||
|
"variant": "Red",
|
||||||
|
"list_position": 2,
|
||||||
|
"quantity": 1,
|
||||||
|
"price": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
|
||||||
|
gtag('event', 'view_item', {
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"id": "P12345",
|
||||||
|
"name": "Android Warhol T-Shirt",
|
||||||
|
"list_name": "Search Results",
|
||||||
|
"brand": "Google",
|
||||||
|
"category": "Apparel/T-Shirts",
|
||||||
|
"variant": "Black",
|
||||||
|
"list_position": 1,
|
||||||
|
"quantity": 2,
|
||||||
|
"price": '2.0'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
|
||||||
|
gtag('event', 'add_to_cart', {
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"id": "P12345",
|
||||||
|
"name": "Android Warhol T-Shirt",
|
||||||
|
"list_name": "Search Results",
|
||||||
|
"brand": "Google",
|
||||||
|
"category": "Apparel/T-Shirts",
|
||||||
|
"variant": "Black",
|
||||||
|
"list_position": 1,
|
||||||
|
"quantity": 2,
|
||||||
|
"price": '2.0'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
|
||||||
|
gtag('event', 'remove_from_cart', {
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"id": "P12345",
|
||||||
|
"name": "Android Warhol T-Shirt",
|
||||||
|
"list_name": "Search Results",
|
||||||
|
"brand": "Google",
|
||||||
|
"category": "Apparel/T-Shirts",
|
||||||
|
"variant": "Black",
|
||||||
|
"list_position": 1,
|
||||||
|
"quantity": 2,
|
||||||
|
"price": '2.0'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
|
||||||
|
gtag('event', 'begin_checkout', {
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"id": "P12345",
|
||||||
|
"name": "Android Warhol T-Shirt",
|
||||||
|
"list_name": "Search Results",
|
||||||
|
"brand": "Google",
|
||||||
|
"category": "Apparel/T-Shirts",
|
||||||
|
"variant": "Black",
|
||||||
|
"list_position": 1,
|
||||||
|
"quantity": 2,
|
||||||
|
"price": '2.0'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"coupon": ""
|
||||||
|
});
|
||||||
|
|
||||||
|
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
|
||||||
|
gtag('event', 'checkout_progress', {
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"id": "P12345",
|
||||||
|
"name": "Android Warhol T-Shirt",
|
||||||
|
"list_name": "Search Results",
|
||||||
|
"brand": "Google",
|
||||||
|
"category": "Apparel/T-Shirts",
|
||||||
|
"variant": "Black",
|
||||||
|
"list_position": 1,
|
||||||
|
"quantity": 2,
|
||||||
|
"price": '2.0'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"coupon": "SUMMER_DISCOUNT"
|
||||||
|
});
|
||||||
|
|
||||||
|
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
|
||||||
|
gtag('event', 'set_checkout_option', {
|
||||||
|
"checkout_step": 1,
|
||||||
|
"checkout_option": "shipping method",
|
||||||
|
"value": "USPS"
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
[{* ============================================================ *}]
|
||||||
|
|
||||||
|
|
||||||
[{if $oD3GASettings->getValue('blD3GASendECommerce') && $oViewConf->getActiveClassName() == 'thankyou'}][{strip}]
|
[{if $oD3GASettings->getValue('blD3GASendECommerce') && $oViewConf->getActiveClassName() == 'thankyou'}][{strip}]
|
||||||
[{block name="UniversalEcommerceOrder"}]
|
[{block name="UniversalEcommerceOrder"}]
|
||||||
[{assign var="order" value=$oView->getOrder()}]
|
[{assign var="order" value=$oView->getOrder()}]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user