Version Notes
First stable public release.
- Many improvements.
Download this release
Release Info
Developer | Roeland van Oostenbrugge |
Extension | Converdo_Analytics |
Version | 1.2.3.0 |
Comparing to | |
See all releases |
Version 1.2.3.0
- app/code/community/Converdo/Analytics/Block/Tracker.php +82 -0
- app/code/community/Converdo/Analytics/Helper/Data.php +62 -0
- app/code/community/Converdo/Analytics/Model/Observer.php +46 -0
- app/code/community/Converdo/Analytics/etc/adminhtml.xml +68 -0
- app/code/community/Converdo/Analytics/etc/config.xml +84 -0
- app/code/community/Converdo/Analytics/etc/system.xml +67 -0
- app/design/frontend/base/default/layout/analytics.xml +9 -0
- app/design/frontend/base/default/template/analytics/analytics.phtml +13 -0
- app/etc/modules/Converdo_Analytics.xml +13 -0
- app/locale/en_US/Converdo_Magento.csv +5 -0
- lib/Converdo/Entity/AbstractEntity.php +6 -0
- lib/Converdo/Entity/Interface/EntityInterface.php +6 -0
- lib/Converdo/Entity/Interface/ProductInterface.php +123 -0
- lib/Converdo/Entity/Product.php +194 -0
- lib/Converdo/Support/Crypt.php +36 -0
- lib/Converdo/Support/StringBuilder.php +170 -0
- lib/Converdo/Support/Writer.php +123 -0
- lib/Converdo/Tracker/Processor/AbstractProcessor.php +84 -0
- lib/Converdo/Tracker/Processor/CartProcessor.php +56 -0
- lib/Converdo/Tracker/Processor/CategoryViewProcessor.php +39 -0
- lib/Converdo/Tracker/Processor/CheckoutProcessor.php +68 -0
- lib/Converdo/Tracker/Processor/CustomVariableProcessor.php +42 -0
- lib/Converdo/Tracker/Processor/FootProcessor.php +24 -0
- lib/Converdo/Tracker/Processor/HeadProcessor.php +23 -0
- lib/Converdo/Tracker/Processor/Interface/ProcessorInterface.php +18 -0
- lib/Converdo/Tracker/Processor/PageViewProcessor.php +146 -0
- lib/Converdo/Tracker/Processor/ProductViewProcessor.php +115 -0
- lib/Converdo/Tracker/Query/AbstractQuery.php +30 -0
- lib/Converdo/Tracker/Query/CategoryView.php +32 -0
- lib/Converdo/Tracker/Query/CustomVariable.php +27 -0
- lib/Converdo/Tracker/Query/EcommerceCartUpdate.php +20 -0
- lib/Converdo/Tracker/Query/EcommerceItem.php +37 -0
- lib/Converdo/Tracker/Query/EcommerceTracking.php +9 -0
- lib/Converdo/Tracker/Query/EcommerceView.php +24 -0
- lib/Converdo/Tracker/Query/HeartBeat.php +9 -0
- lib/Converdo/Tracker/Query/Interface/QueryInterface.php +26 -0
- lib/Converdo/Tracker/Query/LinkTracking.php +9 -0
- lib/Converdo/Tracker/Query/PageTracking.php +14 -0
- lib/Converdo/Tracker/Query/PageView.php +27 -0
- lib/Converdo/Tracker/Query/ProductView.php +32 -0
- lib/Converdo/Tracker/Query/SiteId.php +26 -0
- lib/Converdo/Tracker/Query/TrackerUrl.php +39 -0
- package.xml +20 -0
app/code/community/Converdo/Analytics/Block/Tracker.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Analytics_Block_Tracker extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var array
|
7 |
+
*/
|
8 |
+
protected $orderedIds = [];
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var array
|
12 |
+
*/
|
13 |
+
public $configuration = [];
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Render Converdo tracking scripts
|
17 |
+
*
|
18 |
+
* @return string
|
19 |
+
*/
|
20 |
+
protected function trackers()
|
21 |
+
{
|
22 |
+
if (!Mage::helper('analytics')->isEnabled()) {
|
23 |
+
return null;
|
24 |
+
}
|
25 |
+
|
26 |
+
$processors[] = new Converdo_Tracker_Processor_HeadProcessor;
|
27 |
+
$processors[] = new Converdo_Tracker_Processor_CartProcessor;
|
28 |
+
$processors[] = new Converdo_Tracker_Processor_CheckoutProcessor;
|
29 |
+
$processors[] = new Converdo_Tracker_Processor_ProductViewProcessor;
|
30 |
+
$processors[] = new Converdo_Tracker_Processor_CategoryViewProcessor;
|
31 |
+
$processors[] = new Converdo_Tracker_Processor_PageViewProcessor;
|
32 |
+
$processors[] = new Converdo_Tracker_Processor_FootProcessor;
|
33 |
+
|
34 |
+
foreach ($processors as $key => $processor) {
|
35 |
+
if (!($processor->responsible($this))) {
|
36 |
+
continue;
|
37 |
+
}
|
38 |
+
|
39 |
+
$processor->process($this);
|
40 |
+
|
41 |
+
if ($processor->hasConfiguration()) {
|
42 |
+
$this->configuration = array_merge($this->configuration, $processor->getConfiguration());
|
43 |
+
}
|
44 |
+
|
45 |
+
if ($key === count($processors) - 2) {
|
46 |
+
$customVariables = new Converdo_Tracker_Processor_CustomVariableProcessor;
|
47 |
+
$customVariables->responsible($this);
|
48 |
+
$customVariables->process();
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Set the ordered ids.
|
55 |
+
*
|
56 |
+
* @param array $orderedIds
|
57 |
+
*/
|
58 |
+
public function setOrderedIds(array $orderedIds = [])
|
59 |
+
{
|
60 |
+
$this->orderedIds = $orderedIds;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Get the ordered ids.
|
65 |
+
*
|
66 |
+
* @return array
|
67 |
+
*/
|
68 |
+
public function getOrderedIds()
|
69 |
+
{
|
70 |
+
return (array) $this->orderedIds;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Get whether the ordered ids are set.
|
75 |
+
*
|
76 |
+
* @return bool
|
77 |
+
*/
|
78 |
+
public function hasOrderedIds()
|
79 |
+
{
|
80 |
+
return (bool) is_array($this->orderedIds) && count($this->orderedIds);
|
81 |
+
}
|
82 |
+
}
|
app/code/community/Converdo/Analytics/Helper/Data.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Analytics_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Get whether Converdo Analytics is enabled for this shop.
|
7 |
+
*
|
8 |
+
* @param null $store
|
9 |
+
* @return bool
|
10 |
+
*/
|
11 |
+
public function isEnabled($store = null)
|
12 |
+
{
|
13 |
+
return (bool) $this->hasSiteId($store)
|
14 |
+
&& Mage::getStoreConfigFlag('converdo/analytics/active', $store)
|
15 |
+
&& Mage::getStoreConfigFlag('converdo/analytics/token', $store);
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Get the Site Id.
|
20 |
+
*
|
21 |
+
* @param null $store
|
22 |
+
* @return string
|
23 |
+
*/
|
24 |
+
public function getSiteId($store = null)
|
25 |
+
{
|
26 |
+
return Mage::getStoreConfig('converdo/analytics/site', $store);
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Get whether the Site Id is set.
|
31 |
+
*
|
32 |
+
* @param null $store
|
33 |
+
* @return bool
|
34 |
+
*/
|
35 |
+
public function hasSiteId($store = null)
|
36 |
+
{
|
37 |
+
return (bool) $this->getSiteId($store);
|
38 |
+
}
|
39 |
+
|
40 |
+
public function getSiteUrl()
|
41 |
+
{
|
42 |
+
return '//piwik.converdo.dev/';
|
43 |
+
}
|
44 |
+
|
45 |
+
public function getPhpTracker($full = false)
|
46 |
+
{
|
47 |
+
if ($full) {
|
48 |
+
return $this->getSiteUrl() . 'tracker.php';
|
49 |
+
}
|
50 |
+
|
51 |
+
return 'tracker.php';
|
52 |
+
}
|
53 |
+
|
54 |
+
public function getJsTracker($full = false)
|
55 |
+
{
|
56 |
+
if ($full) {
|
57 |
+
return $this->getSiteUrl() . 'tracker.js';
|
58 |
+
}
|
59 |
+
|
60 |
+
return 'tracker.js';
|
61 |
+
}
|
62 |
+
}
|
app/code/community/Converdo/Analytics/Model/Observer.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* Piwik Extension for Magento created by Adrian Speyer
|
5 |
+
* Get Piwik at http://www.piwik.org - Open source web analytics
|
6 |
+
*
|
7 |
+
* @category PiwikMage
|
8 |
+
* @package PiwikMage_PiwikAnalytics
|
9 |
+
* @copyright Copyright (c) 2012 Adrian Speyer. (http://www.adrianspeyer.com)
|
10 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Piwik module observer
|
17 |
+
*
|
18 |
+
* @category PiwikMage
|
19 |
+
* @package PiwikMage_PiwikAnalytics
|
20 |
+
*/
|
21 |
+
class Converdo_Analytics_Model_Observer
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* Add order information into Piwik block to render on checkout success pages
|
25 |
+
*
|
26 |
+
* @param Varien_Event_Observer $observer
|
27 |
+
*/
|
28 |
+
public function onCheckout(Varien_Event_Observer $observer)
|
29 |
+
{
|
30 |
+
$orderIds = $observer->getEvent()->getOrderIds();
|
31 |
+
|
32 |
+
if (empty($orderIds) || !is_array($orderIds)) {
|
33 |
+
return;
|
34 |
+
}
|
35 |
+
|
36 |
+
$block = Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('converdo_analytics');
|
37 |
+
|
38 |
+
Mage::log('BLOCK: ' . get_class($block));
|
39 |
+
|
40 |
+
if ($block) {
|
41 |
+
$block->setOrderedIds($orderIds);
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
|
app/code/community/Converdo/Analytics/etc/adminhtml.xml
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<menu>
|
5 |
+
<report translate="title" module="reports">
|
6 |
+
<title>Reports</title>
|
7 |
+
<sort_order>80</sort_order>
|
8 |
+
<children>
|
9 |
+
<iframe_piwik translate="title" module="reports">
|
10 |
+
<title>Piwik iFrame</title>
|
11 |
+
<sort_order>99999</sort_order>
|
12 |
+
<action>analytics/index/index</action>
|
13 |
+
<depends>
|
14 |
+
<config>converdo/analytics/active</config>
|
15 |
+
</depends>
|
16 |
+
</iframe_piwik>
|
17 |
+
</children>
|
18 |
+
</report>
|
19 |
+
</menu>
|
20 |
+
|
21 |
+
<acl>
|
22 |
+
<resources>
|
23 |
+
<admin>
|
24 |
+
<children>
|
25 |
+
<system>
|
26 |
+
<children>
|
27 |
+
<config>
|
28 |
+
<children>
|
29 |
+
<converdo translate="title" module="analytics">
|
30 |
+
<title>Converdo Analytics</title>
|
31 |
+
</converdo>
|
32 |
+
</children>
|
33 |
+
</config>
|
34 |
+
</children>
|
35 |
+
</system>
|
36 |
+
</children>
|
37 |
+
</admin>
|
38 |
+
</resources>
|
39 |
+
</acl>
|
40 |
+
<acl>
|
41 |
+
<resources>
|
42 |
+
<admin>
|
43 |
+
<children>
|
44 |
+
<report translate="title" module="reports">
|
45 |
+
<title>Reports</title>
|
46 |
+
<sort_order>80</sort_order>
|
47 |
+
<children>
|
48 |
+
<iframe_piwik translate="title">
|
49 |
+
<title>Piwik Iframe</title>
|
50 |
+
</iframe_piwik>
|
51 |
+
</children>
|
52 |
+
</report>
|
53 |
+
<system>
|
54 |
+
<children>
|
55 |
+
<config>
|
56 |
+
<children>
|
57 |
+
<reports translate="title" module="reports">
|
58 |
+
<title>Reports</title>
|
59 |
+
</reports>
|
60 |
+
</children>
|
61 |
+
</config>
|
62 |
+
</children>
|
63 |
+
</system>
|
64 |
+
</children>
|
65 |
+
</admin>
|
66 |
+
</resources>
|
67 |
+
</acl>
|
68 |
+
</config>
|
app/code/community/Converdo/Analytics/etc/config.xml
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<modules>
|
5 |
+
<Converdo_Analytics>
|
6 |
+
<version>1.1.6.0</version>
|
7 |
+
</Converdo_Analytics>
|
8 |
+
</modules>
|
9 |
+
<global>
|
10 |
+
<models>
|
11 |
+
<analytics>
|
12 |
+
<class>Converdo_Analytics_Model</class>
|
13 |
+
</analytics>
|
14 |
+
</models>
|
15 |
+
<blocks>
|
16 |
+
<analytics>
|
17 |
+
<class>Converdo_Analytics_Block</class>
|
18 |
+
</analytics>
|
19 |
+
</blocks>
|
20 |
+
<helpers>
|
21 |
+
<analytics>
|
22 |
+
<class>Converdo_Analytics_Helper</class>
|
23 |
+
</analytics>
|
24 |
+
</helpers>
|
25 |
+
</global>
|
26 |
+
<frontend>
|
27 |
+
<translate>
|
28 |
+
<modules>
|
29 |
+
<Converdo_Analytics>
|
30 |
+
<files>
|
31 |
+
<default>Converdo_Analytics.csv</default>
|
32 |
+
</files>
|
33 |
+
</Converdo_Analytics>
|
34 |
+
</modules>
|
35 |
+
</translate>
|
36 |
+
<events>
|
37 |
+
<checkout_onepage_controller_success_action>
|
38 |
+
<observers>
|
39 |
+
<analytics_order_success>
|
40 |
+
<class>analytics/observer</class>
|
41 |
+
<method>onCheckout</method>
|
42 |
+
</analytics_order_success>
|
43 |
+
</observers>
|
44 |
+
</checkout_onepage_controller_success_action>
|
45 |
+
<checkout_multishipping_controller_success_action>
|
46 |
+
<observers>
|
47 |
+
<analytics_order_success>
|
48 |
+
<class>analytics/observer</class>
|
49 |
+
<method>onCheckout</method>
|
50 |
+
</analytics_order_success>
|
51 |
+
</observers>
|
52 |
+
</checkout_multishipping_controller_success_action>
|
53 |
+
</events>
|
54 |
+
<layout>
|
55 |
+
<updates>
|
56 |
+
<analytics>
|
57 |
+
<file>analytics.xml</file>
|
58 |
+
</analytics>
|
59 |
+
</updates>
|
60 |
+
</layout>
|
61 |
+
</frontend>
|
62 |
+
<adminhtml>
|
63 |
+
<translate>
|
64 |
+
<modules>
|
65 |
+
<Converdo_Analytics>
|
66 |
+
<files>
|
67 |
+
<default>Converdo_Analytics.csv</default>
|
68 |
+
</files>
|
69 |
+
</Converdo_Analytics>
|
70 |
+
</modules>
|
71 |
+
</translate>
|
72 |
+
</adminhtml>
|
73 |
+
<admin>
|
74 |
+
<routers>
|
75 |
+
<Converdo_Analytics>
|
76 |
+
<use>admin</use>
|
77 |
+
<args>
|
78 |
+
<module>Converdo_Analytics</module>
|
79 |
+
<frontName>analytics</frontName>
|
80 |
+
</args>
|
81 |
+
</Converdo_Analytics>
|
82 |
+
</routers>
|
83 |
+
</admin>
|
84 |
+
</config>
|
app/code/community/Converdo/Analytics/etc/system.xml
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<sections>
|
5 |
+
<converdo translate="label" module="analytics">
|
6 |
+
<label>Converdo Analytics</label>
|
7 |
+
<tab>sales</tab>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>350</sort_order>
|
10 |
+
<show_in_default>1</show_in_default>
|
11 |
+
<show_in_website>1</show_in_website>
|
12 |
+
<show_in_store>1</show_in_store>
|
13 |
+
<groups>
|
14 |
+
<analytics translate="label">
|
15 |
+
<label>Converdo Analytics</label>
|
16 |
+
<frontend_type>text</frontend_type>
|
17 |
+
<sort_order>8</sort_order>
|
18 |
+
<show_in_default>1</show_in_default>
|
19 |
+
<show_in_website>1</show_in_website>
|
20 |
+
<show_in_store>1</show_in_store>
|
21 |
+
<fields>
|
22 |
+
<active translate="label">
|
23 |
+
<label>Enable</label>
|
24 |
+
<frontend_type>select</frontend_type>
|
25 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
26 |
+
<sort_order>10</sort_order>
|
27 |
+
<show_in_default>1</show_in_default>
|
28 |
+
<show_in_website>1</show_in_website>
|
29 |
+
<show_in_store>1</show_in_store>
|
30 |
+
</active>
|
31 |
+
|
32 |
+
<site translate="label">
|
33 |
+
<label>Website token</label>
|
34 |
+
<comment>Find this token in your Converdo dashboard</comment>
|
35 |
+
<frontend_type>text</frontend_type>
|
36 |
+
<sort_order>30</sort_order>
|
37 |
+
<show_in_default>1</show_in_default>
|
38 |
+
<show_in_website>1</show_in_website>
|
39 |
+
<show_in_store>1</show_in_store>
|
40 |
+
</site>
|
41 |
+
|
42 |
+
<token translate="label">
|
43 |
+
<label>Account token</label>
|
44 |
+
<comment>Find this token in your Converdo dashboard</comment>
|
45 |
+
<frontend_type>text</frontend_type>
|
46 |
+
<sort_order>40</sort_order>
|
47 |
+
<show_in_default>1</show_in_default>
|
48 |
+
<show_in_website>1</show_in_website>
|
49 |
+
<show_in_store>1</show_in_store>
|
50 |
+
</token>
|
51 |
+
|
52 |
+
<encryption translate="label">
|
53 |
+
<label>Encryptie-sleutel</label>
|
54 |
+
<comment>Some data will be transfered securely to Converdo</comment>
|
55 |
+
<frontend_type>text</frontend_type>
|
56 |
+
<sort_order>40</sort_order>
|
57 |
+
<show_in_default>1</show_in_default>
|
58 |
+
<show_in_website>1</show_in_website>
|
59 |
+
<show_in_store>1</show_in_store>
|
60 |
+
</encryption>
|
61 |
+
|
62 |
+
</fields>
|
63 |
+
</analytics>
|
64 |
+
</groups>
|
65 |
+
</converdo>
|
66 |
+
</sections>
|
67 |
+
</config>
|
app/design/frontend/base/default/layout/analytics.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<layout version="0.1.0">
|
4 |
+
<default>
|
5 |
+
<reference name="before_body_end">
|
6 |
+
<block type="analytics/tracker" name="converdo_analytics" as="converdo_analytics" template="analytics/analytics.phtml" />
|
7 |
+
</reference>
|
8 |
+
</default>
|
9 |
+
</layout>
|
app/design/frontend/base/default/template/analytics/analytics.phtml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- START CONVERDO TRACKING CODE -->
|
2 |
+
<script type="text/javascript">
|
3 |
+
var _paq = _paq || [];
|
4 |
+
(function(){
|
5 |
+
<?php $this->trackers(); ?>
|
6 |
+
|
7 |
+
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.defer=true; g.async=true; g.src='<?= Mage::helper('analytics')->getJsTracker(true); ?>';
|
8 |
+
s.parentNode.insertBefore(g,s);
|
9 |
+
})();
|
10 |
+
</script>
|
11 |
+
<noscript><p><img src="<?= Mage::helper('analytics')->getPhpTracker(true) ?>?idsite=<?= Mage::helper('analytics')->getSiteId() ?>" style="border:0" alt="" /></p></noscript>
|
12 |
+
<!-- END CONVERDO TRACKING CODE -->
|
13 |
+
|
app/etc/modules/Converdo_Analytics.xml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<modules>
|
5 |
+
<Converdo_Analytics>
|
6 |
+
<active>true</active>
|
7 |
+
<codePool>community</codePool>
|
8 |
+
<depends>
|
9 |
+
<Mage_Core/>
|
10 |
+
</depends>
|
11 |
+
</Converdo_Analytics>
|
12 |
+
</modules>
|
13 |
+
</config>
|
app/locale/en_US/Converdo_Magento.csv
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Site Id","Site Id"
|
2 |
+
"Install Path","Install Path"
|
3 |
+
"Enable","Enable"
|
4 |
+
"Piwik Analytics Control","Piwik Analytics Control"
|
5 |
+
"Piwik Analytics","Piwik Analytics"
|
lib/Converdo/Entity/AbstractEntity.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
abstract class Converdo_Entity_AbstractEntity implements Converdo_Entity_Interface_EntityInterface
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
lib/Converdo/Entity/Interface/EntityInterface.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
interface Converdo_Entity_Interface_EntityInterface
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
lib/Converdo/Entity/Interface/ProductInterface.php
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
interface Converdo_Entity_Interface_ProductInterface
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Get the product id.
|
7 |
+
*
|
8 |
+
* @return int
|
9 |
+
*/
|
10 |
+
public function getId();
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Get the parent product id.
|
14 |
+
*
|
15 |
+
* @return int
|
16 |
+
*/
|
17 |
+
public function getParentId();
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Get the children product id.
|
21 |
+
*
|
22 |
+
* @return int
|
23 |
+
*/
|
24 |
+
public function getChildrenId();
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Get the product name.
|
28 |
+
*
|
29 |
+
* @return string
|
30 |
+
*/
|
31 |
+
public function getName();
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Get the product SKU.
|
35 |
+
*
|
36 |
+
* @return string
|
37 |
+
*/
|
38 |
+
public function getSku();
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Get the product price.
|
42 |
+
*
|
43 |
+
* @return float
|
44 |
+
*/
|
45 |
+
public function getPrice();
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Get the product status.
|
49 |
+
*
|
50 |
+
* @return bool
|
51 |
+
*/
|
52 |
+
public function getStatus();
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Get the product image url.
|
56 |
+
*
|
57 |
+
* @return string
|
58 |
+
*/
|
59 |
+
public function getImageUrl();
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Get whether the product is in stock.
|
63 |
+
*
|
64 |
+
* @return bool
|
65 |
+
*/
|
66 |
+
public function isInStock();
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Get the product stock amount.
|
70 |
+
*
|
71 |
+
* @return int
|
72 |
+
*/
|
73 |
+
public function getStockQuantity();
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Get the ordered quantity amount.
|
77 |
+
*
|
78 |
+
* @return float
|
79 |
+
*/
|
80 |
+
public function getQuantityOrdered();
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Get the quantity amount.
|
84 |
+
*
|
85 |
+
* @return float
|
86 |
+
*/
|
87 |
+
public function getQuantity();
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Get the product type.
|
91 |
+
*
|
92 |
+
* @return int
|
93 |
+
*/
|
94 |
+
public function getType();
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Get the visibilities of the product.
|
98 |
+
*
|
99 |
+
* @return array
|
100 |
+
*/
|
101 |
+
public function getVisibilities();
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Get the current category of the product.
|
105 |
+
*
|
106 |
+
* @return Mage_Catalog_Model_Category
|
107 |
+
*/
|
108 |
+
public function getCategory();
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Get the current category tree of the product.
|
112 |
+
*
|
113 |
+
* @return Varien_Data_Collection
|
114 |
+
*/
|
115 |
+
public function getCategories();
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Get the ids of the category tree of the product.
|
119 |
+
*
|
120 |
+
* @return array
|
121 |
+
*/
|
122 |
+
public function getCategoryIds();
|
123 |
+
}
|
lib/Converdo/Entity/Product.php
ADDED
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Converdo_Entity_Product
|
5 |
+
*/
|
6 |
+
class Converdo_Entity_Product extends Converdo_Entity_AbstractEntity implements Converdo_Entity_Interface_ProductInterface
|
7 |
+
{
|
8 |
+
/**
|
9 |
+
* @var Mage_Catalog_Model_Product
|
10 |
+
*/
|
11 |
+
protected $entity;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Converdo_Entity_Product constructor.
|
15 |
+
* @param Mage_Core_Model_Abstract $product
|
16 |
+
*/
|
17 |
+
public function __construct(Mage_Core_Model_Abstract $product)
|
18 |
+
{
|
19 |
+
$this->entity = $product;
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Get the product id.
|
24 |
+
*
|
25 |
+
* @return int
|
26 |
+
*/
|
27 |
+
public function getId()
|
28 |
+
{
|
29 |
+
return (int) $this->entity->getId();
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Get the parent product id.
|
34 |
+
*
|
35 |
+
* @return int
|
36 |
+
*/
|
37 |
+
public function getParentId()
|
38 |
+
{
|
39 |
+
return (int) $this->entity->getTypeInstance()->getParentIdsByChild($this->getId());
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Get the children product id.
|
44 |
+
*
|
45 |
+
* @return int
|
46 |
+
*/
|
47 |
+
public function getChildrenId()
|
48 |
+
{
|
49 |
+
return (int) $this->entity->getTypeInstance()->getChildrenIds($this->getId());
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Get the product name.
|
54 |
+
*
|
55 |
+
* @return string
|
56 |
+
*/
|
57 |
+
public function getName()
|
58 |
+
{
|
59 |
+
return (string) addslashes($this->entity->getName());
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Get the product SKU.
|
64 |
+
*
|
65 |
+
* @return string
|
66 |
+
*/
|
67 |
+
public function getSku()
|
68 |
+
{
|
69 |
+
return (string) $this->entity->getSku();
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Get the product price.
|
74 |
+
*
|
75 |
+
* @return float
|
76 |
+
*/
|
77 |
+
public function getPrice()
|
78 |
+
{
|
79 |
+
return number_format((float) $this->entity->getPrice(), 2);
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Get the product status.
|
84 |
+
*
|
85 |
+
* @return bool
|
86 |
+
*/
|
87 |
+
public function getStatus()
|
88 |
+
{
|
89 |
+
return (bool) $this->entity->getStatus();
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Get the product image url.
|
94 |
+
*
|
95 |
+
* @return string
|
96 |
+
*/
|
97 |
+
public function getImageUrl()
|
98 |
+
{
|
99 |
+
return (string) $this->entity->getImageUrl();
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Get whether the product is in stock.
|
104 |
+
*
|
105 |
+
* @return bool
|
106 |
+
*/
|
107 |
+
public function isInStock()
|
108 |
+
{
|
109 |
+
return (bool) $this->entity->isInStock();
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Get the product stock amount.
|
114 |
+
*
|
115 |
+
* @return int
|
116 |
+
*/
|
117 |
+
public function getStockQuantity()
|
118 |
+
{
|
119 |
+
return (float) Mage::getModel('cataloginventory/stock_item')->loadByProduct($this->getId())->getQty();
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Get the ordered quantity amount.
|
124 |
+
*
|
125 |
+
* @return float
|
126 |
+
*/
|
127 |
+
public function getQuantityOrdered()
|
128 |
+
{
|
129 |
+
return number_format($this->entity->getQtyOrdered(), 0, '.', '') ?: 0;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Get the quantity amount.
|
134 |
+
*
|
135 |
+
* @return float
|
136 |
+
*/
|
137 |
+
public function getQuantity()
|
138 |
+
{
|
139 |
+
return (float) $this->entity->getQty();
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Get the product type.
|
144 |
+
*
|
145 |
+
* @return int
|
146 |
+
*/
|
147 |
+
public function getType()
|
148 |
+
{
|
149 |
+
return (int) $this->entity->getTypeId();
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Get the visibilities of the product.
|
154 |
+
*
|
155 |
+
* @return array
|
156 |
+
*/
|
157 |
+
public function getVisibilities()
|
158 |
+
{
|
159 |
+
return [
|
160 |
+
'search' => $this->entity->isVisibleInSiteVisibility(),
|
161 |
+
'catalog' => $this->entity->isVisibleInCatalog(),
|
162 |
+
];
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Get the current category of the product.
|
167 |
+
*
|
168 |
+
* @return Mage_Catalog_Model_Category
|
169 |
+
*/
|
170 |
+
public function getCategory()
|
171 |
+
{
|
172 |
+
return $this->entity->getCategory();
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Get the current category tree of the product.
|
177 |
+
*
|
178 |
+
* @return Varien_Data_Collection
|
179 |
+
*/
|
180 |
+
public function getCategories()
|
181 |
+
{
|
182 |
+
return $this->entity->getCategoryCollection();
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Get the ids of the category tree of the product.
|
187 |
+
*
|
188 |
+
* @return array
|
189 |
+
*/
|
190 |
+
public function getCategoryIds()
|
191 |
+
{
|
192 |
+
return (array) $this->entity->getCategoryIds();
|
193 |
+
}
|
194 |
+
}
|
lib/Converdo/Support/Crypt.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Support_Crypt
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Encrypt a given input.
|
7 |
+
*
|
8 |
+
* @param $input
|
9 |
+
* @return string
|
10 |
+
*/
|
11 |
+
public static function encrypt($input)
|
12 |
+
{
|
13 |
+
return openssl_encrypt(base64_encode($input), 'AES-256-CFB', self::key());
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Decrypt a given input.
|
18 |
+
*
|
19 |
+
* @param $input
|
20 |
+
* @return string
|
21 |
+
*/
|
22 |
+
public static function decrypt($input)
|
23 |
+
{
|
24 |
+
return base64_decode(openssl_decrypt($input, 'AES-256-CFB', self::key()));
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Return the encryption key.
|
29 |
+
*
|
30 |
+
* @return string
|
31 |
+
*/
|
32 |
+
public static function key()
|
33 |
+
{
|
34 |
+
return (string) Mage::getStoreConfig('converdo/analytics/encryption');
|
35 |
+
}
|
36 |
+
}
|
lib/Converdo/Support/StringBuilder.php
ADDED
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Support_StringBuilder
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var array
|
7 |
+
*/
|
8 |
+
protected $sequence = [];
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var string
|
12 |
+
*/
|
13 |
+
protected $separator;
|
14 |
+
|
15 |
+
public function __construct($segment = null)
|
16 |
+
{
|
17 |
+
if ($segment) {
|
18 |
+
$this->sequence[] = $segment;
|
19 |
+
}
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @param mixed $value
|
24 |
+
*
|
25 |
+
* Appends the specified value to the sequence as a string.
|
26 |
+
*
|
27 |
+
* @return $this
|
28 |
+
*/
|
29 |
+
public function append($value)
|
30 |
+
{
|
31 |
+
$this->sequence[] = $value;
|
32 |
+
|
33 |
+
return $this;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @param Converdo_Support_StringBuilder $stringBuilder
|
38 |
+
*
|
39 |
+
* Appends the specified value to the sequence as a string.
|
40 |
+
*
|
41 |
+
* @return $this
|
42 |
+
*/
|
43 |
+
public function merge(Converdo_Support_StringBuilder $stringBuilder)
|
44 |
+
{
|
45 |
+
$this->append($stringBuilder->toString());
|
46 |
+
return $this;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @param mixed $separator
|
51 |
+
*
|
52 |
+
* Sets the separator which is inserted between each appended section.
|
53 |
+
*
|
54 |
+
* @return $this
|
55 |
+
*/
|
56 |
+
public function setSeparator($separator)
|
57 |
+
{
|
58 |
+
$this->separator = $separator;
|
59 |
+
return $this;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @param Integer $index
|
64 |
+
*
|
65 |
+
* Returns the current capacity.
|
66 |
+
*
|
67 |
+
* @return String
|
68 |
+
*/
|
69 |
+
public function charAt($index)
|
70 |
+
{
|
71 |
+
return $this->sequence[(int)$index];
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* @param Integer $start The beginning index, inclusive.
|
76 |
+
* @param Integer $end The ending index, exclusive.
|
77 |
+
*
|
78 |
+
* Removes the characters in a substring of this sequence.
|
79 |
+
*
|
80 |
+
* @return $this
|
81 |
+
*/
|
82 |
+
public function delete($start, $end)
|
83 |
+
{
|
84 |
+
array_splice($this->sequence, $start, $end);
|
85 |
+
return $this;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Removes all items from the sequence..
|
90 |
+
*
|
91 |
+
* @return $this
|
92 |
+
*/
|
93 |
+
public function clear()
|
94 |
+
{
|
95 |
+
$this->sequence = [];
|
96 |
+
return $this;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* @param Integer $index Index of char to remove
|
101 |
+
*
|
102 |
+
* Removes the char at the specified position in this sequence.
|
103 |
+
*
|
104 |
+
* @return $this
|
105 |
+
*/
|
106 |
+
public function deleteCharAt($index)
|
107 |
+
{
|
108 |
+
array_splice($this->sequence, $index, 1);
|
109 |
+
return $this;
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* @param Integer $start The beginning index, inclusive.
|
114 |
+
* @param Integer $end The ending index, exclusive.
|
115 |
+
* @param mixed $value Value that will replace previous contents.
|
116 |
+
*
|
117 |
+
* Removes the char at the specified position in this sequence.
|
118 |
+
*
|
119 |
+
* @return $this
|
120 |
+
*/
|
121 |
+
public function replace($start, $end, $value)
|
122 |
+
{
|
123 |
+
for ($i = $start; $i <= $end - $start; $i++) {
|
124 |
+
$this->sequence[(int) $i] = $value;
|
125 |
+
}
|
126 |
+
|
127 |
+
return $this;
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Causes this character sequence to be replaced by the reverse of the sequence.
|
132 |
+
*
|
133 |
+
* @return $this
|
134 |
+
*/
|
135 |
+
public function reverse()
|
136 |
+
{
|
137 |
+
$this->sequence = array_reverse($this->sequence);
|
138 |
+
return $this;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Returns the length.
|
143 |
+
*
|
144 |
+
* @return Integer
|
145 |
+
*/
|
146 |
+
public function length()
|
147 |
+
{
|
148 |
+
return strlen($this->toString());
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Returns a string representing the data in this sequence.
|
153 |
+
*
|
154 |
+
* @return String
|
155 |
+
*/
|
156 |
+
public function toString()
|
157 |
+
{
|
158 |
+
return implode($this->separator, $this->sequence);
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Returns a string representing the data in this sequence, in lower case.
|
163 |
+
*
|
164 |
+
* @return String
|
165 |
+
*/
|
166 |
+
public function toLowerCaseString()
|
167 |
+
{
|
168 |
+
return strtolower($this->toString());
|
169 |
+
}
|
170 |
+
}
|
lib/Converdo/Support/Writer.php
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Support_Writer
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var string
|
7 |
+
*/
|
8 |
+
public $view;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var array
|
12 |
+
*/
|
13 |
+
public $data = [];
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @var null|Converdo_Tracker_Query_Interface_QueryInterface
|
17 |
+
*/
|
18 |
+
public $query;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @var null|Varien_Object
|
22 |
+
*/
|
23 |
+
public $entity;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @param $input
|
27 |
+
* @return $this
|
28 |
+
*/
|
29 |
+
public function make($input)
|
30 |
+
{
|
31 |
+
unset($this->query, $this->entity, $this->view);
|
32 |
+
|
33 |
+
if ($input instanceof Converdo_Tracker_Query_Interface_QueryInterface) {
|
34 |
+
$this->view($input->getView());
|
35 |
+
$this->with($input->getData());
|
36 |
+
$this->query = $input;
|
37 |
+
} else {
|
38 |
+
$this->view($input);
|
39 |
+
}
|
40 |
+
|
41 |
+
return $this;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Write a new line.
|
46 |
+
*
|
47 |
+
* @param $name
|
48 |
+
* @return $this
|
49 |
+
*/
|
50 |
+
public function view($name)
|
51 |
+
{
|
52 |
+
$this->view = (string) $name;
|
53 |
+
return $this;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Write a new line with this data.
|
58 |
+
*
|
59 |
+
* @param mixed $data
|
60 |
+
* @return $this
|
61 |
+
*/
|
62 |
+
public function with($data)
|
63 |
+
{
|
64 |
+
if ($data instanceof Varien_Object || $data instanceof Converdo_Entity_Interface_EntityInterface) {
|
65 |
+
$this->withEntity($data);
|
66 |
+
} elseif (is_array($data)) {
|
67 |
+
$this->withData($data);
|
68 |
+
}
|
69 |
+
|
70 |
+
return $this;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Add data to the query straight from the code.
|
75 |
+
*
|
76 |
+
* @param array $data
|
77 |
+
* @return $this
|
78 |
+
*/
|
79 |
+
protected function withData(array $data = [])
|
80 |
+
{
|
81 |
+
if (isset($this->query) && !empty($this->query)) {
|
82 |
+
$this->data = @((array) $this->query->getData() + $data);
|
83 |
+
} else {
|
84 |
+
$this->data = (array) $data;
|
85 |
+
}
|
86 |
+
|
87 |
+
ksort($this->data);
|
88 |
+
$this->data = array_values($this->data);
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Add data to the query from an entity.
|
93 |
+
*
|
94 |
+
* @param $entity
|
95 |
+
* @return array
|
96 |
+
*/
|
97 |
+
protected function withEntity($entity)
|
98 |
+
{
|
99 |
+
$this->query->setEntity($entity);
|
100 |
+
$this->data = (array) $this->query->getData();
|
101 |
+
}
|
102 |
+
|
103 |
+
public function write()
|
104 |
+
{
|
105 |
+
$output = new Converdo_Support_StringBuilder;
|
106 |
+
|
107 |
+
$output->append("_paq.push(['{$this->view}'");
|
108 |
+
|
109 |
+
foreach ($this->data as $key => $value) {
|
110 |
+
if (is_numeric($value) && $value > 0 && $value == round($value, 0)) {
|
111 |
+
$output->append(", {$value}");
|
112 |
+
} elseif ($value === false) {
|
113 |
+
$output->append(', false');
|
114 |
+
} else {
|
115 |
+
$output->append(", '{$value}'");
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
$output->append("]);")->append("\n\t\t\t\t");
|
120 |
+
|
121 |
+
echo $output->toString();
|
122 |
+
}
|
123 |
+
}
|
lib/Converdo/Tracker/Processor/AbstractProcessor.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
abstract class Converdo_Tracker_Processor_AbstractProcessor
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var Converdo_Support_Writer
|
7 |
+
*/
|
8 |
+
protected $writer;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var array
|
12 |
+
*/
|
13 |
+
protected $configuration = [];
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Converdo_Tracker_Processor_AbstractProcessor constructor.
|
17 |
+
*/
|
18 |
+
public function __construct()
|
19 |
+
{
|
20 |
+
$this->writer = new Converdo_Support_Writer;
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Get whether the processor is responsible for the job.
|
25 |
+
*
|
26 |
+
* @param Mage_Core_Block_Template $block
|
27 |
+
* @return bool
|
28 |
+
*/
|
29 |
+
public function responsible(Mage_Core_Block_Template $block)
|
30 |
+
{
|
31 |
+
return true;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Return an encrypted JSON string with configuration.
|
36 |
+
*
|
37 |
+
* @return array
|
38 |
+
*/
|
39 |
+
protected function configuration()
|
40 |
+
{
|
41 |
+
return [];
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Set the configuration.
|
46 |
+
*
|
47 |
+
* @param $configuration
|
48 |
+
*/
|
49 |
+
public function setConfiguration($configuration)
|
50 |
+
{
|
51 |
+
$this->configuration = (array) $configuration;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Get whether the configuration is set.
|
56 |
+
*
|
57 |
+
* @return bool
|
58 |
+
*/
|
59 |
+
public function hasConfiguration()
|
60 |
+
{
|
61 |
+
return (bool) $this->configuration && count($this->configuration);
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Get the configuration.
|
66 |
+
*
|
67 |
+
* @return null|string
|
68 |
+
*/
|
69 |
+
public function getConfiguration()
|
70 |
+
{
|
71 |
+
if (!($this->hasConfiguration())) {
|
72 |
+
return null;
|
73 |
+
}
|
74 |
+
|
75 |
+
return (array) $this->configuration;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Process everything.
|
80 |
+
*
|
81 |
+
* @return void
|
82 |
+
*/
|
83 |
+
abstract public function process();
|
84 |
+
}
|
lib/Converdo/Tracker/Processor/CartProcessor.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Processor_CartProcessor extends Converdo_Tracker_Processor_AbstractProcessor
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var Mage_Checkout_Model_Cart
|
7 |
+
*/
|
8 |
+
protected $cart;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Converdo_Tracker_Processor_CartProcessor constructor.
|
12 |
+
*/
|
13 |
+
public function __construct()
|
14 |
+
{
|
15 |
+
parent::__construct();
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Get whether the processor is responsible for the job.
|
20 |
+
*
|
21 |
+
* @param Converdo_Analytics_Block_Tracker $block
|
22 |
+
* @return bool
|
23 |
+
*/
|
24 |
+
public function responsible(Converdo_Analytics_Block_Tracker $block)
|
25 |
+
{
|
26 |
+
$this->cart = Mage::getModel('checkout/cart');
|
27 |
+
|
28 |
+
return (bool) $this->cart->getQuote()->getAllVisibleItems();
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Process everything.
|
33 |
+
*
|
34 |
+
* @return void
|
35 |
+
*/
|
36 |
+
public function process()
|
37 |
+
{
|
38 |
+
foreach ($this->cart->getQuote()->getAllVisibleItems() as $key => $item) {
|
39 |
+
$product = Mage::getModel('catalog/product')->load($item->product_id);
|
40 |
+
$product = new Converdo_Entity_Product($product);
|
41 |
+
$category = null;
|
42 |
+
|
43 |
+
if (($categoryIds = $product->getCategoryIds()) && count($categoryIds)) {
|
44 |
+
$category = Mage::getModel('catalog/category')->load($categoryIds[0]);
|
45 |
+
$category = $category->getName();
|
46 |
+
}
|
47 |
+
|
48 |
+
$this->writer->make(new Converdo_Tracker_Query_EcommerceItem)->with($product)->with([
|
49 |
+
2 => $category,
|
50 |
+
4 => $item->getQty(),
|
51 |
+
])->write();
|
52 |
+
}
|
53 |
+
|
54 |
+
$this->writer->make(new Converdo_Tracker_Query_EcommerceCartUpdate)->with($this->cart)->write();
|
55 |
+
}
|
56 |
+
}
|
lib/Converdo/Tracker/Processor/CategoryViewProcessor.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Processor_CategoryViewProcessor extends Converdo_Tracker_Processor_AbstractProcessor
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var Mage_Catalog_Model_Category
|
7 |
+
*/
|
8 |
+
protected $category;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Converdo_Tracker_Processor_ProductViewProcessor constructor.
|
12 |
+
*/
|
13 |
+
public function __construct()
|
14 |
+
{
|
15 |
+
parent::__construct();
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Get whether the processor is responsible for the job.
|
20 |
+
*
|
21 |
+
* @param Mage_Core_Block_Template $block
|
22 |
+
* @return bool
|
23 |
+
*/
|
24 |
+
public function responsible(Mage_Core_Block_Template $block)
|
25 |
+
{
|
26 |
+
$this->category = Mage::registry('current_category');
|
27 |
+
return Mage::app()->getFrontController()->getAction()->getFullActionName() == 'catalog_category_view';
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Process everything.
|
32 |
+
*
|
33 |
+
* @return void
|
34 |
+
*/
|
35 |
+
public function process()
|
36 |
+
{
|
37 |
+
$this->writer->make(new Converdo_Tracker_Query_CategoryView)->with($this->category)->write();
|
38 |
+
}
|
39 |
+
}
|
lib/Converdo/Tracker/Processor/CheckoutProcessor.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Processor_CheckoutProcessor extends Converdo_Tracker_Processor_AbstractProcessor
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var Mage_Checkout_Model_Cart
|
7 |
+
*/
|
8 |
+
protected $cart;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var Converdo_Analytics_Block_Tracker
|
12 |
+
*/
|
13 |
+
protected $trackers;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Converdo_Tracker_Processor_CheckoutProcessor constructor.
|
17 |
+
*/
|
18 |
+
public function __construct()
|
19 |
+
{
|
20 |
+
parent::__construct();
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Get whether the processor is responsible for the job.
|
25 |
+
*
|
26 |
+
* @param Converdo_Analytics_Block_Tracker $block
|
27 |
+
* @return bool
|
28 |
+
*/
|
29 |
+
public function responsible(Converdo_Analytics_Block_Tracker $block)
|
30 |
+
{
|
31 |
+
$this->trackers = $block;
|
32 |
+
return (bool) $block->hasOrderedIds();
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Process everything.
|
37 |
+
*
|
38 |
+
* @return void
|
39 |
+
*/
|
40 |
+
public function process()
|
41 |
+
{
|
42 |
+
$collection = Mage::getResourceModel('sales/order_collection')
|
43 |
+
->addFieldToFilter('entity_id', array('in' => $this->trackers->getOrderedIds()));
|
44 |
+
|
45 |
+
foreach ($collection as $order) {
|
46 |
+
foreach ($order->getAllVisibleItems() as $key => $product) {
|
47 |
+
$product = Mage::getModel('catalog/product')->load($product->product_id);
|
48 |
+
$product = new Converdo_Entity_Product($product);
|
49 |
+
$category = null;
|
50 |
+
|
51 |
+
if (($categoryIds = $product->getCategoryIds()) && count($categoryIds)) {
|
52 |
+
$category = Mage::getModel('catalog/category')->load($categoryIds[0]);
|
53 |
+
$category = $category->getName();
|
54 |
+
}
|
55 |
+
|
56 |
+
$this->writer->make(new Converdo_Tracker_Query_EcommerceItem)->with($product)->with([2 => $category])->write();
|
57 |
+
}
|
58 |
+
|
59 |
+
$this->writer->make(new Converdo_Tracker_Query_EcommerceTracking())->with([
|
60 |
+
0 => $order->getIncrementId(),
|
61 |
+
1 => $order->getBaseGrandTotal(),
|
62 |
+
2 => number_format($order->getGrandTotal() - $order->getShippingAmount() - $order->getShippingTaxAmount(), 2),
|
63 |
+
3 => $order->getBaseTaxAmount(),
|
64 |
+
4 => $order->getBaseShippingAmount()
|
65 |
+
])->write();
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
lib/Converdo/Tracker/Processor/CustomVariableProcessor.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Processor_CustomVariableProcessor extends Converdo_Tracker_Processor_AbstractProcessor
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var Mage_Catalog_Model_Product|Converdo_Entity_Product
|
7 |
+
*/
|
8 |
+
protected $product;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Converdo_Tracker_Processor_ProductViewProcessor constructor.
|
12 |
+
*/
|
13 |
+
public function __construct()
|
14 |
+
{
|
15 |
+
parent::__construct();
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Get whether the processor is responsible for the job.
|
20 |
+
*
|
21 |
+
* @param Converdo_Analytics_Block_Tracker $block
|
22 |
+
* @return bool
|
23 |
+
*/
|
24 |
+
public function responsible(Converdo_Analytics_Block_Tracker $block)
|
25 |
+
{
|
26 |
+
$this->configuration = $block->configuration;
|
27 |
+
return true;
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Process everything.
|
32 |
+
*
|
33 |
+
* @return void
|
34 |
+
*/
|
35 |
+
public function process()
|
36 |
+
{
|
37 |
+
$this->writer->make(new Converdo_Tracker_Query_CustomVariable)->with([
|
38 |
+
2 => Converdo_Support_Crypt::encrypt(json_encode($this->configuration, true)),
|
39 |
+
3 => 'page',
|
40 |
+
])->write();
|
41 |
+
}
|
42 |
+
}
|
lib/Converdo/Tracker/Processor/FootProcessor.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Processor_FootProcessor extends Converdo_Tracker_Processor_AbstractProcessor
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Converdo_Tracker_Processor_MetaProcessor constructor.
|
7 |
+
*/
|
8 |
+
public function __construct()
|
9 |
+
{
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Process everything.
|
15 |
+
*
|
16 |
+
* @return void
|
17 |
+
*/
|
18 |
+
public function process()
|
19 |
+
{
|
20 |
+
$this->writer->make(new Converdo_Tracker_Query_PageTracking)->write();
|
21 |
+
$this->writer->make(new Converdo_Tracker_Query_LinkTracking)->write();
|
22 |
+
$this->writer->make(new Converdo_Tracker_Query_HeartBeat)->write();
|
23 |
+
}
|
24 |
+
}
|
lib/Converdo/Tracker/Processor/HeadProcessor.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Processor_HeadProcessor extends Converdo_Tracker_Processor_AbstractProcessor
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Converdo_Tracker_Processor_MetaProcessor constructor.
|
7 |
+
*/
|
8 |
+
public function __construct()
|
9 |
+
{
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Process everything.
|
15 |
+
*
|
16 |
+
* @return void
|
17 |
+
*/
|
18 |
+
public function process()
|
19 |
+
{
|
20 |
+
$this->writer->make(new Converdo_Tracker_Query_SiteId)->write();
|
21 |
+
$this->writer->make(new Converdo_Tracker_Query_TrackerUrl)->write();
|
22 |
+
}
|
23 |
+
}
|
lib/Converdo/Tracker/Processor/Interface/ProcessorInterface.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
interface Converdo_Tracker_Processor_Interface_ProcessorInterface
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Get whether the processor is responsible for the job.
|
7 |
+
*
|
8 |
+
* @return bool
|
9 |
+
*/
|
10 |
+
public function responsible();
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Process everything.
|
14 |
+
*
|
15 |
+
* @return void
|
16 |
+
*/
|
17 |
+
public function process();
|
18 |
+
}
|
lib/Converdo/Tracker/Processor/PageViewProcessor.php
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Processor_PageViewProcessor extends Converdo_Tracker_Processor_AbstractProcessor
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Converdo_Tracker_Processor_ProductViewProcessor constructor.
|
7 |
+
*/
|
8 |
+
public function __construct()
|
9 |
+
{
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Process everything.
|
15 |
+
*
|
16 |
+
* @return void
|
17 |
+
*/
|
18 |
+
public function process()
|
19 |
+
{
|
20 |
+
$this->configuration();
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Return a JSON string with configuration.
|
25 |
+
*
|
26 |
+
* @return array
|
27 |
+
*/
|
28 |
+
protected function configuration()
|
29 |
+
{
|
30 |
+
$pageType = Mage::app()->getFrontController()->getAction()->getFullActionName();
|
31 |
+
$route = Mage::app()->getFrontController()->getRequest()->getRouteName();
|
32 |
+
|
33 |
+
switch (true) {
|
34 |
+
|
35 |
+
// Account
|
36 |
+
case ($route == 'customer'):
|
37 |
+
$configPageType = 'account';
|
38 |
+
if ($pageType == 'customer_account_login')
|
39 |
+
$configPageTypeSub = 'account_login';
|
40 |
+
else if ($pageType == 'customer_account_create')
|
41 |
+
$configPageTypeSub = 'account_create';
|
42 |
+
else if ($pageType == 'customer_account_index')
|
43 |
+
$configPageTypeSub = 'account_profile';
|
44 |
+
else if ($pageType == 'customer_account_forgotpassword')
|
45 |
+
$configPageTypeSub = 'account_forgot_password';
|
46 |
+
else if ($pageType == 'customer_account_edit')
|
47 |
+
$configPageTypeSub = 'account_edit_info';
|
48 |
+
else if ($pageType == 'customer_address_form')
|
49 |
+
$configPageTypeSub = 'account_edit_address';
|
50 |
+
else if ($pageType == 'sales_order_history')
|
51 |
+
$configPageTypeSub = 'account_orders';
|
52 |
+
else if ($pageType == 'sales_billing_agreement_index')
|
53 |
+
$configPageTypeSub = 'account_billing_agreement';
|
54 |
+
else if ($pageType == 'sales_recurring_profile_index')
|
55 |
+
$configPageTypeSub = 'account_recurring';
|
56 |
+
else if ($pageType == 'review_customer_index')
|
57 |
+
$configPageTypeSub = 'account_reviews';
|
58 |
+
else if ($pageType == 'wishlist_index_index')
|
59 |
+
$configPageTypeSub = 'account_wishlist';
|
60 |
+
else if ($pageType == 'oauth_customer_token_index')
|
61 |
+
$configPageTypeSub = 'account_apps';
|
62 |
+
else if ($pageType == 'newsletter_manage_index')
|
63 |
+
$configPageTypeSub = 'account_newsletters';
|
64 |
+
else if ($pageType == 'downloadable_customer_products')
|
65 |
+
$configPageTypeSub = 'account_downloads';
|
66 |
+
else if ($pageType == 'customer_account_logoutSuccess')
|
67 |
+
$configPageTypeSub = 'account_logout';
|
68 |
+
else
|
69 |
+
$configPageTypeSub = (string) $pageType;
|
70 |
+
break;
|
71 |
+
|
72 |
+
// Cart
|
73 |
+
case ($pageType == 'checkout_cart_index'):
|
74 |
+
$configPageType = 'cart';
|
75 |
+
$configPageTypeSub = 'cart_index';
|
76 |
+
break;
|
77 |
+
|
78 |
+
// Category
|
79 |
+
case ($pageType == 'catalog_category_view'):
|
80 |
+
$configPageType = 'category';
|
81 |
+
$configPageTypeSub = 'category_view';
|
82 |
+
break;
|
83 |
+
|
84 |
+
// Checkout
|
85 |
+
case ($pageType == 'checkout_onepage_index'):
|
86 |
+
$configPageType = 'checkout';
|
87 |
+
$configPageTypeSub = 'checkout_onepage_index';
|
88 |
+
break;
|
89 |
+
|
90 |
+
// CMS
|
91 |
+
case ($pageType == 'cms_page_view'):
|
92 |
+
$configPageType = 'cms';
|
93 |
+
$configPageTypeSub = (string) $pageType;
|
94 |
+
break;
|
95 |
+
|
96 |
+
// Contact
|
97 |
+
case ($route == 'contacts'):
|
98 |
+
$configPageType = 'contact';
|
99 |
+
$configPageTypeSub = 'contact_index';
|
100 |
+
break;
|
101 |
+
|
102 |
+
// Homepage
|
103 |
+
case ($pageType == 'cms_index_index'):
|
104 |
+
$configPageType = 'homepage';
|
105 |
+
$configPageTypeSub = 'homepage_index';
|
106 |
+
break;
|
107 |
+
|
108 |
+
// Product
|
109 |
+
case ($pageType == 'catalog_product_view'):
|
110 |
+
$configPageType = 'product';
|
111 |
+
$configPageTypeSub = 'product_view';
|
112 |
+
break;
|
113 |
+
|
114 |
+
// Search
|
115 |
+
case ($route == 'catalogsearch'):
|
116 |
+
$configPageType = 'search';
|
117 |
+
if ($pageType == 'catalogsearch_result_index')
|
118 |
+
$configPageTypeSub = 'search_results';
|
119 |
+
else if ($pageType == 'catalogsearch_advanced_index')
|
120 |
+
$configPageTypeSub = 'search_advanced';
|
121 |
+
else if ($pageType == 'catalogsearch_advanced_result')
|
122 |
+
$configPageTypeSub = 'search_results_advanced';
|
123 |
+
else if ($pageType == 'catalogsearch_term_popular')
|
124 |
+
$configPageTypeSub = 'search_terms';
|
125 |
+
else
|
126 |
+
$configPageTypeSub = (string) $pageType;
|
127 |
+
break;
|
128 |
+
|
129 |
+
// Success
|
130 |
+
case ($pageType == 'checkout_onepage_success'):
|
131 |
+
$configPageType = 'success';
|
132 |
+
$configPageTypeSub = 'success_index';
|
133 |
+
break;
|
134 |
+
|
135 |
+
default:
|
136 |
+
$configPageType = (string) $route;
|
137 |
+
$configPageTypeSub = (string) $pageType;
|
138 |
+
break;
|
139 |
+
}
|
140 |
+
|
141 |
+
$this->setConfiguration([
|
142 |
+
'pt1' => $configPageType,
|
143 |
+
'pt2' => $configPageTypeSub
|
144 |
+
]);
|
145 |
+
}
|
146 |
+
}
|
lib/Converdo/Tracker/Processor/ProductViewProcessor.php
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Processor_ProductViewProcessor extends Converdo_Tracker_Processor_AbstractProcessor
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var Mage_Catalog_Model_Product|Converdo_Entity_Product
|
7 |
+
*/
|
8 |
+
protected $product;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var array
|
12 |
+
*/
|
13 |
+
protected $categories = [];
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Converdo_Tracker_Processor_ProductViewProcessor constructor.
|
17 |
+
*/
|
18 |
+
public function __construct()
|
19 |
+
{
|
20 |
+
parent::__construct();
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Get whether the processor is responsible for the job.
|
25 |
+
*
|
26 |
+
* @param Converdo_Analytics_Block_Tracker $block
|
27 |
+
* @return bool
|
28 |
+
*/
|
29 |
+
public function responsible(Converdo_Analytics_Block_Tracker $block)
|
30 |
+
{
|
31 |
+
return ($this->product = Mage::registry('current_product')) &&
|
32 |
+
($this->product instanceof Mage_Catalog_Model_Product);
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Process everything.
|
37 |
+
*
|
38 |
+
* @return void
|
39 |
+
*/
|
40 |
+
public function process()
|
41 |
+
{
|
42 |
+
$this->product = new Converdo_Entity_Product($this->product);
|
43 |
+
|
44 |
+
$this->writer->make(new Converdo_Tracker_Query_ProductView)->with($this->product)->with([
|
45 |
+
2 => implode(', ', $this->categories()),
|
46 |
+
])->write();
|
47 |
+
|
48 |
+
$this->configuration();
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Get an array of categories assigned to the product.
|
53 |
+
*
|
54 |
+
* @return array
|
55 |
+
*/
|
56 |
+
protected function categories()
|
57 |
+
{
|
58 |
+
if ($this->categories) {
|
59 |
+
return $this->categories;
|
60 |
+
}
|
61 |
+
|
62 |
+
$categories = [];
|
63 |
+
|
64 |
+
foreach ((array) $this->product->getCategoryIds() as $category)
|
65 |
+
{
|
66 |
+
$category = Mage::getModel('catalog/category')->load($category);
|
67 |
+
$categories[] = addslashes($category->getName());
|
68 |
+
}
|
69 |
+
|
70 |
+
return $categories;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Return an encrypted JSON string with configuration.
|
75 |
+
*
|
76 |
+
* @return array
|
77 |
+
*/
|
78 |
+
protected function configuration()
|
79 |
+
{
|
80 |
+
$this->setConfiguration([
|
81 |
+
// Product Name
|
82 |
+
'pti' => $this->product->getName(),
|
83 |
+
|
84 |
+
// Product Sku
|
85 |
+
'sku' => $this->product->getSku(),
|
86 |
+
|
87 |
+
// Product Price
|
88 |
+
'pri' => $this->product->getPrice(),
|
89 |
+
|
90 |
+
// Product Image
|
91 |
+
'ima' => $this->product->getImageUrl(),
|
92 |
+
|
93 |
+
// Product categories
|
94 |
+
'cat' => implode(', ', $this->categories()),
|
95 |
+
|
96 |
+
// Product Id
|
97 |
+
'rid' => $this->product->getId(),
|
98 |
+
|
99 |
+
// Product Type
|
100 |
+
'typ' => $this->product->getType(),
|
101 |
+
|
102 |
+
// Product Attributes
|
103 |
+
'att' => null,
|
104 |
+
|
105 |
+
// Product Is In Stock
|
106 |
+
'stb' => $this->product->isInStock(),
|
107 |
+
|
108 |
+
// Product Stock Quantity
|
109 |
+
'sqn' => $this->product->getStockQuantity(),
|
110 |
+
'cva' => null,
|
111 |
+
'ova' => null,
|
112 |
+
'pco' => null,
|
113 |
+
]);
|
114 |
+
}
|
115 |
+
}
|
lib/Converdo/Tracker/Query/AbstractQuery.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
abstract class Converdo_Tracker_Query_AbstractQuery implements Converdo_Tracker_Query_Interface_QueryInterface
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var Varien_Object
|
7 |
+
*/
|
8 |
+
protected $entity;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Pass an entity to the query.
|
12 |
+
*
|
13 |
+
* @param Varien_Object $entity
|
14 |
+
* @return void
|
15 |
+
*/
|
16 |
+
public function setEntity(Varien_Object $entity)
|
17 |
+
{
|
18 |
+
$this->entity = $entity;
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Get the data.
|
23 |
+
*
|
24 |
+
* @return array
|
25 |
+
*/
|
26 |
+
public function getData()
|
27 |
+
{
|
28 |
+
return [];
|
29 |
+
}
|
30 |
+
}
|
lib/Converdo/Tracker/Query/CategoryView.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Query_CategoryView extends Converdo_Tracker_Query_AbstractQuery
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Get the view.
|
7 |
+
*
|
8 |
+
* @return mixed
|
9 |
+
*/
|
10 |
+
public function getView()
|
11 |
+
{
|
12 |
+
return 'setEcommerceView';
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Get the data.
|
17 |
+
*
|
18 |
+
* @return array
|
19 |
+
*/
|
20 |
+
public function getData()
|
21 |
+
{
|
22 |
+
if (!($this->entity instanceof Mage_Catalog_Model_Category)) {
|
23 |
+
return [];
|
24 |
+
}
|
25 |
+
|
26 |
+
return [
|
27 |
+
0 => false,
|
28 |
+
1 => false,
|
29 |
+
2 => $this->entity->getName(),
|
30 |
+
];
|
31 |
+
}
|
32 |
+
}
|
lib/Converdo/Tracker/Query/CustomVariable.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Query_CustomVariable extends Converdo_Tracker_Query_AbstractQuery
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Get the view.
|
7 |
+
*
|
8 |
+
* @return mixed
|
9 |
+
*/
|
10 |
+
public function getView()
|
11 |
+
{
|
12 |
+
return 'setCustomVariable';
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Get the data.
|
17 |
+
*
|
18 |
+
* @return array
|
19 |
+
*/
|
20 |
+
public function getData()
|
21 |
+
{
|
22 |
+
return [
|
23 |
+
0 => 1,
|
24 |
+
1 => 'configuration',
|
25 |
+
];
|
26 |
+
}
|
27 |
+
}
|
lib/Converdo/Tracker/Query/EcommerceCartUpdate.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Query_EcommerceCartUpdate extends Converdo_Tracker_Query_AbstractQuery
|
4 |
+
{
|
5 |
+
public function getView()
|
6 |
+
{
|
7 |
+
return 'trackEcommerceCartUpdate';
|
8 |
+
}
|
9 |
+
|
10 |
+
public function getData()
|
11 |
+
{
|
12 |
+
if (!($this->entity instanceof Varien_Object)) {
|
13 |
+
return [];
|
14 |
+
}
|
15 |
+
|
16 |
+
return [
|
17 |
+
0 => number_format($this->entity->getQuote()->getGrandTotal(), 2),
|
18 |
+
];
|
19 |
+
}
|
20 |
+
}
|
lib/Converdo/Tracker/Query/EcommerceItem.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Query_EcommerceItem extends Converdo_Tracker_Query_AbstractQuery
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var Converdo_Entity_Product
|
7 |
+
*/
|
8 |
+
protected $entity;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Get the view.
|
12 |
+
*
|
13 |
+
* @return mixed
|
14 |
+
*/
|
15 |
+
public function getView()
|
16 |
+
{
|
17 |
+
return 'addEcommerceItem';
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Get the data.
|
22 |
+
*
|
23 |
+
* @return array
|
24 |
+
*/
|
25 |
+
public function getData()
|
26 |
+
{
|
27 |
+
if (!($this->entity instanceof Converdo_Entity_Interface_EntityInterface)) {
|
28 |
+
return [];
|
29 |
+
}
|
30 |
+
|
31 |
+
return [
|
32 |
+
0 => $this->entity->getSku(),
|
33 |
+
1 => $this->entity->getName(),
|
34 |
+
3 => $this->entity->getPrice(),
|
35 |
+
];
|
36 |
+
}
|
37 |
+
}
|
lib/Converdo/Tracker/Query/EcommerceTracking.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Query_EcommerceTracking extends Converdo_Tracker_Query_AbstractQuery
|
4 |
+
{
|
5 |
+
public function getView()
|
6 |
+
{
|
7 |
+
return 'trackEcommerceOrder';
|
8 |
+
}
|
9 |
+
}
|
lib/Converdo/Tracker/Query/EcommerceView.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Query_EcommerceView extends Converdo_Tracker_Query_AbstractQuery
|
4 |
+
{
|
5 |
+
public function getView()
|
6 |
+
{
|
7 |
+
return 'setEcommerceView';
|
8 |
+
}
|
9 |
+
|
10 |
+
public function getData()
|
11 |
+
{
|
12 |
+
if (!($this->entity instanceof Varien_Object)) {
|
13 |
+
return [];
|
14 |
+
}
|
15 |
+
|
16 |
+
return [
|
17 |
+
0 => $this->entity->getSku(),
|
18 |
+
1 => addslashes($this->entity->getName()),
|
19 |
+
2 => $this->entity->getName(),
|
20 |
+
3 => number_format($this->entity->getPrice(), 2),
|
21 |
+
4 => number_format($this->entity->getQtyOrdered(), 0, '.', ''),
|
22 |
+
];
|
23 |
+
}
|
24 |
+
}
|
lib/Converdo/Tracker/Query/HeartBeat.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Query_HeartBeat extends Converdo_Tracker_Query_AbstractQuery
|
4 |
+
{
|
5 |
+
public function getView()
|
6 |
+
{
|
7 |
+
return 'enableHeartBeatTimer';
|
8 |
+
}
|
9 |
+
}
|
lib/Converdo/Tracker/Query/Interface/QueryInterface.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
interface Converdo_Tracker_Query_Interface_QueryInterface
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Get the view.
|
7 |
+
*
|
8 |
+
* @return mixed
|
9 |
+
*/
|
10 |
+
public function getView();
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Get the data.
|
14 |
+
*
|
15 |
+
* @return array
|
16 |
+
*/
|
17 |
+
public function getData();
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Pass an entity to the query.
|
21 |
+
*
|
22 |
+
* @param Varien_Object $entity
|
23 |
+
* @return void
|
24 |
+
*/
|
25 |
+
public function setEntity(Varien_Object $entity);
|
26 |
+
}
|
lib/Converdo/Tracker/Query/LinkTracking.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Query_LinkTracking extends Converdo_Tracker_Query_AbstractQuery
|
4 |
+
{
|
5 |
+
public function getView()
|
6 |
+
{
|
7 |
+
return 'enableLinkTracking';
|
8 |
+
}
|
9 |
+
}
|
lib/Converdo/Tracker/Query/PageTracking.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Query_PageTracking extends Converdo_Tracker_Query_AbstractQuery
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Get the view.
|
7 |
+
*
|
8 |
+
* @return mixed
|
9 |
+
*/
|
10 |
+
public function getView()
|
11 |
+
{
|
12 |
+
return 'trackPageView';
|
13 |
+
}
|
14 |
+
}
|
lib/Converdo/Tracker/Query/PageView.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Query_PageView extends Converdo_Tracker_Query_AbstractQuery
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Get the view.
|
7 |
+
*
|
8 |
+
* @return mixed
|
9 |
+
*/
|
10 |
+
public function getView()
|
11 |
+
{
|
12 |
+
return 'setCustomVariable';
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Get the data.
|
17 |
+
*
|
18 |
+
* @return array
|
19 |
+
*/
|
20 |
+
public function getData()
|
21 |
+
{
|
22 |
+
return [
|
23 |
+
0 => 1,
|
24 |
+
1 => 'configuration',
|
25 |
+
];
|
26 |
+
}
|
27 |
+
}
|
lib/Converdo/Tracker/Query/ProductView.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Query_ProductView extends Converdo_Tracker_Query_AbstractQuery
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Get the view.
|
7 |
+
*
|
8 |
+
* @return mixed
|
9 |
+
*/
|
10 |
+
public function getView()
|
11 |
+
{
|
12 |
+
return 'setEcommerceView';
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Get the data.
|
17 |
+
*
|
18 |
+
* @return array
|
19 |
+
*/
|
20 |
+
public function getData()
|
21 |
+
{
|
22 |
+
if (!($this->entity instanceof Converdo_Entity_Interface_EntityInterface)) {
|
23 |
+
return [];
|
24 |
+
}
|
25 |
+
|
26 |
+
return [
|
27 |
+
0 => $this->entity->getSku(),
|
28 |
+
1 => $this->entity->getName(),
|
29 |
+
3 => $this->entity->getPrice(),
|
30 |
+
];
|
31 |
+
}
|
32 |
+
}
|
lib/Converdo/Tracker/Query/SiteId.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Query_SiteId extends Converdo_Tracker_Query_AbstractQuery
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Get the view.
|
7 |
+
*
|
8 |
+
* @return mixed
|
9 |
+
*/
|
10 |
+
public function getView()
|
11 |
+
{
|
12 |
+
return 'setSiteId';
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Get the data.
|
17 |
+
*
|
18 |
+
* @return array
|
19 |
+
*/
|
20 |
+
public function getData()
|
21 |
+
{
|
22 |
+
return [
|
23 |
+
0 => Mage::helper('analytics')->getSiteId(),
|
24 |
+
];
|
25 |
+
}
|
26 |
+
}
|
lib/Converdo/Tracker/Query/TrackerUrl.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Converdo_Tracker_Query_TrackerUrl extends Converdo_Tracker_Query_AbstractQuery
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var Converdo_Analytics_Helper_Data
|
7 |
+
*/
|
8 |
+
protected $helper;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Converdo_Tracker_Query_TrackerUrl constructor.
|
12 |
+
*/
|
13 |
+
public function __construct()
|
14 |
+
{
|
15 |
+
$this->helper = new Converdo_Analytics_Helper_Data;
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Get the view.
|
20 |
+
*
|
21 |
+
* @return mixed
|
22 |
+
*/
|
23 |
+
public function getView()
|
24 |
+
{
|
25 |
+
return 'setTrackerUrl';
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Get the data.
|
30 |
+
*
|
31 |
+
* @return array
|
32 |
+
*/
|
33 |
+
public function getData()
|
34 |
+
{
|
35 |
+
return [
|
36 |
+
0 => $this->helper->getPhpTracker(true),
|
37 |
+
];
|
38 |
+
}
|
39 |
+
}
|
package.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Converdo_Analytics</name>
|
4 |
+
<version>1.2.3.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>MITL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Better E-commerce Analytics. Clear, actionable insight in the behavior of your visitors. Improve your campaigns and conversion rate easily.</summary>
|
10 |
+
<description>Better E-commerce Analytics. Clear, actionable insight in the behavior of your visitors. Improve your campaigns and conversion rate easily. This plugin, installed in a minute, is all you need to have a complete and powerfull Analytics Suite. View your KPI's and sales funnels, segmented on dozens of dimensions like page type, device, landing page, campaign, etc. This plugin collects your users behaviour so you can view the insights on your dashboard on converdo.com. You can use Converdo Analytics side by side with Google Analytics without a problem. It works asynchronous so it will never impact your user experience. This extension is made especially for Magento ecommerce stores, which provides you powerfull insights out of the box.</description>
|
11 |
+
<notes>First stable public release.
|
12 |
+

|
13 |
+
- Many improvements.</notes>
|
14 |
+
<authors><author><name>Roeland van Oostenbrugge</name><user>converdo</user><email>roeland@converdo.nl</email></author></authors>
|
15 |
+
<date>2016-09-22</date>
|
16 |
+
<time>08:13:31</time>
|
17 |
+
<contents><target name="magecommunity"><dir name="Converdo"><dir name="Analytics"><dir name="Block"><file name="Tracker.php" hash="422523c3d976717a9ef5c4e1515ea729"/></dir><dir name="Helper"><file name="Data.php" hash="27385e6557623570e777de0c6d5c1b6e"/></dir><dir name="Model"><file name="Observer.php" hash="24adfe1dc5f87c8c2dd2e0553520246c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="72ef32eccf0bc6854b630776413f4ebe"/><file name="config.xml" hash="e062f4f72ecca954f7f17c09dec1b520"/><file name="system.xml" hash="432595ca6c57ba9cfc70e2624c3c7e5a"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="analytics.xml" hash="d3f9d35df1981968a55a331c2b92d473"/></dir><dir name="template"><dir name="analytics"><file name="analytics.phtml" hash="4a1ddca578fc575a4ef3a7015641eb2b"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Converdo_Analytics.xml" hash="119a038ca81bdf03767b1b12d81414ad"/></dir></target><target name="magelib"><dir name="Converdo"><dir name="Entity"><file name="AbstractEntity.php" hash="4130576c917771fdafcb4055363b2861"/><dir name="Interface"><file name="EntityInterface.php" hash="cb6a4e6da90518a9ffa8445314de56c1"/><file name="ProductInterface.php" hash="6245b2cadfec44d4965f2d93f9241b55"/></dir><file name="Product.php" hash="a529c1e7510bf8ebefde1b4e75750cc7"/></dir><dir name="Support"><file name="Crypt.php" hash="265f44cafba70116f72c255dd737a805"/><file name="StringBuilder.php" hash="282b1a3111f7cdf4c3b88f6320a8c57e"/><file name="Writer.php" hash="72ddf88a177d1b59ad46e2f2b5756ede"/></dir><dir name="Tracker"><dir name="Processor"><file name="AbstractProcessor.php" hash="7ed0d1a62b21ce92bf39b3633c244a21"/><file name="CartProcessor.php" hash="bdbc21c783342e0ffa7e4b49391720b7"/><file name="CategoryViewProcessor.php" hash="262399dd5a15e577776873501d78209a"/><file name="CheckoutProcessor.php" hash="f3a83827431e5a1fa540116c7c085648"/><file name="CustomVariableProcessor.php" hash="c7858262f2d175e731e3607210ce8b80"/><file name="FootProcessor.php" hash="bbd5f24e239e71e81bf4180e70fa084c"/><file name="HeadProcessor.php" hash="1b71ac4503572f41f1db66428f3a7f3e"/><dir name="Interface"><file name="ProcessorInterface.php" hash="fc6d581fcfbf71f877ce8fba8805e903"/></dir><file name="PageViewProcessor.php" hash="ae4a41d59efb23b69f80f7965f4652be"/><file name="ProductViewProcessor.php" hash="cea41f6559afb83dde200567e8e8aac8"/></dir><dir name="Query"><file name="AbstractQuery.php" hash="9daedd7877adf28b5e1e13089e32a715"/><file name="CategoryView.php" hash="e9782292c36a21c747b375304e59388a"/><file name="CustomVariable.php" hash="533d329bb755fefd36b8abd65279b793"/><file name="EcommerceCartUpdate.php" hash="eb0cb9d2ea01d761762cc124dc496555"/><file name="EcommerceItem.php" hash="847dd043b925b4424d7a29bc2a891455"/><file name="EcommerceTracking.php" hash="77338e3786a8331905d722c87d47125c"/><file name="EcommerceView.php" hash="f2d2efb863c62b71db3301b034e84a87"/><file name="HeartBeat.php" hash="f1ac7be35779f0eba50b6426f888f1dc"/><dir name="Interface"><file name="QueryInterface.php" hash="8dc5c4a79e032b5d4e559c72e9edfea4"/></dir><file name="LinkTracking.php" hash="300dbcbb9a43e194a595c424b53e9cf5"/><file name="PageTracking.php" hash="cbcbdd882e3754339b609c0273dd547c"/><file name="PageView.php" hash="2485e3efd4247a288dfef778ade53677"/><file name="ProductView.php" hash="8389b29f4c4ecee11d7831317bd5f0ab"/><file name="SiteId.php" hash="ec1c75338016275b4b63f4abc587f7c2"/><file name="TrackerUrl.php" hash="d432ebf964a333c7852935b48b8e17f7"/></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Converdo_Magento.csv" hash="1d58be97f37a234562d96d603bac7d21"/></dir></target></contents>
|
18 |
+
<compatible/>
|
19 |
+
<dependencies><required><php><min>5.5.37</min><max>7.0.5</max></php></required></dependencies>
|
20 |
+
</package>
|