8
0

initial for gtag

Dieser Commit ist enthalten in:
Daniel Seifert 2019-09-17 23:32:42 +02:00 committet von Daniel Seifert
Ursprung d6f6a7652b
Commit cda9a8bd4b
4 geänderte Dateien mit 158 neuen und 103 gelöschten Zeilen

Datei anzeigen

@ -1,8 +1,10 @@
<?php
use Doctrine\DBAL\DBALException;
use OxidEsales\Eshop\Application\Controller\FrontendController;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
use OxidEsales\Eshop\Core\Registry;
/**
* This module is free software: you can redistribute it and/or modify
@ -51,10 +53,20 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
$oSet = d3_cfg_mod::get($this->_d3getModId());
if ($oSet->isActive()) {
/** @var $oParentView oxView */
/** @var $oParentView FrontendController */
$oParentView = $this->getParent();
$oParentView->addTplParam('blD3GoogleAnalyticsActive', $oSet->isActive());
$oParentView->addTplParam('oD3GASettings', $oSet);
$oParentView->addTplParam('oD3GAActCurrency', Registry::getConfig()->getActShopCurrencyObject());
$oParentView->addTplParam('sD3GAPageLocation', $oParentView->getBaseLink());
$oParentView->addTplParam('sD3GAPagePath', str_replace(Registry::getConfig()->getShopUrl(), '', $oParentView->getBaseLink()));
$oParentView->addTplParam('sD3GAPageTitle', $oParentView->getTitle());
if (Registry::getSession()->getUser() && ($sUserId = Registry::getSession()->getUser()->getId())) {
$oParentView->addTplParam('sD3GAUserId', md5($sUserId));
}
$oParentView->addTplParam('sD3GATTpl', $this->d3getGATTpl());
$oParentView->addTplParam('sD3GACreateParameter', $this->d3getCreateParameters());
$oParentView->addTplParam('sAFEGetMoreUrls', $this->afGetMoreUrls());

Datei anzeigen

