basic implementation

This commit is contained in:
Daniel Seifert 2011-02-27 20:21:16 +00:00
parent c02049bf20
commit 07f11b2920
10 changed files with 273 additions and 57 deletions

1
.gitattributes vendored
View File

@ -155,6 +155,7 @@ changed_full/440-447/out/basic/tpl/inc/d3GoogleAnalytics.tpl -text
changed_full/440-447/out/basic/tpl/inc/popup_basket.tpl -text changed_full/440-447/out/basic/tpl/inc/popup_basket.tpl -text
changed_full/440-447/out/basic/tpl/user.tpl -text changed_full/440-447/out/basic/tpl/user.tpl -text
copy_this/admin/d3_cfg_googleanalytics.php -text copy_this/admin/d3_cfg_googleanalytics.php -text
copy_this/admin/d3_cfg_googleanalytics_adwords.php -text
copy_this/admin/d3_cfg_googleanalytics_licence.php -text copy_this/admin/d3_cfg_googleanalytics_licence.php -text
copy_this/admin/d3_cfg_googleanalytics_list.php -text copy_this/admin/d3_cfg_googleanalytics_list.php -text
copy_this/admin/d3_cfg_googleanalytics_main.php -text copy_this/admin/d3_cfg_googleanalytics_main.php -text

View File

@ -9,13 +9,35 @@ $iLangNr = 0;
$aLang = array( $aLang = array(
//Navigation //Navigation
'charset' => 'ISO-8859-15', 'charset' => 'ISO-8859-15',
'd3mxd3modules' => 'D³ Module', 'd3mxd3modules' => 'D³ Module',
'd3mxgoogleanalytics' => 'Google Analytics', 'd3mxgoogleanalytics' => 'Google Analytics',
'd3mxgoogleanalytics_settings' => 'Einstellungen', 'd3mxgoogleanalytics_settings' => 'Einstellungen',
'd3tbclgoogleanalytics_main' => 'Stamm', 'd3tbclgoogleanalytics_main' => 'Analytics',
'd3tbclgoogleanalytics_adwords' => 'AdWords',
'D3_GOOGLEANALYTICS_CFG_TITLE' => 'Google Analytics Schnittstelle - Einstellungen',
'D3_GOOGLEANALYTICS_MAIN' => 'Grundeinstellungen',
'D3_GOOGLEANALYTICS_MAIN_GAID' => 'Account ID',
'D3_GOOGLEANALYTICS_MAIN_ANONYMIZEIP' => 'IP-Adressen anonymisiert übertragen (empfohlen)',
'D3_GOOGLEANALYTICS_ECOMMERCE' => 'eCommerce-Einstellungen',
'D3_GOOGLEANALYTICS_ECOMMERCE_SENDDATA' => 'eCommerce-Daten übertragen',
'D3_GOOGLEANALYTICS_DOMAIN' => 'Multi-Domain-Einstellungen',
'D3_GOOGLEANALYTICS_DOMAIN_ALLOWXDOMAIN' => 'Trackingdaten von unterschiedlichen Domains verwenden',
'D3_GOOGLEANALYTICS_DOMAIN_XDOMAIN' => 'zu verwendende Domains',
'D3_GOOGLEANALYTICS_DOMAIN_COOKIEPATH' => 'nur folgendes Verzeichnis tracken',
'D3_GOOGLEANALYTICS_BROWSER' => 'Browser-Daten übertragen',
'D3_GOOGLEANALYTICS_ADWORDSCODE_GENERAL' => 'Kampagnendaten übertragen',
'D3_GOOGLEANALYTICS_ADWORDSMAIN_CAMPAIGNTIMEOUT' => 'Kampagnenlaufzeit',
'D3_GOOGLEANALYTICS_ADWORDSMAIN_CUSTCAMPAIGNFIELDS' => 'benutzerdefinierte Kampagnenfelder',
'D3_GOOGLEANALYTICS_CFG_TITLE' => 'Google Analytics Schnittstelle - Einstellungen',
); );

View File

