Compare commits

...

8 Commits
1.1 ... 2.0

4 changed files with 37 additions and 29 deletions

View File

@ -1,35 +1,37 @@
[{$smarty.block.parent}]
[{assign var="gtmProduct" value=$oView->getProduct()}]
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
<script>
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
[{if $gtmProduct}]
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
<script>
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
'event': 'ee.impression',
'eventLabel':'Impression',
'ecommerce': {
'currencyCode': '[{$currency->name}]',
'impressions': [
{
'name': '[{$gtmProduct->oxarticles__oxtitle->value}]',
'id': '[{$gtmProduct->oxarticles__oxartnum->value}]',
'price': [{$gtmProduct->oxarticles__oxprice->value}],
'brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
'variant': '[{if $gtmProduct->oxarticles__oxvarselect->value}][{$gtmProduct->oxarticles__oxvarselect->value}][{/if}]'
[{if $list && $position}],
'list': '[{$list}]',
'position': [{"_"|str_replace:"":$position}]
[{/if}]
}
]
'currencyCode': '[{$currency->name}]',
'impressions': [
{
'name': '[{$gtmProduct->getFieldData('oxtitle')}]',
'id': '[{$gtmProduct->getFieldData('oxartnum')}]',
'price': [{$gtmProduct->getFieldData('oxprice')}],
'brand': '[{if $gtmManufacturer}][{$gtmManufacturer->getFieldData('oxtitle')}][{/if}]',
'category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
'variant': '[{if $gtmProduct->getFieldData('oxvarselect')}][{$gtmProduct->getFieldData('oxvarselect')}][{/if}]'
[{if $list && $position}],
'list': '[{$list}]',
'position': [{"_"|str_replace:"":$position}]
[{/if}]
}
]
}
});
</script>
});
</script>
<!--
sWidgetType [{$sWidgetType}] | [{$oView->getViewParameter('sWidgetType')}]
sListType [{$sListType}] | [{$oView->getViewParameter('sListType')}]
iIndex [{$iIndex}] | [{$oView->getIndex()}]
iIndex [{$iIndex}] | [{$oView->getViewParameter('iIndex')}]
listId [{$listId}] | [{$oView->getViewParameter('listId')}]
testid [{$testid}] | [{$oView->getViewParameter('testid')}]
-->
-->
[{/if}]

View File

@ -30,7 +30,10 @@ class ViewConfig extends ViewConfig_parent
{
if ($this->sContainerId === null)
{
$this->sContainerId = $this->getConfig()->getConfigParam('vt_gtm_sContainerID');
$this->sContainerId = ContainerFactory::getInstance()
->getContainer()
->get(ModuleSettingBridgeInterface::class)
->get('vt_gtm_sContainerID', 'vt-gtm');
}
return $this->sContainerId;
}
@ -41,7 +44,10 @@ class ViewConfig extends ViewConfig_parent
{
if ($this->blGA4enabled === null)
{
$this->sContainerId = $this->getConfig()->getConfigParam('vt_gtm_blEnableGA4');
$this->sContainerId = ContainerFactory::getInstance()
->getContainer()
->get(ModuleSettingBridgeInterface::class)
->get('vt_gtm_blEnableGA4', 'vt-gtm');
}
return $this->blGA4enabled;
@ -81,7 +87,7 @@ class ViewConfig extends ViewConfig_parent
//'httpref' => $_SERVER["HTTP_REFERER"] ?? "unknown"
];
#return json_encode([$dataLayer], JSON_PRETTY_PRINT);
return json_encode([$dataLayer], JSON_PRETTY_PRINT);
unset($dataLayer["user"]["http"]); // das brauchen wir hier nicht

View File

@ -45,7 +45,7 @@
},
"require": {
"php": ">=7.1",
"oxid-esales/oxideshop-ce": "v6.0 - 6.3",
"oxid-esales/oxideshop-ce": "^6.5",
"google/apiclient":" ^2.0"
},
"autoload": {

View File

@ -19,7 +19,7 @@ $aModule = [
Die Entwicklung basiert auf einem Fork von Marat Bedoev - <a href='https://github.com/vanilla-thunder/oxid-module-gtm'>Github-Link</a>
",
'thumbnail' => 'thumbnail.png',
'version' => '1.0.0.0',
'version' => '2.0.0.0',
'author' => 'Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',
'url' => 'https://www.oxidmodule.com/',