@ -47,24 +47,9 @@ $aLang = array(
'einen Trackingcode in den Quelltext Ihrer Seite einzukopieren. Dies erledigt das vorliegende Modul für Sie. '.
'Die Einstellungen zum Trackingcode nehmen Sie ebenfalls hier vor.',
'D3_GOOGLEANALYTICS_MAIN_GATYPE' => 'TrackingCode-Typ',
'D3_GOOGLEANALYTICS_MAIN_GATYPE_UNIVERSAL' => 'Universal',
'D3_GOOGLEANALYTICS_MAIN_GATYPE_UNIVERSAL_DESC' => 'F&uuml;r den Wechsel auf den Universal-'.
'Analytics-Trackingcode sind vorab &Auml;nderungen in Ihrem Analytics-Konto durchzuf&uuml;hren. Bitte '.
'konsultieren Sie vorab den Analytics-Migrationsleitfaden. Den Link finden Sie im Erkl&auml;rungstext '.
'dieser Option.\\n\\nBitte beachten Sie, dass mit Wechsel des Trackingcodes m&ouml;glicherweise andere '.
'Optionen im Modul verf&uuml;gbar sind. Kontrollieren Sie diese bitte noch einmal.',
'D3_GOOGLEANALYTICS_MAIN_GATYPE_ASYNC' => 'asynchron',
'D3_GOOGLEANALYTICS_MAIN_GATYPE_ASYNC_DESC' => 'Ein Wechsel vom neuen Universal-Analytics-'.
'Trackingcode zum bisherigen asynchronen Trackingcode wird von Google nicht angeboten. &Auml;ndern Sie diese '.
'Einstellung nur, wenn Ihr Analytics-Account noch auf dem asynchronen Trackingcode basiert.\\n\\nBitte '.
'beachten Sie, dass mit Wechsel des Trackingcodes m&ouml;glicherweise andere Optionen im Modul verf&uuml;gbar '.
'sind. Kontrollieren Sie diese bitte noch einmal.',
'D3_GOOGLEANALYTICS_MAIN_GATYPE_GTAG' => 'gtag (nicht Google Tag Manager)',
'D3_GOOGLEANALYTICS_MAIN_GATYPE_DESC' => 'Aktuell priorisiert Google den Trackingtyp '.
'"Universal". Setzen Sie hier den Typ, den Sie in Ihrem Analytics-Konto auch verwenden. Nutzen Sie noch den '.
'asynchronen Trackingcode, lesen Sie vor der Umstellung den <a href="'.
'https://support.google.com/analytics/answer/3450662?hl=de" target="gahelp">Leitfaden</a> zum Wechsel.<br><br>'.
'Manche der folgenden Optionen stehen Ihnen nur f&uuml;r einen Tracking-Typ zur Verf&uuml;gung und sind daher '.
'm&ouml;glicherweise ausgegraut.',
'"gtag". Für frühere Trackingtypen verwenden Sie bitte die entsprechenden Versionen unseres Moduls.',
'D3_GOOGLEANALYTICS_MAIN_GAID' => 'Analyics-ID',
'D3_GOOGLEANALYTICS_MAIN_GAID_DESC' => 'F&uuml;gen Sie hier die Google Analytics '.
'Konto-ID ein. Diese finden Sie in Ihrem GA-Konto und beginnt im Normalfall mit "UA-".',

Datei anzeigen

@ -115,6 +115,95 @@
</span>
[{else}]
<div class="servicedesc">[{oxmultilang ident="D3_GOOGLEANALYTICS_DESC"}] [{oxinputhelp ident="D3_GOOGLEANALYTICS_DESC1"}]</div>
<div class="groupExp">
<div class="">
<a class="rc" onclick="_groupExp(this); return false;" href="#">
<span style="font-weight: bold;">
[{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN"}]
</span>
</a>
<dl>
<dt style="height: 25px;">
<label for="sD3GAType">[{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_GATYPE"}]</label>
</dt>
<dd>
<input type="radio" name="value[sD3GAType]" value="gtag" checked> [{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_GATYPE_GTAG"}]
[{oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_GATYPE_DESC"}]
</dd>
</dl>
<dl>
<dt>
<label for="sD3GAId">[{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_GAID"}]</label>
</dt>
<dd>
<input id="sD3GAId" class="edittext ext_edittext" type="text" size="15" maxlength="20" value="[{$edit->getValue('sD3GAId')}]" name="value[sD3GAId]">
[{oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_GAID_DESC"}]
</dd>
</dl>
<dl>
<dt>
<label for="blD3GAAnonymizeIP">[{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_ANONYMIZEIP"}]</label>
</dt>
<dd>
<input type="hidden" name="value[blD3GAAnonymizeIP]" value="0">
<input id="blD3GAAnonymizeIP" class="edittext ext_edittext" type="checkbox" value="1" [{if $edit->getValue('blD3GAAnonymizeIP')}]checked[{/if}] name="value[blD3GAAnonymizeIP]">
[{oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_ANONYMIZEIP_DESC"}]
</dd>
</dl>
<dl>
<dt>
<label for="blD3GAUseOptOut">[{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_USEOPTOUT"}]</label>
</dt>
<dd>
<input type="hidden" name="value[blD3GAUseOptOut]" value="0">
<input id="blD3GAUseOptOut" class="edittext ext_edittext" type="checkbox" value="1" [{if $edit->getValue('blD3GAUseOptOut')}]checked[{/if}] name="value[blD3GAUseOptOut]">
[{oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_USEOPTOUT_DESC"}]
</dd>
</dl>
</div>
</div>
<div class="groupExp">
<div class="">
<a class="rc" onclick="_groupExp(this); return false;" href="#">
<span style="font-weight: bold;">
[{oxmultilang ident="D3_GOOGLEANALYTICS_COOKIE"}]
</span>
</a>
<dl>
<dt>
<label for="sD3GACookiePrefix">[{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_COOKIEPREFIX"}]</label>
</dt>
<dd>
<input id="sD3GACookiePrefix" class="edittext ext_edittext" type="text" size="15" maxlength="20" value="[{$edit->getValue('sD3GACookiePrefix')}]" name="value[sD3GACookiePrefix]">
[{oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_COOKIEPREFIX_DESC"}]
</dd>
</dl>
<dl>
<dt>
<label for="sD3GACookieDomain">[{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_COOKIEDOMAIN"}]</label>
</dt>
<dd>
<input id="sD3GACookieDomain" class="edittext ext_edittext" type="text" size="15" maxlength="20" value="[{$edit->getValue('sD3GACookieDomain')}]" name="value[sD3GACookieDomain]">
[{oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_COOKIEDOMAIN_DESC"}]
</dd>
</dl>
<dl>
<dt>
<label for="sD3GACookieExpiration">[{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_COOKIEEXPIRATION"}]</label>
</dt>
<dd>
<input id="sD3GACookieExpiration" class="edittext ext_edittext" type="text" size="15" maxlength="20" value="[{$edit->getValue('sD3GACookieExpiration')}]" name="value[sD3GACookieExpiration]"> in Sekunden
[{oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_COOKIEEXPIRATION_DESC"}]
</dd>
</dl>
</div>
</div>
[{*--------------------------------------*}]
[{if $oView->getGaType() == 'universal'}]
[{assign var="blUniversalDisabled" value="disabled readonly"}]
[{assign var="blAsyncDisabled" value=""}]
@ -137,38 +226,6 @@
[{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN"}]
</span>
</a>
<dl>
<dt style="height: 25px;">
<label for="sD3GAType">[{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_GATYPE"}]</label>
</dt>
<dd>
<input type="radio" name="value[sD3GAType]" value="gtag" [{if $oView->getGaType() == 'gtag'}]checked[{/if}]> [{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_GATYPE_GTAG"}]<br>
<input type="radio" name="value[sD3GAType]" value="universal" [{if $oView->getGaType() == 'universal'}]checked[{/if}] onclick="alert('[{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_GATYPE_UNIVERSAL_DESC"}]');"> [{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_GATYPE_UNIVERSAL"}]<br>
<input type="radio" name="value[sD3GAType]" value="async" [{if $oView->getGaType() == 'async'}]checked[{/if}] onclick="alert('[{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_GATYPE_ASYNC_DESC"}]');"> [{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_GATYPE_ASYNC"}]
[{oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_GATYPE_DESC"}]
</dd>
</dl>
<dl>
<dt>
<label for="sD3GAId">[{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_GAID"}]</label>
[{* _gaq.push(['_setAccount', 'UA_XXX']); *}]
</dt>
<dd>
<input id="sD3GAId" class="edittext ext_edittext" type="text" size="15" maxlength="20" value="[{$edit->getValue('sD3GAId')}]" name="value[sD3GAId]">
[{oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_GAID_DESC"}]
</dd>
</dl>
<dl>
<dt>
<label for="blD3GAAnonymizeIP">[{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_ANONYMIZEIP"}]</label>
[{* _gaq.push(['_gat._anonymizeIp']); *}]
</dt>
<dd>
<input type="hidden" name="value[blD3GAAnonymizeIP]" value="0">
<input id="blD3GAAnonymizeIP" class="edittext ext_edittext" type="checkbox" value="1" [{if $edit->getValue('blD3GAAnonymizeIP')}]checked[{/if}] name="value[blD3GAAnonymizeIP]">
[{oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_ANONYMIZEIP_DESC"}]
</dd>
</dl>
<dl>
<dt>
<label for="blD3GASampleRate">[{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_SAMPLERATE"}]</label>
@ -212,16 +269,6 @@
[{oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_USEREMARKETING_DESC"}]
</dd>
</dl>
<dl>
<dt>
<label for="blD3GAUseOptOut">[{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_USEOPTOUT"}]</label>
</dt>
<dd>
<input type="hidden" name="value[blD3GAUseOptOut]" value="0">
<input id="blD3GAUseOptOut" class="edittext ext_edittext" type="checkbox" value="1" [{if $edit->getValue('blD3GAUseOptOut')}]checked[{/if}] name="value[blD3GAUseOptOut]">
[{oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_USEOPTOUT_DESC"}]
</dd>
</dl>
</div>
</div>

Datei anzeigen

@ -1,6 +1,6 @@
[{if $blD3GoogleAnalyticsActive && $oD3GASettings->getValue('sD3GAId')}]
[{capture name="d3GATrackCode"}]
[{strip}]
[{*strip*}]
[{if $oD3GASettings->getValue('blD3GAUseOptOut')}]
[{block name="d3ga_optoutscript"}]
<script type="text/javascript">
@ -18,62 +18,73 @@
[{/block}]
[{/if}]
## nach head ## https://developers.google.com/analytics/devguides/collection/gtagjs/
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/ *}]
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=[{$oD3GASettings->getValue('sD3GAId')}]"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
## https://developers.google.com/analytics/devguides/collection/gtagjs/setting-values
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/setting-values *}]
gtag('set', {
'currency': 'USD',
'country': 'US'
'currency': '[{$oD3GAActCurrency->name}]',
'country': 'US',
});
gtag(
'config', 'GA_MEASUREMENT_ID',
'config', '[{$oD3GASettings->getValue('sD3GAId')}]',
{
## https://developers.google.com/analytics/devguides/collection/gtagjs/pages
'page_title' : 'homepage',
'page_path': '/home',
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/pages *}]
'page_title' : '[{$sD3GAPageTitle}]',
'page_location' : '[{$sD3GAPageLocation}]',
'page_path': '/[{$sD3GAPagePath}]',
## https://developers.google.com/analytics/devguides/collection/gtagjs/cookies-user-id
'cookie_prefix': 'MyCookie',
'cookie_domain': 'blog.example.com',
'cookie_expires': 28 * 24 * 60 * 60 // 28 days, in seconds
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/cookies-user-id *}]
[{if $oD3GASettings->getValue('sD3GACookiePrefix')}]
'cookie_prefix': '[{$oD3GASettings->getValue('sD3GACookiePrefix')}]',
[{/if}]
[{if $oD3GASettings->getValue('sD3GACookieDomain')}]
'cookie_domain': '[{$oD3GASettings->getValue('sD3GACookieDomain')}]',
[{/if}]
[{if $oD3GASettings->getValue('sD3GACookieExpiration')}]
'cookie_expires': [{$oD3GASettings->getValue('sD3GACookieExpiration')}], // in seconds
[{/if}]
## https://developers.google.com/analytics/devguides/collection/gtagjs/cookies-user-id !!! Anonymize
'user_id': 'USER_ID'
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/cookies-user-id *}]
[{if $sD3GAUserId}]
'user_id': '[{$sD3GAUserId}]',
[{/if}]
## https://developers.google.com/analytics/devguides/collection/gtagjs/cross-domain
'linker': { 'domains': ['example-1.com', 'example-2.com'] }
## https://developers.google.com/analytics/devguides/collection/gtagjs/cross-domain
'linker': { 'accept_incoming': true }
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/cross-domain *}]
'linker': { 'domains': ['example-1.com', 'example-2.com'] },
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/cross-domain *}]
'linker': { 'accept_incoming': true },
## https://developers.google.com/analytics/devguides/collection/gtagjs/custom-dims-mets
## siehe auch Event
'custom_map': {'dimension2': 'age'}
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/custom-dims-mets
siehe auch Event *}]
'custom_map': {'dimension2': 'age'},
## https://developers.google.com/analytics/devguides/collection/gtagjs/ip-anonymization
'anonymize_ip': true
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/ip-anonymization *}]
[{if $oD3GASettings->getValue('blD3GAAnonymizeIP')}]
'anonymize_ip': true,
[{/if}]
}
);
## https://developers.google.com/analytics/devguides/collection/gtagjs/
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/ *}]
gtag('config', 'GA_MEASUREMENT_ID_2');
## https://developers.google.com/gtagjs/devguide/snippet
[{* https://developers.google.com/gtagjs/devguide/snippet *}]
gtag('config', 'AW-CONVERSION_ID');
## https://developers.google.com/gtagjs/devguide/snippet
[{* https://developers.google.com/gtagjs/devguide/snippet *}]
gtag('config', 'DC-FLOODLIGHT_ID');
## https://developers.google.com/analytics/devguides/collection/gtagjs/events
gtag('event', <action>, { 'event_category': <category>, 'event_label': <label>, 'value': <value> });
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/events *}]
gtag('event', 'ACTION', { 'event_category': 'CATEGORY', 'event_label': 'LABEL', 'value': 'VALUE' });
## https://developers.google.com/analytics/devguides/collection/gtagjs/user-timings
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/user-timings *}]
// Feature detects Navigation Timing API support.
if (window.performance) {
// Gets the number of milliseconds since page load
@ -88,17 +99,17 @@
});
}
## https://developers.google.com/analytics/devguides/collection/gtagjs/exceptions
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/exceptions *}]
gtag('event', 'exception', {
'description': 'error_description',
'fatal': false // set to true if the error is fatal
});
## 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});
## https://developers.google.com/analytics/devguides/collection/gtagjs/ecommerce
## https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce
[{* 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",
@ -132,7 +143,7 @@
]
});
## https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
gtag('event', 'view_item_list', {
"items": [
{
@ -160,7 +171,7 @@
]
});
## https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
gtag('event', 'view_item', {
"items": [
{
@ -177,7 +188,7 @@
]
});
## https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
gtag('event', 'add_to_cart', {
"items": [
{
@ -194,7 +205,7 @@
]
});
## https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
gtag('event', 'remove_from_cart', {
"items": [
{
@ -211,7 +222,7 @@
]
});
## https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
gtag('event', 'begin_checkout', {
"items": [
{
@ -229,7 +240,7 @@
"coupon": ""
});
## https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
gtag('event', 'checkout_progress', {
"items": [
{
@ -247,7 +258,7 @@
"coupon": "SUMMER_DISCOUNT"
});
## https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce
[{* https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce *}]
gtag('event', 'set_checkout_option', {
"checkout_step": 1,
"checkout_option": "shipping method",
@ -343,7 +354,7 @@
[{/if}]
</script>
[{/strip}]
[{*/strip*}]
[{/capture}]
[{if $oViewConf->getActiveClassName() == 'thankyou'}]