@ -89,6 +89,8 @@ dl dt{
td.edittext { td.edittext {
white-space: normal; white-space: normal;
} }
div.box{background: white url([{$oView->getBGLogoUrl()}]) no-repeat bottom right;}
--> -->
</style> </style>
@ -184,32 +186,162 @@ td.edittext {
<div class=""> <div class="">
<a class="rc" onclick="_groupExp(this); return false;" href="#"> <a class="rc" onclick="_groupExp(this); return false;" href="#">
<b> <b>
[{oxmultilang ident="D3_MULTIVAR_MAIN"}] [{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN"}]
</b> </b>
</a> </a>
<dl> <dl>
<dt> <dt>
[{oxmultilang ident="D3_MULTIVAR_MAIN_USEAJAX"}] [{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_GAID"}]
[{* _gaq.push(['_setAccount', 'UA_XXX']); *}]
</dt> </dt>
<dd> <dd>
<input type="hidden" name="value[d3_cfg_mod__blMultiVariants_useAjax]" value="0"> <input class="edittext ext_edittext" type="text" size="15" maxlength="20" value="[{$value->d3_cfg_mod__sD3GAId}]" name="value[d3_cfg_mod__sD3GAId]">
<input class="edittext ext_edittext" type="checkbox" value="1" name="value[d3_cfg_mod__blMultiVariants_useAjax]" [{if $value->d3_cfg_mod__blMultiVariants_useAjax == 1}]checked[{/if}]> [{ oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_GAID_DESC" }]
[{ oxinputhelp ident="D3_MULTIVAR_MAIN_USEAJAX_DESC" }]
</dd> </dd>
<div class="spacer"></div> <div class="spacer"></div>
</dl> </dl>
<dl> <dl>
<dt> <dt>
[{oxmultilang ident="D3_MULTIVAR_MAIN_SEPARATOR"}] [{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN_ANONYMIZEIP"}]
[{* _gaq.push(['_gat._anonymizeIp']); *}]
</dt> </dt>
<dd> <dd>
<input class="edittext ext_edittext" type="text" size="1" maxlength="1" name="value[d3_cfg_mod__sMultiVariants_separator]" value='[{if $value->d3_cfg_mod__sMultiVariants_separator}][{$value->d3_cfg_mod__sMultiVariants_separator}][{else}]|[{/if}]'> <input type="hidden" name="value[d3_cfg_mod__blD3GAAnonymizeIP]" value="0">
[{ oxinputhelp ident="D3_MULTIVAR_MAIN_SEPARATOR_DESC" }] <input class="edittext ext_edittext" type="checkbox" value="1" [{if $value->d3_cfg_mod__blD3GAAnonymizeIP}]checked[{/if}] name="value[d3_cfg_mod__blD3GAAnonymizeIP]">
[{ oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_ANONYMIZEIP_DESC" }]
</dd> </dd>
<div class="spacer"></div> <div class="spacer"></div>
</dl> </dl>
</div> </div>
</div> </div>
<div class="groupExp">
<div class="">
<a class="rc" onclick="_groupExp(this); return false;" href="#">
<b>
[{oxmultilang ident="D3_GOOGLEANALYTICS_ECOMMERCE"}]
</b>
</a>
<dl>
<dt>
[{oxmultilang ident="D3_GOOGLEANALYTICS_ECOMMERCE_SENDDATA"}]
</dt>
<dd>
<input type="hidden" name="value[d3_cfg_mod__blD3GASendECommerce]" value="0">
<input class="edittext ext_edittext" type="checkbox" value="1" [{if $value->d3_cfg_mod__blD3GASendECommerce}]checked[{/if}] name="value[d3_cfg_mod__blD3GASendECommerce]">
[{ oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_ANONYMIZEIP_DESC" }]
</dd>
<div class="spacer"></div>
</dl>
</div>
</div>
<div class="groupExp">
<div class="">
<a class="rc" onclick="_groupExp(this); return false;" href="#">
<b>
[{oxmultilang ident="D3_GOOGLEANALYTICS_DOMAIN"}]
</b>
</a>
<dl>
<dt>
[{oxmultilang ident="D3_GOOGLEANALYTICS_DOMAIN_ALLOWXDOMAIN"}]
[{* _gaq.push(['_setAllowLinker', true]); *}]
</dt>
<dd>
<input type="hidden" name="value[d3_cfg_mod__blD3GAAllowDomainLinker]" value="0">
<input class="edittext ext_edittext" type="checkbox" value="1" [{if $value->d3_cfg_mod__blD3GAAllowDomainLinker}]checked[{/if}] name="value[d3_cfg_mod__blD3GAAllowDomainLinker]">
[{ oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_ANONYMIZEIP_DESC" }]
</dd>
<div class="spacer"></div>
</dl>
<dl>
<dt>
[{oxmultilang ident="D3_GOOGLEANALYTICS_DOMAIN_XDOMAIN"}]
_gaq.push(['_setDomainName', '.example-petstore.com']);
// wenn benutzt:
_gaq.push(['_setAllowHash', false]); ???
</dt>
<dd>
<input type="hidden" name="value[d3_cfg_mod__blD3GoogleAnalyticsSendECommerce]" value="0">
<input class="edittext ext_edittext" type="checkbox" value="1" [{if $value->d3_cfg_mod__blD3GoogleAnalyticsSendECommerce}]checked[{/if}] name="value[d3_cfg_mod__blD3GoogleAnalyticsSendECommerce]">
[{ oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_ANONYMIZEIP_DESC" }]
</dd>
<div class="spacer"></div>
</dl>
<dl>
<dt>
[{oxmultilang ident="D3_GOOGLEANALYTICS_DOMAIN_COOKIEPATH"}]
_gaq.push(['_setCookiePath', '/path/of/cookie/']);
</dt>
<dd>
<input type="hidden" name="value[d3_cfg_mod__blD3GoogleAnalyticsSendECommerce]" value="0">
<input class="edittext ext_edittext" type="checkbox" value="1" [{if $value->d3_cfg_mod__blD3GoogleAnalyticsSendECommerce}]checked[{/if}] name="value[d3_cfg_mod__blD3GoogleAnalyticsSendECommerce]">
[{ oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_ANONYMIZEIP_DESC" }]
</dd>
<div class="spacer"></div>
</dl>
</div>
</div>
<div class="groupExp">
<div class="">
<a class="rc" onclick="_groupExp(this); return false;" href="#">
<b>
[{oxmultilang ident="D3_GOOGLEANALYTICS_BROWSER"}]
</b>
</a>
<dl>
<dt>
[{oxmultilang ident="D3_GOOGLEANALYTICS_ECOMMERCE_SENDDATA"}]
_gaq.push(['_setClientInfo', false]);
</dt>
<dd>
<input type="hidden" name="value[d3_cfg_mod__blD3GoogleAnalyticsSendECommerce]" value="0">
<input class="edittext ext_edittext" type="checkbox" value="1" [{if $value->d3_cfg_mod__blD3GoogleAnalyticsSendECommerce}]checked[{/if}] name="value[d3_cfg_mod__blD3GoogleAnalyticsSendECommerce]">
[{ oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_ANONYMIZEIP_DESC" }]
</dd>
<div class="spacer"></div>
</dl>
<dl>
<dt>
[{oxmultilang ident="D3_GOOGLEANALYTICS_ECOMMERCE_SENDDATA"}]
_gaq.push(['_setAllowHash', false]);
</dt>
<dd>
<input type="hidden" name="value[d3_cfg_mod__blD3GoogleAnalyticsSendECommerce]" value="0">
<input class="edittext ext_edittext" type="checkbox" value="1" [{if $value->d3_cfg_mod__blD3GoogleAnalyticsSendECommerce}]checked[{/if}] name="value[d3_cfg_mod__blD3GoogleAnalyticsSendECommerce]">
[{ oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_ANONYMIZEIP_DESC" }]
</dd>
<div class="spacer"></div>
</dl>
<dl>
<dt>
[{oxmultilang ident="D3_GOOGLEANALYTICS_ECOMMERCE_SENDDATA"}]
_gaq.push(['_setDetectFlash', false]);
</dt>
<dd>
<input type="hidden" name="value[d3_cfg_mod__blD3GoogleAnalyticsSendECommerce]" value="0">
<input class="edittext ext_edittext" type="checkbox" value="1" [{if $value->d3_cfg_mod__blD3GoogleAnalyticsSendECommerce}]checked[{/if}] name="value[d3_cfg_mod__blD3GoogleAnalyticsSendECommerce]">
[{ oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_ANONYMIZEIP_DESC" }]
</dd>
<div class="spacer"></div>
</dl>
<dl>
<dt>
[{oxmultilang ident="D3_GOOGLEANALYTICS_ECOMMERCE_SENDDATA"}]
_gaq.push(['_setDetectTitle', false]);
</dt>
<dd>
<input type="hidden" name="value[d3_cfg_mod__blD3GoogleAnalyticsSendECommerce]" value="0">
<input class="edittext ext_edittext" type="checkbox" value="1" [{if $value->d3_cfg_mod__blD3GoogleAnalyticsSendECommerce}]checked[{/if}] name="value[d3_cfg_mod__blD3GoogleAnalyticsSendECommerce]">
[{ oxinputhelp ident="D3_GOOGLEANALYTICS_MAIN_ANONYMIZEIP_DESC" }]
</dd>
<div class="spacer"></div>
</dl>
</div>
</div>
<table width="100%"> <table width="100%">
<tr> <tr>
@ -230,8 +362,8 @@ td.edittext {
<script type="text/javascript"> <script type="text/javascript">
if (parent.parent) if (parent.parent)
{ parent.parent.sShopTitle = "[{$actshopobj->oxshops__oxname->getRawValue()|oxaddslashes}]"; { parent.parent.sShopTitle = "[{$actshopobj->oxshops__oxname->getRawValue()|oxaddslashes}]";
parent.parent.sMenuItem = "[{oxmultilang ident="d3mxmultivariants"}]"; parent.parent.sMenuItem = "[{oxmultilang ident="d3mxgoogleanalytics"}]";
parent.parent.sMenuSubItem = "[{oxmultilang ident="d3tbclmultivariants_main"}]"; parent.parent.sMenuSubItem = "[{oxmultilang ident="d3tbclgoogleanalytics_main"}]";
parent.parent.sWorkArea = "[{$_act}]"; parent.parent.sWorkArea = "[{$_act}]";
parent.parent.setTitle(); parent.parent.setTitle();
} }

View File

@ -1,43 +1,45 @@
<script type="text/javascript"> [{if $d3GoogleAnalyticsActive && $d3GoogleAnalyticsId}]
[{strip}]
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '[{ $d3GoogleAnalyticsId }]']);
[{if $d3GoogleAnalyticsAnonymizeIP}]_gaq.push(['_gat._anonymizeIp']);[{/if}]
_gaq.push(['_setDomainName', 'none']);
[{if d3GoogleAnalyticsXDomain}]_gaq.push(['_setAllowLinker', true]);[{/if}]
_gaq.push(['_trackPageview']);
var _gaq = _gaq || []; [{if $d3GoogleAnalyticsSendECommerce && $oViewConf->getActiveClassName() == 'thankyou'}]
_gaq.push(['_setAccount', '[{ $d3GoogleAnalyticsId }]']); _gaq.push(['_addTrans',
_gaq.push(['_gat._anonymizeIp']); '[{ $order->oxorder__oxordernr->value }]', // order ID - required
_gaq.push(['_setDomainName', 'none']); '[{ $oxcmp_shop->oxshops__oxname->value}]', // affiliation or store name
_gaq.push(['_setAllowLinker', true]); '[{ $order->getTotalOrderSum() }]', // total - required
_gaq.push(['_trackPageview']); '', // tax
'[{ $order->oxorder__oxdelcost->value }]', // shipping
'[{ $order->oxorder__oxbillcity->value }]', // city
'[{ $order->oxorder__oxbillstate->value }]', // state or province
'[{ $order->oxorder__oxbillcountry->value }]' // country
]);
[{if $oViewConf->getActiveClassName() == 'thankyou'}] [{foreach from=$order->getOrderArticles() item=oOrderArticle}]
_gaq.push(['_addTrans', _gaq.push(['_addItem',
'[{ $order->oxorder__oxordernr->value }]', // order ID - required '[{ $order->oxorder__oxordernr->value }]', // order ID - required
'[{ $oxcmp_shop->oxshops__oxname->value}]', // affiliation or store name '[{ $oOrderArticle->oxorderarticles__oxartnum->value }]', // SKU/code
'[{ $order->getTotalOrderSum() }]', // total - required '[{ $oOrderArticle->oxorderarticles__oxtitle->value }]', // product name
'', // tax '[{ $oOrderArticle->oxorderarticles__oxselvariant->value }]', // category or variation
'[{ $order->oxorder__oxdelcost->value }]', // shipping '[{ $oOrderArticle->oxorderarticles__oxprice->value }]', // unit price - required
'[{ $order->oxorder__oxbillcity->value }]', // city '[{ $oOrderArticle->oxorderarticles__oxamount->value }]' // quantity - required
'', // state or province ]);
'[{ $order->oxorder__oxbillcountry->value }]' // country [{/foreach}]
]);
[{foreach from=$order->getOrderArticles() item=oOrderArticle}] _gaq.push(['_trackTrans']);
_gaq.push(['_addItem',
'[{ $order->oxorder__oxordernr->value }]', // order ID - required
'[{ $oOrderArticle->oxorderarticles__oxartnum->value }]', // SKU/code
'[{ $oOrderArticle->oxorderarticles__oxtitle->value }]', // product name
'[{ $oOrderArticle->oxorderarticles__oxselvariant->value }]', // category or variation
'[{ $oOrderArticle->oxorderarticles__oxprice->value }]', // unit price - required
'[{ $oOrderArticle->oxorderarticles__oxamount->value }]' // quantity - required
]);
[{/foreach}]
_gaq.push(['_trackTrans']); [{/if}]
[{/if}] (function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
(function() { ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; })();
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); </script>
})(); [{/strip}]
[{/if}]
</script>

View File

@ -18,7 +18,7 @@
* @copyright (C) D3 Data Development * @copyright (C) D3 Data Development
*/ */
class d3_cfg_multivariants extends d3_cfg_mod_ class d3_cfg_googleanalytics extends d3_cfg_mod_
{ {
public function render() public function render()

View File

@ -0,0 +1,39 @@
<?php
/**
* This module is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For further informations, see <http://www.gnu.org/licenses/>.
*
* @link http://www.oxidmodule.com
* @link http://www.shopmodule.com
* @copyright (C) D3 Data Development
*/
class d3_cfg_googleanalytics_adwords extends d3_cfg_mod_main
{
protected $_sThisTemplate = 'd3_cfg_googleanalytics_adwords.tpl';
protected $_sModId = 'd3_googleanalytics';
public function checkD3Log()
{
// there are no reasons to log anything
return false;
}
/*
public function render()
{
dumpvar($this->oSet);
return parent::render();
}
*/
}

View File

@ -18,7 +18,7 @@
* @copyright (C) D3 Data Development * @copyright (C) D3 Data Development
*/ */
class d3_cfg_multivariants_list extends d3_cfg_mod_list class d3_cfg_googleanalytics_list extends d3_cfg_mod_list
{ {
protected $_blD3ShowLangSwitch = true; protected $_blD3ShowLangSwitch = true;

View File

@ -29,4 +29,11 @@ class d3_cfg_googleanalytics_main extends d3_cfg_mod_main
// there are no reasons to log anything // there are no reasons to log anything
return false; return false;
} }
/*
public function render()
{
dumpvar($this->oSet);
return parent::render();
}
*/
} }

View File

@ -4,6 +4,7 @@
<MAINMENU id="d3mxgoogleanalytics"> <MAINMENU id="d3mxgoogleanalytics">
<SUBMENU id="d3mxgoogleanalytics_settings" cl="d3_cfg_googleanalytics" list="d3_cfg_googleanalytics_list"> <SUBMENU id="d3mxgoogleanalytics_settings" cl="d3_cfg_googleanalytics" list="d3_cfg_googleanalytics_list">
<TAB id="d3tbclgoogleanalytics_main" cl="d3_cfg_googleanalytics_main" /> <TAB id="d3tbclgoogleanalytics_main" cl="d3_cfg_googleanalytics_main" />
<TAB id="d3tbclgoogleanalytics_adwords" cl="d3_cfg_googleanalytics_adwords" />
<TAB id="d3tbcl_licence" cl="d3_cfg_googleanalytics_licence" /> <TAB id="d3tbcl_licence" cl="d3_cfg_googleanalytics_licence" />
</SUBMENU> </SUBMENU>
</MAINMENU> </MAINMENU>

View File

@ -2,11 +2,23 @@
class d3_oxcmp_utils_googleAnalytics extends d3_oxcmp_utils_googleAnalytics_parent class d3_oxcmp_utils_googleAnalytics extends d3_oxcmp_utils_googleAnalytics_parent
{ {
private $_sModId = 'd3_googleanalytics';
private $_oSet;
public function render() public function render()
{ {
$ret = parent::render(); $ret = parent::render();
$this->_oParent->addTplParam('d3GoogleAnalyticsId', $this->getConfig()->getConfigParam('sD3GoogleAnalyticsId')); // load module config
$this->_oSet = oxNew('d3_cfg_mod');
$this->_oSet->Load($this->_oSet->getModOxid($this->_sModId), true);
$this->_oParent->addTplParam('d3GoogleAnalyticsActive', $this->_oSet->getFieldData('oxactive'));
$this->_oParent->addTplParam('d3GoogleAnalyticsId', $this->_oSet->getValue('sD3GAId'));
$this->_oParent->addTplParam('d3GoogleAnalyticsAnonymizeIP', $this->_oSet->getValue('blD3GAAnonymizeIP'));
$this->_oParent->addTplParam('d3GoogleAnalyticsSendECommerce', $this->_oSet->getValue('blD3GASendECommerce'));
$this->_oParent->addTplParam('d3GoogleAnalyticsXDomain', $this->_oSet->getValue('blD3GAAllowDomainLinker'));
return $ret; return $ret;
} }