Version Notes
1.0.4
-------
New feature: facebook pixel based visitor and conversion tracking.
1.0.3
-------
Minor bug fix, do not send empty array() objects to Vantage Analytics
1.0.2
-------
Stop sending empty sales quotes to Vantage Analytics.
1.0.1
-------
Improved robustness of historical data export process and report historical data export issues to Vantage Analytics.
1.0.0
-------
First stable release.
Download this release
Release Info
Developer | Brandon Kane |
Extension | VantageAnalytics_Analytics |
Version | 1.0.4 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.0.4
- app/code/community/VantageAnalytics/Analytics/Block/Adminhtml/Reset.php +1 -1
- app/code/community/VantageAnalytics/Analytics/Helper/Account.php +21 -0
- app/code/community/VantageAnalytics/Analytics/Helper/Pixel.php +14 -0
- app/code/community/VantageAnalytics/Analytics/Model/Api/Request.php +55 -13
- app/code/community/VantageAnalytics/Analytics/Model/Api/RequestQueue.php +13 -3
- app/code/community/VantageAnalytics/Analytics/Model/Api/Webhook.php +9 -7
- app/code/community/VantageAnalytics/Analytics/Model/Cron.php +8 -0
- app/code/community/VantageAnalytics/Analytics/Model/Export/Runner.php +2 -2
- app/code/community/VantageAnalytics/Analytics/Model/Pixel.php +75 -0
- app/code/community/VantageAnalytics/Analytics/controllers/Adminhtml/{AnalyticsbackendController.php → Analytics/AnalyticsbackendController.php} +1 -1
- app/code/community/VantageAnalytics/Analytics/controllers/Adminhtml/{ResetController.php → Analytics/ResetController.php} +1 -1
- app/code/community/VantageAnalytics/Analytics/etc/config.xml +14 -6
- app/design/adminhtml/default/default/layout/analytics.xml +4 -4
- app/design/adminhtml/default/default/template/analytics/analyticsbackend.phtml +1 -1
- app/design/frontend/base/default/layout/vantageanalytics_analytics.xml +18 -0
- app/design/frontend/base/default/template/vantageanalytics/analytics/conversion.phtml +16 -0
- app/design/frontend/base/default/template/vantageanalytics/analytics/visitor.phtml +17 -0
- package.xml +9 -5
app/code/community/VantageAnalytics/Analytics/Block/Adminhtml/Reset.php
CHANGED
@@ -4,7 +4,7 @@ class VantageAnalytics_Analytics_Block_Adminhtml_Reset extends Mage_Adminhtml_Bl
|
|
4 |
{
|
5 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
{
|
7 |
-
$resetUrl = $this->getUrl('
|
8 |
$this->setElement($element);
|
9 |
return $this->getLayout()
|
10 |
->createBlock('adminhtml/widget_button')
|
4 |
{
|
5 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
{
|
7 |
+
$resetUrl = $this->getUrl('adminhtml/analytics_reset/reset');
|
8 |
$this->setElement($element);
|
9 |
return $this->getLayout()
|
10 |
->createBlock('adminhtml/widget_button')
|
app/code/community/VantageAnalytics/Analytics/Helper/Account.php
CHANGED
@@ -39,6 +39,27 @@ class VantageAnalytics_Analytics_Helper_Account extends Mage_Core_Helper_Abstrac
|
|
39 |
return dirname($this->vantageUrl()) . '/notify/';
|
40 |
}
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
public function setVantageUrl($url)
|
43 |
{
|
44 |
Mage::getConfig()->saveConfig('vantageanalytics/accountoptions/vantageurl', $url);
|
39 |
return dirname($this->vantageUrl()) . '/notify/';
|
40 |
}
|
41 |
|
42 |
+
public function accountInfoUrl()
|
43 |
+
{
|
44 |
+
return dirname($this->vantageUrl()) . '/info';
|
45 |
+
}
|
46 |
+
|
47 |
+
public function accountPixelUrl()
|
48 |
+
{
|
49 |
+
return $this->appUrl() . 'ecom/pixel';
|
50 |
+
}
|
51 |
+
|
52 |
+
public function appUrl()
|
53 |
+
{
|
54 |
+
return Mage::getStoreConfig('vantageanalytics/accountoptions/app_url', Mage::app()->getStore());
|
55 |
+
}
|
56 |
+
|
57 |
+
public function setAppUrl($url)
|
58 |
+
{
|
59 |
+
Mage::getConfig()->saveConfig('vantageanalytics/accountoptions/app_url', $url);
|
60 |
+
Mage::getConfig()->reinit();
|
61 |
+
}
|
62 |
+
|
63 |
public function setVantageUrl($url)
|
64 |
{
|
65 |
Mage::getConfig()->saveConfig('vantageanalytics/accountoptions/vantageurl', $url);
|
app/code/community/VantageAnalytics/Analytics/Helper/Pixel.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class VantageAnalytics_Analytics_Helper_Pixel extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
public function getPixelURL()
|
6 |
+
{
|
7 |
+
return Mage::getStoreConfig("vantageanalytics/trackingpixel/url");
|
8 |
+
}
|
9 |
+
|
10 |
+
public function setPixelURL($url)
|
11 |
+
{
|
12 |
+
Mage::getConfig()->saveConfig('vantageanalytics/trackingpixel/url', $url);
|
13 |
+
}
|
14 |
+
}
|
app/code/community/VantageAnalytics/Analytics/Model/Api/Request.php
CHANGED
@@ -16,7 +16,7 @@ class VantageAnalytics_Analytics_Model_Api_Request
|
|
16 |
}
|
17 |
|
18 |
|
19 |
-
protected function setupCurl($method, $
|
20 |
{
|
21 |
$uri = "{$this->vantageUrl}/";
|
22 |
$channel = curl_init("$uri");
|
@@ -31,8 +31,8 @@ class VantageAnalytics_Analytics_Model_Api_Request
|
|
31 |
curl_setopt($channel, CURLOPT_RETURNTRANSFER, true);
|
32 |
curl_setopt($channel, CURLOPT_CONNECTTIMEOUT_MS, 24000);
|
33 |
|
34 |
-
$
|
35 |
-
$body = json_encode($
|
36 |
curl_setopt($channel, CURLOPT_POSTFIELDS, $body);
|
37 |
$headers = array(
|
38 |
'Content-type: application/json',
|
@@ -70,22 +70,19 @@ class VantageAnalytics_Analytics_Model_Api_Request
|
|
70 |
Mage::helper('analytics/log')->logError("Tried $attempt times, giving up");
|
71 |
throw new VantageAnalytics_Analytics_Model_Api_Exceptions_MaxRetries("Maximum retries exceeded");
|
72 |
}
|
73 |
-
$waitTimes = array(5, 30, 60, 5*60, 10*60, 30*60, 60*60);
|
74 |
$seconds = $waitTimes[$attempt];
|
75 |
Mage::helper('analytics/log')->logWarn("Waiting for {$seconds} seconds.");
|
76 |
sleep($seconds);
|
77 |
}
|
78 |
|
79 |
-
protected function execCurl($method, $
|
80 |
{
|
81 |
$attempts = 0;
|
82 |
$success = false;
|
83 |
while ($attempts < 5 && !$success) {
|
84 |
try {
|
85 |
-
$
|
86 |
-
$response = curl_exec($channel);
|
87 |
-
$this->raiseOnError($channel);
|
88 |
-
curl_close($channel);
|
89 |
$success = true;
|
90 |
} catch (VantageAnalytics_Analytics_Model_Api_Exceptions_ServerError $e) {
|
91 |
$this->wait($attempts);
|
@@ -99,11 +96,56 @@ class VantageAnalytics_Analytics_Model_Api_Request
|
|
99 |
return $response;
|
100 |
}
|
101 |
|
102 |
-
|
103 |
{
|
104 |
-
$
|
105 |
-
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
$this->execCurl("POST", $postData);
|
108 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
}
|
16 |
}
|
17 |
|
18 |
|
19 |
+
protected function setupCurl($method, $entity)
|
20 |
{
|
21 |
$uri = "{$this->vantageUrl}/";
|
22 |
$channel = curl_init("$uri");
|
31 |
curl_setopt($channel, CURLOPT_RETURNTRANSFER, true);
|
32 |
curl_setopt($channel, CURLOPT_CONNECTTIMEOUT_MS, 24000);
|
33 |
|
34 |
+
$entity['username'] = $this->apiUsername;
|
35 |
+
$body = json_encode($entity);
|
36 |
curl_setopt($channel, CURLOPT_POSTFIELDS, $body);
|
37 |
$headers = array(
|
38 |
'Content-type: application/json',
|
70 |
Mage::helper('analytics/log')->logError("Tried $attempt times, giving up");
|
71 |
throw new VantageAnalytics_Analytics_Model_Api_Exceptions_MaxRetries("Maximum retries exceeded");
|
72 |
}
|
73 |
+
$waitTimes = array(5, 30, 60, 5*60, 10*60, 30*60, 60*60, 4*60*60);
|
74 |
$seconds = $waitTimes[$attempt];
|
75 |
Mage::helper('analytics/log')->logWarn("Waiting for {$seconds} seconds.");
|
76 |
sleep($seconds);
|
77 |
}
|
78 |
|
79 |
+
protected function execCurl($method, $entity)
|
80 |
{
|
81 |
$attempts = 0;
|
82 |
$success = false;
|
83 |
while ($attempts < 5 && !$success) {
|
84 |
try {
|
85 |
+
$response = $this->execCurlNoRetry($method, $entity);
|
|
|
|
|
|
|
86 |
$success = true;
|
87 |
} catch (VantageAnalytics_Analytics_Model_Api_Exceptions_ServerError $e) {
|
88 |
$this->wait($attempts);
|
96 |
return $response;
|
97 |
}
|
98 |
|
99 |
+
protected function execCurlNoRetry($method, $entity)
|
100 |
{
|
101 |
+
$channel = $this->setupCurl($method, $entity);
|
102 |
+
$response = curl_exec($channel);
|
103 |
+
$this->raiseOnError($channel);
|
104 |
+
curl_close($channel);
|
105 |
+
return $response;
|
106 |
+
}
|
107 |
+
|
108 |
+
protected function _send($entityMethod, $entity, $isExport=false)
|
109 |
+
{
|
110 |
+
$webhookFactory = VantageAnalytics_Analytics_Model_Api_Webhook::factory(
|
111 |
+
$entity, $entityMethod
|
112 |
+
);
|
113 |
+
$postData = $webhookFactory->getPostData();
|
114 |
$this->execCurl("POST", $postData);
|
115 |
}
|
116 |
+
|
117 |
+
/*
|
118 |
+
* Post the $entity data to vantage satellite app.
|
119 |
+
*/
|
120 |
+
public function send($entityMethod, $entity)
|
121 |
+
{
|
122 |
+
$this->_send($entityMethod, $entity);
|
123 |
+
}
|
124 |
+
|
125 |
+
/*
|
126 |
+
* Same as send but sets the isExport flag to skip some calculations that
|
127 |
+
* don't need to run during imports.
|
128 |
+
*/
|
129 |
+
public function export($entityMethod, $entity)
|
130 |
+
{
|
131 |
+
$this->_send($entityMethod, $entity, true); // true: isExport
|
132 |
+
}
|
133 |
+
|
134 |
+
/*
|
135 |
+
* This is a more open ended version of send which does not assume method is POST
|
136 |
+
* or the url is the base URL and allows the user to control retries.
|
137 |
+
*/
|
138 |
+
public function request($method, $url, $data, $retryOnError=false)
|
139 |
+
{
|
140 |
+
$vantageUrl = $this->vantageUrl; // Save for later
|
141 |
+
|
142 |
+
$this->vantageUrl = $url;
|
143 |
+
if ($retryOnError) {
|
144 |
+
$response = $this->execCurl($method, $data);
|
145 |
+
} else {
|
146 |
+
$response = $this->execCurlNoRetry($method, $data);
|
147 |
+
}
|
148 |
+
$this->vantageUrl = $vantageUrl; // Restore the object's state to be a good citizen
|
149 |
+
return json_decode($response, true);
|
150 |
+
}
|
151 |
}
|
app/code/community/VantageAnalytics/Analytics/Model/Api/RequestQueue.php
CHANGED
@@ -2,13 +2,23 @@
|
|
2 |
|
3 |
class VantageAnalytics_Analytics_Model_Api_RequestQueue
|
4 |
{
|
5 |
-
public function enqueue($
|
6 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
$queue = Mage::helper('analytics/queue');
|
8 |
$queue->enqueue(array(
|
9 |
'class' => 'Api_Request',
|
10 |
-
'method' =>
|
11 |
-
'args' => array($
|
12 |
));
|
13 |
}
|
14 |
}
|
2 |
|
3 |
class VantageAnalytics_Analytics_Model_Api_RequestQueue
|
4 |
{
|
5 |
+
public function enqueue($entityMethod, $entity, $isExport=false)
|
6 |
{
|
7 |
+
// Api_Request::export was added after Api_Request::send to avoid
|
8 |
+
// potential serialization issues I have run into in the past when
|
9 |
+
// changing method signatures on serialized objects (these objects
|
10 |
+
// get serialized into the vantage_queue table).
|
11 |
+
if ($isExport) {
|
12 |
+
$method = 'export';
|
13 |
+
} else {
|
14 |
+
$method = 'send';
|
15 |
+
}
|
16 |
+
|
17 |
$queue = Mage::helper('analytics/queue');
|
18 |
$queue->enqueue(array(
|
19 |
'class' => 'Api_Request',
|
20 |
+
'method' => $method,
|
21 |
+
'args' => array($entityMethod, $entity)
|
22 |
));
|
23 |
}
|
24 |
}
|
app/code/community/VantageAnalytics/Analytics/Model/Api/Webhook.php
CHANGED
@@ -2,15 +2,16 @@
|
|
2 |
|
3 |
class VantageAnalytics_Analytics_Model_Api_Webhook
|
4 |
{
|
5 |
-
public function __construct($
|
6 |
{
|
7 |
-
$this->
|
8 |
$this->method = $method;
|
|
|
9 |
}
|
10 |
|
11 |
-
public static function factory($
|
12 |
{
|
13 |
-
return new self($
|
14 |
}
|
15 |
|
16 |
public function getPostData()
|
@@ -23,14 +24,15 @@ class VantageAnalytics_Analytics_Model_Api_Webhook
|
|
23 |
return array(
|
24 |
"webhook" => array(
|
25 |
"created" => $this->createdAt(),
|
26 |
-
"type" => $this->type()
|
|
|
27 |
),
|
28 |
);
|
29 |
}
|
30 |
|
31 |
public function body()
|
32 |
{
|
33 |
-
return array("body" => $this->
|
34 |
}
|
35 |
|
36 |
private function type()
|
@@ -47,6 +49,6 @@ class VantageAnalytics_Analytics_Model_Api_Webhook
|
|
47 |
|
48 |
private function _name()
|
49 |
{
|
50 |
-
return array_key_exists('entity_type', $this->
|
51 |
}
|
52 |
}
|
2 |
|
3 |
class VantageAnalytics_Analytics_Model_Api_Webhook
|
4 |
{
|
5 |
+
public function __construct($entity, $method, $isExport=false)
|
6 |
{
|
7 |
+
$this->entity = $entity;
|
8 |
$this->method = $method;
|
9 |
+
$this->isExport = $isExport;
|
10 |
}
|
11 |
|
12 |
+
public static function factory($entity, $method, $isExport=false)
|
13 |
{
|
14 |
+
return new self($entity, $method, $isExport);
|
15 |
}
|
16 |
|
17 |
public function getPostData()
|
24 |
return array(
|
25 |
"webhook" => array(
|
26 |
"created" => $this->createdAt(),
|
27 |
+
"type" => $this->type(),
|
28 |
+
"isExport" => $this->isExport
|
29 |
),
|
30 |
);
|
31 |
}
|
32 |
|
33 |
public function body()
|
34 |
{
|
35 |
+
return array("body" => $this->entity);
|
36 |
}
|
37 |
|
38 |
private function type()
|
49 |
|
50 |
private function _name()
|
51 |
{
|
52 |
+
return array_key_exists('entity_type', $this->entity) ? $this->entity['entity_type'] : "object";
|
53 |
}
|
54 |
}
|
app/code/community/VantageAnalytics/Analytics/Model/Cron.php
CHANGED
@@ -58,6 +58,12 @@ class VantageAnalytics_Analytics_Model_Cron
|
|
58 |
$export->run();
|
59 |
}
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
protected function accountIsVerified()
|
62 |
{
|
63 |
return Mage::helper('analytics/account')->isVerified();
|
@@ -75,6 +81,8 @@ class VantageAnalytics_Analytics_Model_Cron
|
|
75 |
return;
|
76 |
}
|
77 |
|
|
|
|
|
78 |
$this->runHistoricalExport();
|
79 |
|
80 |
if (!$this->accountIsVerified()) {
|
58 |
$export->run();
|
59 |
}
|
60 |
|
61 |
+
public function pollPixelUrls()
|
62 |
+
{
|
63 |
+
$pixel = Mage::getModel('analytics/Pixel');
|
64 |
+
$pixel->run();
|
65 |
+
}
|
66 |
+
|
67 |
protected function accountIsVerified()
|
68 |
{
|
69 |
return Mage::helper('analytics/account')->isVerified();
|
81 |
return;
|
82 |
}
|
83 |
|
84 |
+
$this->pollPixelUrls();
|
85 |
+
|
86 |
$this->runHistoricalExport();
|
87 |
|
88 |
if (!$this->accountIsVerified()) {
|
app/code/community/VantageAnalytics/Analytics/Model/Export/Runner.php
CHANGED
@@ -4,10 +4,10 @@ class VantageAnalytics_Analytics_Model_Export_Runner
|
|
4 |
{
|
5 |
|
6 |
|
7 |
-
protected function enqueue($method, $
|
8 |
{
|
9 |
$api = new VantageAnalytics_Analytics_Model_Api_RequestQueue();
|
10 |
-
$api->enqueue($method, $
|
11 |
}
|
12 |
|
13 |
public function run()
|
4 |
{
|
5 |
|
6 |
|
7 |
+
protected function enqueue($method, $entity)
|
8 |
{
|
9 |
$api = new VantageAnalytics_Analytics_Model_Api_RequestQueue();
|
10 |
+
$api->enqueue($method, $entity, true);
|
11 |
}
|
12 |
|
13 |
public function run()
|
app/code/community/VantageAnalytics/Analytics/Model/Pixel.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class VantageAnalytics_Analytics_Model_Pixel
|
3 |
+
{
|
4 |
+
public function requiresPixelUrl()
|
5 |
+
{
|
6 |
+
$stores = Mage::app()->getStores();
|
7 |
+
foreach ($stores as $store) {
|
8 |
+
$configPixelUrl = $store->getConfig('vantageanalytics/trackingpixel/url');
|
9 |
+
if (!$configPixelUrl) {
|
10 |
+
return true;
|
11 |
+
}
|
12 |
+
}
|
13 |
+
return false;
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getStoreOwnerIds()
|
17 |
+
{
|
18 |
+
$api = new VantageAnalytics_Analytics_Model_Api_Request();
|
19 |
+
$infoUrl = Mage::helper("analytics/account")->accountInfoUrl();
|
20 |
+
$data = $api->request('POST', $infoUrl, array());
|
21 |
+
if (array_key_exists('stores', $data)) {
|
22 |
+
return $data['stores'];
|
23 |
+
}
|
24 |
+
return array();
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getPixelUrls($ownerIds)
|
28 |
+
{
|
29 |
+
$api = new VantageAnalytics_Analytics_Model_Api_Request();
|
30 |
+
$pixelUrl = Mage::helper("analytics/account")->accountPixelUrl();
|
31 |
+
$data = $api->request('POST', $pixelUrl, array('owner_ids' => $ownerIds));
|
32 |
+
if (array_key_exists('pixels', $data)) {
|
33 |
+
return $data['pixels'];
|
34 |
+
}
|
35 |
+
return array();
|
36 |
+
}
|
37 |
+
|
38 |
+
public function updateStorePixelUrl($storeId, $pixelUrl)
|
39 |
+
{
|
40 |
+
$store = Mage::app()->getStore($storeId);
|
41 |
+
if ($store) {
|
42 |
+
$config = Mage::app()->getConfig();
|
43 |
+
$config->saveConfig('vantageanalytics/trackingpixel/url',
|
44 |
+
$pixelUrl, 'stores', $storeId);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
public function pollPixelUrls()
|
49 |
+
{
|
50 |
+
if ($this->requiresPixelUrl()) {
|
51 |
+
$stores = $this->getStoreOwnerIds();
|
52 |
+
$ownerIds = array();
|
53 |
+
$storeOwnerIdMap = array();
|
54 |
+
foreach ($stores as $store) {
|
55 |
+
$ownerIds[] = $store['owner_id'];
|
56 |
+
$storeOwnerIdMap[$store['owner_id']] = $store['store_id'];
|
57 |
+
}
|
58 |
+
$pixelUrls = $this->getPixelUrls($ownerIds);
|
59 |
+
foreach ($pixelUrls as $pixel) {
|
60 |
+
$storeId = $storeOwnerIdMap[$pixel['owner_id']];
|
61 |
+
$this->updateStorePixelUrl($storeId, $pixel['url']);
|
62 |
+
}
|
63 |
+
return $pixelUrls;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
public function run()
|
68 |
+
{
|
69 |
+
try {
|
70 |
+
$this->pollPixelUrls();
|
71 |
+
} catch (Exception $e) {
|
72 |
+
// don't crash the cron
|
73 |
+
}
|
74 |
+
}
|
75 |
+
}
|
app/code/community/VantageAnalytics/Analytics/controllers/Adminhtml/{AnalyticsbackendController.php → Analytics/AnalyticsbackendController.php}
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
public function indexAction()
|
6 |
{
|
1 |
<?php
|
2 |
|
3 |
+
class VantageAnalytics_Analytics_Adminhtml_Analytics_AnalyticsbackendController extends Mage_Adminhtml_Controller_Action
|
4 |
{
|
5 |
public function indexAction()
|
6 |
{
|
app/code/community/VantageAnalytics/Analytics/controllers/Adminhtml/{ResetController.php → Analytics/ResetController.php}
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
private function resetConfig()
|
6 |
{
|
1 |
<?php
|
2 |
|
3 |
+
class VantageAnalytics_Analytics_Adminhtml_Analytics_ResetController extends Mage_Adminhtml_Controller_Action
|
4 |
{
|
5 |
private function resetConfig()
|
6 |
{
|
app/code/community/VantageAnalytics/Analytics/etc/config.xml
CHANGED
@@ -137,17 +137,24 @@
|
|
137 |
</observers>
|
138 |
</sales_order_place_after>
|
139 |
</events>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
</frontend>
|
141 |
|
142 |
<admin>
|
143 |
<routers>
|
144 |
-
<
|
145 |
-
<use>admin</use>
|
146 |
<args>
|
147 |
-
<
|
148 |
-
|
|
|
149 |
</args>
|
150 |
-
</
|
151 |
</routers>
|
152 |
</admin>
|
153 |
|
@@ -156,7 +163,7 @@
|
|
156 |
<analytics module="analytics">
|
157 |
<title>Vantage</title>
|
158 |
<sort_order>100</sort_order>
|
159 |
-
<action>
|
160 |
</analytics>
|
161 |
</menu>
|
162 |
<acl>
|
@@ -209,6 +216,7 @@
|
|
209 |
<vantageanalytics>
|
210 |
<accountoptions>
|
211 |
<vantageurl>https://satellite.vantageanalytics.com/magento/webhook</vantageurl>
|
|
|
212 |
</accountoptions>
|
213 |
<export>
|
214 |
<done>0</done>
|
137 |
</observers>
|
138 |
</sales_order_place_after>
|
139 |
</events>
|
140 |
+
<layout>
|
141 |
+
<updates>
|
142 |
+
<vantageanalytics_analytics>
|
143 |
+
<file>vantageanalytics_analytics.xml</file>
|
144 |
+
</vantageanalytics_analytics>
|
145 |
+
</updates>
|
146 |
+
</layout>
|
147 |
</frontend>
|
148 |
|
149 |
<admin>
|
150 |
<routers>
|
151 |
+
<adminhtml>
|
|
|
152 |
<args>
|
153 |
+
<modules>
|
154 |
+
<analytics before="Mage_Adminhtml">VantageAnalytics_Analytics_Adminhtml</analytics>
|
155 |
+
</modules>
|
156 |
</args>
|
157 |
+
</adminhtml>
|
158 |
</routers>
|
159 |
</admin>
|
160 |
|
163 |
<analytics module="analytics">
|
164 |
<title>Vantage</title>
|
165 |
<sort_order>100</sort_order>
|
166 |
+
<action>adminhtml/analytics_analyticsbackend</action>
|
167 |
</analytics>
|
168 |
</menu>
|
169 |
<acl>
|
216 |
<vantageanalytics>
|
217 |
<accountoptions>
|
218 |
<vantageurl>https://satellite.vantageanalytics.com/magento/webhook</vantageurl>
|
219 |
+
<app_url>https://app.vantageanalytics.com/</app_url>
|
220 |
</accountoptions>
|
221 |
<export>
|
222 |
<done>0</done>
|
app/design/adminhtml/default/default/layout/analytics.xml
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<layout version="0.2.0">
|
3 |
-
<
|
4 |
<reference name="head">
|
5 |
<action method="addCss"><name>css/register.css</name></action>
|
6 |
</reference>
|
7 |
<reference name="content">
|
8 |
<block type="analytics/adminhtml_analyticsbackend" name="analyticsbackend" template="analytics/analyticsbackend.phtml"/>
|
9 |
</reference>
|
10 |
-
</
|
11 |
-
<
|
12 |
<reference name="head">
|
13 |
<action method="addCss"><name>css/register.css</name></action>
|
14 |
</reference>
|
15 |
<reference name="content">
|
16 |
<block type="analytics/adminhtml_analyticsbackend" name="analyticsbackend" template="analytics/analyticsbackend.phtml"/>
|
17 |
</reference>
|
18 |
-
</
|
19 |
</layout>
|
1 |
<?xml version="1.0"?>
|
2 |
<layout version="0.2.0">
|
3 |
+
<adminhtml_analytics_analyticsbackend_index>
|
4 |
<reference name="head">
|
5 |
<action method="addCss"><name>css/register.css</name></action>
|
6 |
</reference>
|
7 |
<reference name="content">
|
8 |
<block type="analytics/adminhtml_analyticsbackend" name="analyticsbackend" template="analytics/analyticsbackend.phtml"/>
|
9 |
</reference>
|
10 |
+
</adminhtml_analytics_analyticsbackend_index>
|
11 |
+
<adminhtml_analytics_analyticsbackend_register>
|
12 |
<reference name="head">
|
13 |
<action method="addCss"><name>css/register.css</name></action>
|
14 |
</reference>
|
15 |
<reference name="content">
|
16 |
<block type="analytics/adminhtml_analyticsbackend" name="analyticsbackend" template="analytics/analyticsbackend.phtml"/>
|
17 |
</reference>
|
18 |
+
</adminhtml_analytics_analyticsbackend_register>
|
19 |
</layout>
|
app/design/adminhtml/default/default/template/analytics/analyticsbackend.phtml
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
</p>
|
7 |
</div>
|
8 |
<?php else: ?>
|
9 |
-
<form action="<?php echo $this->getUrl('
|
10 |
<div class="va-register">
|
11 |
<img class="va-register-logo" src="<?php echo $this->getSkinUrl('images/vantage-for-magento.png'); ?>">
|
12 |
<p class="va-register-text">
|
6 |
</p>
|
7 |
</div>
|
8 |
<?php else: ?>
|
9 |
+
<form action="<?php echo $this->getUrl('adminhtml/analytics_analyticsbackend/register') ?>" id="registerform" name="registerform" method="post" enctype="multipart/form-data">
|
10 |
<div class="va-register">
|
11 |
<img class="va-register-logo" src="<?php echo $this->getSkinUrl('images/vantage-for-magento.png'); ?>">
|
12 |
<p class="va-register-text">
|
app/design/frontend/base/default/layout/vantageanalytics_analytics.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="before_body_end">
|
5 |
+
<block type="core/template" template="vantageanalytics/analytics/visitor.phtml" />
|
6 |
+
</reference>
|
7 |
+
</default>
|
8 |
+
<checkout_onepage_success translate="label">
|
9 |
+
<reference name="after_body_start">
|
10 |
+
<block type="core/template" template="vantageanalytics/analytics/conversion.phtml" />
|
11 |
+
</reference>
|
12 |
+
</checkout_onepage_success>
|
13 |
+
<checkout_multishipping_success translate="label">
|
14 |
+
<reference name="after_body_start">
|
15 |
+
<block type="core/template" template="vantageanalytics/analytics/conversion.phtml" />
|
16 |
+
</reference>
|
17 |
+
</checkout_multishipping_success>
|
18 |
+
</layout>
|
app/design/frontend/base/default/template/vantageanalytics/analytics/conversion.phtml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$helper = Mage::helper("analytics/pixel");
|
4 |
+
$url = $helper->getPixelURL();
|
5 |
+
if (!$url) {
|
6 |
+
return;
|
7 |
+
}
|
8 |
+
|
9 |
+
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
10 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
11 |
+
$totalPrice = round($order->getGrandTotal(), 2);
|
12 |
+
|
13 |
+
?>
|
14 |
+
<script>
|
15 |
+
window.$vantageCheckout = { totalPrice: <?php echo json_encode($totalPrice) ?> };
|
16 |
+
</script>
|
app/design/frontend/base/default/template/vantageanalytics/analytics/visitor.phtml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$helper = Mage::helper("analytics/pixel");
|
3 |
+
$url = $helper->getPixelURL();
|
4 |
+
if (!$url) {
|
5 |
+
return;
|
6 |
+
}
|
7 |
+
?>
|
8 |
+
<script>
|
9 |
+
(function() {
|
10 |
+
var head = document.getElementsByTagName('head')[0];
|
11 |
+
var script = document.createElement('script');
|
12 |
+
script.type = 'text/javascript';
|
13 |
+
script.src = '<?php echo $url ?>';
|
14 |
+
script.async = true;
|
15 |
+
head.appendChild(script);
|
16 |
+
})(window);
|
17 |
+
</script>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>VantageAnalytics_Analytics</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://vantageanalytics.com/legal/terms-of-use/">Commercial - Vantage</license>
|
7 |
<channel>community</channel>
|
@@ -25,7 +25,11 @@ Vantage also offers financial insights, such as month to date revenue, that show
|
|
25 |
With the customer segmentation tools Vantage offers, you can export a list of your highest value customers to offer discounts or exclusive offers in as little as 3 clicks!
|
26 |

|
27 |
For store owners with multiple locations or multiple ecommerce stores, we offer a multi-store management panel to monitor each store’s performance.</description>
|
28 |
-
<notes>1.0.
|
|
|
|
|
|
|
|
|
29 |
-------
|
30 |

|
31 |
Minor bug fix, do not send empty array() objects to Vantage Analytics
|
@@ -47,9 +51,9 @@ Improved robustness of historical data export process and report historical data
|
|
47 |

|
48 |
First stable release.</notes>
|
49 |
<authors><author><name>Brandon Kane</name><user>brandon</user><email>brandon@vantageanalytics.com</email></author></authors>
|
50 |
-
<date>2015-
|
51 |
-
<time>
|
52 |
-
<contents><target name="magecommunity"><dir name="VantageAnalytics"><dir name="Analytics"><dir name="Block"><dir name="Adminhtml"><file name="Analyticsbackend.php" hash="e305f2e7b0bfad28d84da570b27e7ab7"/><file name="Reset.php" hash="
|
53 |
<compatible/>
|
54 |
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
55 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>VantageAnalytics_Analytics</name>
|
4 |
+
<version>1.0.4</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://vantageanalytics.com/legal/terms-of-use/">Commercial - Vantage</license>
|
7 |
<channel>community</channel>
|
25 |
With the customer segmentation tools Vantage offers, you can export a list of your highest value customers to offer discounts or exclusive offers in as little as 3 clicks!
|
26 |

|
27 |
For store owners with multiple locations or multiple ecommerce stores, we offer a multi-store management panel to monitor each store’s performance.</description>
|
28 |
+
<notes>1.0.4
|
29 |
+
-------
|
30 |
+
New feature: facebook pixel based visitor and conversion tracking.
|
31 |
+

|
32 |
+
1.0.3
|
33 |
-------
|
34 |

|
35 |
Minor bug fix, do not send empty array() objects to Vantage Analytics
|
51 |

|
52 |
First stable release.</notes>
|
53 |
<authors><author><name>Brandon Kane</name><user>brandon</user><email>brandon@vantageanalytics.com</email></author></authors>
|
54 |
+
<date>2015-11-20</date>
|
55 |
+
<time>19:44:34</time>
|
56 |
+
<contents><target name="magecommunity"><dir name="VantageAnalytics"><dir name="Analytics"><dir name="Block"><dir name="Adminhtml"><file name="Analyticsbackend.php" hash="e305f2e7b0bfad28d84da570b27e7ab7"/><file name="Reset.php" hash="532930f826f191a37c21a9556936c3ce"/></dir></dir><dir name="Helper"><file name="Account.php" hash="270976db69e227162d35d1eb9a424d6b"/><file name="Data.php" hash="e2368bb846dc4e8090a31c2cd9b4dd64"/><file name="DateFormatter.php" hash="6e98a6efb5263f01a9d463faa1043d6e"/><dir name="Extension"><file name="Lister.php" hash="bcd42cde1226011937276f35b84043b0"/><file name="Pool.php" hash="198c0585d60c9c3cd0d161de43eed4cc"/></dir><file name="Log.php" hash="eeb557a144f1254d2f01970530eded32"/><file name="Pixel.php" hash="85e46cf2763f8cb73a4589f3fdb9f7f3"/><file name="Queue.php" hash="2d9b23e9b7d6f9847a444c2837ca1f2e"/><file name="Statuses.php" hash="9527eb737121cd34530c813aea52e962"/><file name="Tracking.php" hash="27ac8e7d194cb4b18712da1a6a8cf5be"/></dir><dir name="Model"><file name="AddressRetriever.php" hash="6d6761b08aa8d50f5473ee79b5211254"/><dir name="Api"><dir name="Exceptions"><file name="BadRequest.php" hash="90e31638b100c1f160b04a06a96c75f7"/><file name="CurlError.php" hash="cf82c3b693522cf86c02f9d1f1e83217"/><file name="MaxRetries.php" hash="2f2be83f975277cca1a5c0442d1e0cb3"/><file name="ServerError.php" hash="d68761c5e4e5e9666a4aa992db74a611"/></dir><file name="Request.php" hash="3f4cec01c8cb5e058f3d67fb63a3b5dd"/><file name="RequestQueue.php" hash="ab1ec911b14c9d5bb688ea5b8cac9395"/><file name="Secret.php" hash="7056e3d3ae2d54dda82191d9e51832f2"/><file name="Signature.php" hash="9769075f75e55e60442f6e7afe0964d6"/><file name="Username.php" hash="8e8b3b0ae689b615aa19db8608741db9"/><file name="Webhook.php" hash="e4bac72b798acfda514d96b02dc0046c"/></dir><file name="Cron.php" hash="c006c3b4858fcc4a79eeb7cd2a44c749"/><file name="Debug.php" hash="c24900a7e9ecbfeb8c0d9509f3f8e44d"/><dir name="Export"><file name="Base.php" hash="94c85e0918141f25f05ba3f525919608"/><file name="Customer.php" hash="8b06c4fb062e0a7ef0dceea299a632f8"/><file name="Order.php" hash="b019beb39d722ddb66055100a52d8e80"/><file name="Product.php" hash="26a5c6ca05b0eebce9bfc42c089f0b49"/><file name="Runner.php" hash="6bb5ea6e375a78c85b2452fd13235737"/><file name="Store.php" hash="d48abe7899dde0026c27a04317984d7e"/></dir><file name="Heartbeat.php" hash="110d7158f12a86e2dcc877b40c9a44d4"/><dir name="Observer"><file name="Base.php" hash="060b2bc4ae4a6d0cee00d1cf21556d83"/><file name="CatalogProduct.php" hash="c6e553ed6feb5173f0405e771a1203d3"/><file name="Customer.php" hash="0686ca80283a14d98358b8e7179c1269"/><file name="SalesOrder.php" hash="e406749cf6b8e74e341968f2707af82f"/><file name="SalesQuote.php" hash="0bae57dbbdf65f10b8dbb59314861cc9"/><file name="Tracking.php" hash="a8a95092168e0c917109bb4ce9c6d9a9"/></dir><file name="ParentProduct.php" hash="e15d56807edb680a7c880f88d3cc654c"/><file name="Pixel.php" hash="3ed3efdfa25231e1b57ce68cebde4c76"/><file name="ProductCategories.php" hash="b53d842897083c2ae4b4c4970c3d4c16"/><file name="ProductImages.php" hash="608c0444218733661dc94c214887cadd"/><file name="ProductOptions.php" hash="42fedb046f2ec7deb730239f8b9427d6"/><dir name="Queue"><dir name="Adapter"><file name="Db.php" hash="a1733dc68647c1f812afaf98ce3a26d9"/></dir></dir><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="a115284cf544ad06b799c552b1f8c5c1"/></dir></dir><file name="SubscriberInformation.php" hash="67816c4724238f275a73058553010e83"/><dir name="Transformer"><file name="Address.php" hash="f9f0f27abf5597d89763b55ea9946cd3"/><file name="Base.php" hash="8f766b0d85187de732db44b26a210773"/><file name="BaseSales.php" hash="7e248d70f07b24e50a92999696833101"/><file name="BaseSalesItem.php" hash="aa281fe585defda3844baffeb6dfa9f9"/><file name="Customer.php" hash="481e0972f572340c96a59da8f582dba9"/><file name="Product.php" hash="37d2546adf4af53598c7876f23fae86b"/><file name="SalesOrder.php" hash="9fb3aa63042873fa0f2f6dedc108e4f1"/><file name="SalesOrderLineItem.php" hash="b9ffe0e6278a700a851ee2256e24965b"/><file name="SalesQuote.php" hash="c1712d7eb2b440b4d9c77d9dab96717d"/><file name="SalesQuoteLineItem.php" hash="27687eba35dab7fdadad438aeb63bf03"/><file name="Store.php" hash="cde2395de468981b3b964184dd214afb"/></dir></dir><dir name="Test"><dir name="Model"><dir name="Api"><file name="Signature.php" hash="5db3d5f9456c7948ecb636c9fe2d4850"/></dir><file name="Base.php" hash="fa7cb987301c0d1f092146447bac1d35"/><file name="Config.php" hash="84a1043ecfe94e1ff52de06b1c63254e"/><dir name="Customer"><dir name="fixtures"><file name="simpleCustomer.yaml" hash="e6b22424ddc0940226344bcccf13c745"/></dir></dir><file name="Customer.php" hash="722d0096e8211b4b57485b24efced031"/><file name="DateFormatterTest.php" hash="b7f0ff0cddfb0cce1b73c6a8de8d74dc"/><dir name="LineItem"><dir name="fixtures"><file name="simpleOrder.yaml" hash="8d6ff7b4cf8c434631305b51fca7884c"/></dir></dir><file name="LineItem.php" hash="e35411c7d970af0b5913807830ffe45e"/><dir name="Observer"><file name="SalesQuote.php" hash="1a6380469b28386dfe42ed7bd3ee39f5"/></dir><dir name="Order"><dir name="fixtures"><file name="orderStatus.yaml" hash="a2786f2eda68ce0035f9edc8beaf9fee"/><file name="orderStatusCanceled.yaml" hash="800fcb6ee04f912e3e3f27efdbdafde3"/><file name="orderStatusComplete.yaml" hash="1c912c447d255f0afd096e6f32eace1c"/><file name="paymentStatusUnpaid.yaml" hash="c0d0a55eec973ad3ee3730ebc143a3b7"/></dir><dir name="providers"><file name="orderStatus.yaml" hash="e88ed6c1b39272f3f4767810a427613c"/></dir></dir><file name="Order.php" hash="24cefdde2b5bf68452f5c6301c1d5efc"/><dir name="Product"><dir name="fixtures"><file name="parentProduct.yaml" hash="931604baf487baa33cf78dc26548431c"/><file name="simpleProduct.yaml" hash="56b88f052816173a79780f43779df4ff"/></dir></dir><file name="Product.php" hash="9f22904ec0015355f6fbf2f287d5574d"/><file name="Webhook.php" hash="d34e01e88599529cf79b8cc27efad550"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Analytics"><file name="AnalyticsbackendController.php" hash="f7cc8f4030bad20d5108225ac84c77c9"/><file name="ResetController.php" hash="c45b58f6aaba218d7d271288add8780a"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="cdfb6a37810355796f416784ce7f5584"/><file name="config.xml" hash="534207999bd00fe15b1f56fe50dedd67"/><file name="system.xml" hash="96810a47632dbee35df743615ced3c41"/></dir><dir name="sql"><dir name="vantageanalytics_analytics_setup"><file name="install-0.1.0.php" hash="0e7150e283f1ece9251af3e3d2ce76aa"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="e61c872d2e3527d8fa9e8daf21d8fc2e"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="VantageAnalytics_Analytics.xml" hash="69ca3371e05fff3d8b1e89849e3fab32"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="analytics.xml" hash="3f5da1f21784db4d01111aa208914d27"/></dir><dir name="template"><dir name="analytics"><file name="analyticsbackend.phtml" hash="2eb2bc2ba45a071c17ad376553b46c9b"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="vantageanalytics_analytics.xml" hash="474402cfcca713298e88f50ff4fafe2c"/></dir><dir name="template"><dir name="vantageanalytics"><dir name="analytics"><file name="conversion.phtml" hash="c7442d4077cf1d3719b05f16ceda1c89"/><file name="visitor.phtml" hash="82c64d032b8b9dadff0c847c4538f6d9"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><file name="register.css" hash="704cc1e177a9353715d065cb0b8841d4"/></dir></dir></dir><dir name="base"><dir name="default"><dir name="images"><file name="vantage-for-magento.png" hash="36604b9b28ca5d8a7ff0ead39323eae9"/></dir></dir></dir></dir></target></contents>
|
57 |
<compatible/>
|
58 |
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
59 |
</package>
|