Version Notes
Adding support for Universal Analytics
Download this release
Release Info
Developer | Eduard G. Dumitrescu |
Extension | Intelivemetrics_Unityreports |
Version | 0.7.6 |
Comparing to | |
See all releases |
Code changes from version 0.7.5 to 0.7.6
- app/code/community/Intelivemetrics/Unityreports/Helper/Data.php +18 -17
- app/code/community/Intelivemetrics/Unityreports/Model/Observer.php +21 -20
- app/code/community/Intelivemetrics/Unityreports/Model/Utmz.php +31 -0
- app/code/community/Intelivemetrics/Unityreports/controllers/IndexController.php +1 -0
- app/code/community/Intelivemetrics/Unityreports/controllers/TestController.php +316 -0
- app/code/community/Intelivemetrics/Unityreports/etc/config.xml +9 -2
- app/code/community/Intelivemetrics/Unityreports/sql/unityreports_setup/mysql4-install-0.7.3.php +150 -0
- app/design/frontend/base/default/layout/unityreports.xml +9 -0
- js/intelivemetrics/unityreports/utmz-alternative.js +53 -0
- package.xml +5 -5
app/code/community/Intelivemetrics/Unityreports/Helper/Data.php
CHANGED
@@ -11,12 +11,12 @@
|
|
11 |
class Intelivemetrics_Unityreports_Helper_Data extends Mage_Core_Helper_Abstract {
|
12 |
|
13 |
protected $_loggers = null;
|
14 |
-
|
15 |
/**
|
16 |
* Check module is correctly setup and sync is activated
|
17 |
* @return boolean
|
18 |
*/
|
19 |
-
public function appIsOk($requireActiveSync=true){
|
20 |
//check license has been setup
|
21 |
if (!$this->getLicenseKey()) {
|
22 |
$this->debug('License Key hasn\'t been setup.');
|
@@ -87,14 +87,14 @@ class Intelivemetrics_Unityreports_Helper_Data extends Mage_Core_Helper_Abstract
|
|
87 |
|
88 |
if (defined('APPLICATION_ENV') && APPLICATION_ENV == 'testing') {
|
89 |
//if on testing, don't log errors throw exception
|
90 |
-
if($level<Zend_Log::WARN)
|
91 |
throw new Exception($message);
|
92 |
else
|
93 |
-
print('NOTICE('
|
94 |
-
}else{
|
95 |
//if not on testing don't log debug msg
|
96 |
-
if($level>Zend_Log::INFO){
|
97 |
-
return
|
98 |
}
|
99 |
}
|
100 |
|
@@ -111,32 +111,33 @@ class Intelivemetrics_Unityreports_Helper_Data extends Mage_Core_Helper_Abstract
|
|
111 |
* @return bool
|
112 |
*/
|
113 |
public function isDebug() {
|
114 |
-
|
|
|
|
|
115 |
}
|
116 |
-
|
117 |
/**
|
118 |
* Returns true if syncing is active (status select is ON)
|
119 |
* @return bool
|
120 |
*/
|
121 |
-
public function isActive(){
|
122 |
return (Mage::getStoreConfig(Intelivemetrics_Unityreports_Model_Config::XML_GENERAL_STATUS) === '1');
|
123 |
}
|
124 |
|
125 |
-
|
126 |
public function getLicenseKey() {
|
127 |
return Mage::getStoreConfig('unityreports/general/license_serial_number');
|
128 |
}
|
129 |
-
|
130 |
public function getApiKey() {
|
131 |
return Mage::getStoreConfig('unityreports/general/api_key');
|
132 |
}
|
133 |
-
|
134 |
public function getApiSecret() {
|
135 |
return Mage::getStoreConfig('unityreports/general/api_secret');
|
136 |
}
|
137 |
-
|
138 |
public function getEndpointUrl() {
|
139 |
-
return
|
140 |
}
|
141 |
|
142 |
/**
|
@@ -200,10 +201,10 @@ class Intelivemetrics_Unityreports_Helper_Data extends Mage_Core_Helper_Abstract
|
|
200 |
* @param array $condition = array('key'=>'active','val'=>'1')
|
201 |
* @return type
|
202 |
*/
|
203 |
-
public function getTableCount($tableName, $condition=array()) {
|
204 |
$table = Mage::getSingleton('core/resource')->getTableName($tableName);
|
205 |
$sql = "select count(*) ncount from $table";
|
206 |
-
if
|
207 |
$sql .= " WHERE {$condition['key']} = {$condition['val']}";
|
208 |
}
|
209 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
11 |
class Intelivemetrics_Unityreports_Helper_Data extends Mage_Core_Helper_Abstract {
|
12 |
|
13 |
protected $_loggers = null;
|
14 |
+
|
15 |
/**
|
16 |
* Check module is correctly setup and sync is activated
|
17 |
* @return boolean
|
18 |
*/
|
19 |
+
public function appIsOk($requireActiveSync = true) {
|
20 |
//check license has been setup
|
21 |
if (!$this->getLicenseKey()) {
|
22 |
$this->debug('License Key hasn\'t been setup.');
|
87 |
|
88 |
if (defined('APPLICATION_ENV') && APPLICATION_ENV == 'testing') {
|
89 |
//if on testing, don't log errors throw exception
|
90 |
+
if ($level < Zend_Log::WARN)
|
91 |
throw new Exception($message);
|
92 |
else
|
93 |
+
print('NOTICE(' . $level . '): ' . $message . "\n");
|
94 |
+
}else {
|
95 |
//if not on testing don't log debug msg
|
96 |
+
if ($level > Zend_Log::INFO) {
|
97 |
+
return;
|
98 |
}
|
99 |
}
|
100 |
|
111 |
* @return bool
|
112 |
*/
|
113 |
public function isDebug() {
|
114 |
+
$testing = (defined('APPLICATION_ENV') && APPLICATION_ENV == 'testing' ? true : false);
|
115 |
+
$debug = (Mage::getStoreConfig('unityreports/advanced/debug_status') > 0 ? true : false);
|
116 |
+
return ($debug || $testing);
|
117 |
}
|
118 |
+
|
119 |
/**
|
120 |
* Returns true if syncing is active (status select is ON)
|
121 |
* @return bool
|
122 |
*/
|
123 |
+
public function isActive() {
|
124 |
return (Mage::getStoreConfig(Intelivemetrics_Unityreports_Model_Config::XML_GENERAL_STATUS) === '1');
|
125 |
}
|
126 |
|
|
|
127 |
public function getLicenseKey() {
|
128 |
return Mage::getStoreConfig('unityreports/general/license_serial_number');
|
129 |
}
|
130 |
+
|
131 |
public function getApiKey() {
|
132 |
return Mage::getStoreConfig('unityreports/general/api_key');
|
133 |
}
|
134 |
+
|
135 |
public function getApiSecret() {
|
136 |
return Mage::getStoreConfig('unityreports/general/api_secret');
|
137 |
}
|
138 |
+
|
139 |
public function getEndpointUrl() {
|
140 |
+
return Mage::getStoreConfig('unityreports/general/ws_endpoint');
|
141 |
}
|
142 |
|
143 |
/**
|
201 |
* @param array $condition = array('key'=>'active','val'=>'1')
|
202 |
* @return type
|
203 |
*/
|
204 |
+
public function getTableCount($tableName, $condition = array()) {
|
205 |
$table = Mage::getSingleton('core/resource')->getTableName($tableName);
|
206 |
$sql = "select count(*) ncount from $table";
|
207 |
+
if ((isset($condition['key']) && !empty($condition['key'])) && (isset($condition['val']) && !empty($condition['val']))) {
|
208 |
$sql .= " WHERE {$condition['key']} = {$condition['val']}";
|
209 |
}
|
210 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
app/code/community/Intelivemetrics/Unityreports/Model/Observer.php
CHANGED
@@ -24,14 +24,30 @@ class Intelivemetrics_Unityreports_Model_Observer {
|
|
24 |
*/
|
25 |
public function orderAddCampaignInfo($observer) {
|
26 |
$order = $observer->getEvent()->getOrder();
|
27 |
-
|
28 |
$utmz = Mage::getModel('unityreports/utmz');
|
29 |
-
|
30 |
$this->_saveCampaignInfo($order->getId(), $utmz->utmz_source, $utmz->utmz_medium, $utmz->utmz_content, $utmz->utmz_campaign);
|
31 |
-
} catch (Exception $ex) {
|
32 |
-
Mage::helper('unityreports')->debug($ex->getMessage(), Zend_Log::ERR);
|
33 |
-
Mage::helper('unityreports')->debug('FILE: ' . __FILE__ . 'LINE: ' . __LINE__);
|
34 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
}
|
36 |
}
|
37 |
|
@@ -118,21 +134,6 @@ class Intelivemetrics_Unityreports_Model_Observer {
|
|
118 |
}
|
119 |
}
|
120 |
|
121 |
-
/**
|
122 |
-
* Track customer acquisition
|
123 |
-
* @param type $observer
|
124 |
-
*/
|
125 |
-
public function customerAddCampaignInfo($observer) {
|
126 |
-
$customer = $observer->getEvent()->getCustomer();
|
127 |
-
if ($_COOKIE['__utmz']) {
|
128 |
-
$utmz = Mage::getModel('unityreports/utmz');
|
129 |
-
try {
|
130 |
-
$this->_saveCampaignInfo($customer->getId(), $utmz->utmz_source, $utmz->utmz_medium, $utmz->utmz_content, $utmz->utmz_campaign, 'customer');
|
131 |
-
} catch (Exception $ex) {
|
132 |
-
//don't log these error because it will fire on each customer update
|
133 |
-
}
|
134 |
-
}
|
135 |
-
}
|
136 |
|
137 |
}
|
138 |
|
24 |
*/
|
25 |
public function orderAddCampaignInfo($observer) {
|
26 |
$order = $observer->getEvent()->getOrder();
|
27 |
+
try {
|
28 |
$utmz = Mage::getModel('unityreports/utmz');
|
29 |
+
if ($utmz->utmz) {
|
30 |
$this->_saveCampaignInfo($order->getId(), $utmz->utmz_source, $utmz->utmz_medium, $utmz->utmz_content, $utmz->utmz_campaign);
|
|
|
|
|
|
|
31 |
}
|
32 |
+
} catch (Exception $ex) {
|
33 |
+
Mage::helper('unityreports')->debug($ex->getMessage(), Zend_Log::ERR);
|
34 |
+
Mage::helper('unityreports')->debug('FILE: ' . __FILE__ . 'LINE: ' . __LINE__);
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Track customer acquisition
|
40 |
+
* @param type $observer
|
41 |
+
*/
|
42 |
+
public function customerAddCampaignInfo($observer) {
|
43 |
+
$customer = $observer->getEvent()->getCustomer();
|
44 |
+
try {
|
45 |
+
$utmz = Mage::getModel('unityreports/utmz');
|
46 |
+
if ($utmz->utmz) {
|
47 |
+
$this->_saveCampaignInfo($customer->getId(), $utmz->utmz_source, $utmz->utmz_medium, $utmz->utmz_content, $utmz->utmz_campaign, 'customer');
|
48 |
+
}
|
49 |
+
} catch (Exception $ex) {
|
50 |
+
//don't log these error because it will fire on each customer update
|
51 |
}
|
52 |
}
|
53 |
|
134 |
}
|
135 |
}
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
|
138 |
}
|
139 |
|
app/code/community/Intelivemetrics/Unityreports/Model/Utmz.php
CHANGED
@@ -32,6 +32,10 @@ class Intelivemetrics_Unityreports_Model_Utmz {
|
|
32 |
if (isset($_COOKIE['__utmz'])) {
|
33 |
$this->utmz = $_COOKIE['__utmz'];
|
34 |
$this->_parse_utmz();
|
|
|
|
|
|
|
|
|
35 |
} else
|
36 |
return false;
|
37 |
}
|
@@ -80,6 +84,33 @@ class Intelivemetrics_Unityreports_Model_Utmz {
|
|
80 |
}
|
81 |
}
|
82 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
|
84 |
}
|
85 |
|
32 |
if (isset($_COOKIE['__utmz'])) {
|
33 |
$this->utmz = $_COOKIE['__utmz'];
|
34 |
$this->_parse_utmz();
|
35 |
+
} elseif (isset($_COOKIE['__utmza'])) {
|
36 |
+
//this is set by the utmz-aternative.js script
|
37 |
+
$this->utmz = $_COOKIE['__utmza'];
|
38 |
+
$this->_parse_utmza();
|
39 |
} else
|
40 |
return false;
|
41 |
}
|
84 |
}
|
85 |
}
|
86 |
}
|
87 |
+
|
88 |
+
private function _parse_utmza() {
|
89 |
+
//break apart second half of cookie
|
90 |
+
$utmzPairs = array();
|
91 |
+
$z = explode('|', $this->utmz);
|
92 |
+
foreach ($z as $value) {
|
93 |
+
$v = explode('=', $value);
|
94 |
+
$utmzPairs[$v[0]] = $v[1];
|
95 |
+
}
|
96 |
+
|
97 |
+
//Variable assignment for second half of cookie
|
98 |
+
foreach ($utmzPairs as $key => $value) {
|
99 |
+
switch ($key) {
|
100 |
+
case 's':
|
101 |
+
$this->utmz_source = $value;
|
102 |
+
break;
|
103 |
+
case 'm':
|
104 |
+
$this->utmz_medium = $value;
|
105 |
+
break;
|
106 |
+
case 'c':
|
107 |
+
$this->utmz_campaign = $value;
|
108 |
+
break;
|
109 |
+
default:
|
110 |
+
//do nothing
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
114 |
|
115 |
}
|
116 |
|
app/code/community/Intelivemetrics/Unityreports/controllers/IndexController.php
CHANGED
@@ -70,4 +70,5 @@ class Intelivemetrics_Unityreports_IndexController extends Mage_Adminhtml_Contro
|
|
70 |
$this->_redirectReferer();
|
71 |
}
|
72 |
|
|
|
73 |
}
|
70 |
$this->_redirectReferer();
|
71 |
}
|
72 |
|
73 |
+
|
74 |
}
|
app/code/community/Intelivemetrics/Unityreports/controllers/TestController.php
ADDED
@@ -0,0 +1,316 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Controller for self testing action
|
5 |
+
*
|
6 |
+
* @category Unityreports
|
7 |
+
* @package Intelivemetrics_Unityreports
|
8 |
+
* @copyright Copyright (c) 2014 Intelive Metrics Srl
|
9 |
+
* @author Eduard Gabriel Dumitrescu (balaur@gmail.com)
|
10 |
+
*/
|
11 |
+
class Intelivemetrics_Unityreports_TestController extends Mage_Core_Controller_Front_Action {
|
12 |
+
|
13 |
+
/**
|
14 |
+
//Magento Cron Job Monitor. GNU/GPL
|
15 |
+
//oliver.higgins@gmail.com
|
16 |
+
//provided without warranty or support
|
17 |
+
//
|
18 |
+
//modifications by chiefair to retrieve Magento connection and database
|
19 |
+
//info, display time, connection info and all job execution states
|
20 |
+
*/
|
21 |
+
protected function _cron() {
|
22 |
+
/** Get current date, time, UTC and offset * */
|
23 |
+
$date = date("Y-m-d");
|
24 |
+
$time = date("H:i:s T");
|
25 |
+
$offset = date("P");
|
26 |
+
$utc = gmdate("H:i:s");
|
27 |
+
|
28 |
+
/** Mage locations * */
|
29 |
+
$mageconf = dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . '/etc/local.xml'; // Mage local.xml config
|
30 |
+
|
31 |
+
/* * *****************
|
32 |
+
* Let George do it
|
33 |
+
* Get connection information from Magento's local.xml file
|
34 |
+
* ***************** */
|
35 |
+
|
36 |
+
if (is_file($mageconf)) {
|
37 |
+
$xml = simplexml_load_file($mageconf, NULL, LIBXML_NOCDATA);
|
38 |
+
$db['host'] = $xml->global->resources->default_setup->connection->host;
|
39 |
+
$db['name'] = $xml->global->resources->default_setup->connection->dbname;
|
40 |
+
$db['user'] = $xml->global->resources->default_setup->connection->username;
|
41 |
+
$db['pass'] = $xml->global->resources->default_setup->connection->password;
|
42 |
+
$db['pref'] = $xml->global->resources->db->table_prefix;
|
43 |
+
$tblname = $db['pref'] . "cron_schedule";
|
44 |
+
} else {
|
45 |
+
exit("Failed to open $mageconf");
|
46 |
+
}
|
47 |
+
|
48 |
+
/* Initialize profile to be run as Magento Admin and log start of export */
|
49 |
+
|
50 |
+
// require_once $mageapp;
|
51 |
+
umask(0);
|
52 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
53 |
+
|
54 |
+
$storetimestamp = Mage::getModel('core/date')->timestamp(time());
|
55 |
+
|
56 |
+
$storetime = date("H:i:s", $storetimestamp);
|
57 |
+
|
58 |
+
/* * **********************
|
59 |
+
* Start HTML output
|
60 |
+
* ********************** */
|
61 |
+
|
62 |
+
echo '<html><head><title>Magento Cron Schedule on ' . $date . ' ' . $time . '</title>
|
63 |
+
<meta http-equiv="refresh" content="60">
|
64 |
+
<style type="text/css">html {width: 100%; font-family: Arial,Helvetica, sans-serif;}
|
65 |
+
body {line-height:1.0em; font-size: 100%;}
|
66 |
+
table {border-spacing: 1px; width: 100%;}
|
67 |
+
th.stattitle {text-align: left; font-size: 100%; font-weight: bold; color: white; background-color: #101010;}
|
68 |
+
th {text-align: center; font-size: 80%; font-weight: bold; padding: 5px; border-bottom: 1px solid black; border-left: 1px solid black; }
|
69 |
+
td {text-align: left; font-size: 80%; padding: 4px; border-bottom: 1px solid black; border-left: 1px solid black;}
|
70 |
+
</style>
|
71 |
+
</head><body>';
|
72 |
+
|
73 |
+
/** Output title, connection info and cron job monitor runtime * */
|
74 |
+
echo "<h2>Magento Cron Schedule Report</h2><h3>Connection: " . $db['user'] . "@" . $db['host'] . " – Database: " . $db['name'] . " – Table: " . $tblname . "</h3>";
|
75 |
+
echo "<h4>Runtime: " . $date . " Server: " . $time . " Store: " . $storetime . " Zulu: " . $utc . " UTC</h4>";
|
76 |
+
echo "<h4>Note: All logged times are UTC, your server timezone offset is " . $offset . " hours from UTC</h4>";
|
77 |
+
|
78 |
+
/** Connect to database * */
|
79 |
+
$conn = mysql_connect($db['host'], $db['user'], $db['pass']);
|
80 |
+
@mysql_select_db($db['name']) or die(mysql_error());
|
81 |
+
|
82 |
+
//================================================================
|
83 |
+
//Pending jobs
|
84 |
+
|
85 |
+
$query = 'SELECT * FROM ' . $tblname . ' WHERE status ="pending" ORDER BY scheduled_at DESC';
|
86 |
+
$result = mysql_query($query);
|
87 |
+
$num = mysql_numrows($result);
|
88 |
+
echo '<table><tbody><tr><th class="stattitle" colspan="5">Jobs Pending: ' . $num . '</th></tr>';
|
89 |
+
echo "<tr><th>ID</th><th>Job Code</th><th>Status</th><th>Created At</th><th>Scheduled At</th>";
|
90 |
+
$i = 0;
|
91 |
+
while ($i < $num) {
|
92 |
+
|
93 |
+
$schedule_id = mysql_result($result, $i, "schedule_id");
|
94 |
+
$job_code = mysql_result($result, $i, "job_code");
|
95 |
+
$status = mysql_result($result, $i, "status");
|
96 |
+
$created_at = mysql_result($result, $i, "created_at");
|
97 |
+
$scheduled_at = mysql_result($result, $i, "scheduled_at");
|
98 |
+
$executed_at = mysql_result($result, $i, "executed_at");
|
99 |
+
$finished_at = mysql_result($result, $i, "finished_at");
|
100 |
+
|
101 |
+
//output html
|
102 |
+
echo "<tr>";
|
103 |
+
echo "<td>" . $schedule_id . "</td>";
|
104 |
+
echo '<td>' . $job_code . "</td>";
|
105 |
+
echo '<td style="color: red;">' . $status . "</td>";
|
106 |
+
echo "<td>" . $created_at . "</td>";
|
107 |
+
echo "<td>" . $scheduled_at . "</td>";
|
108 |
+
echo "</tr>";
|
109 |
+
$i++;
|
110 |
+
}
|
111 |
+
echo "</tbody></table><hr>";
|
112 |
+
|
113 |
+
//================================================================
|
114 |
+
//Running jobs
|
115 |
+
|
116 |
+
$query = 'SELECT * FROM ' . $tblname . ' WHERE status ="running" ORDER BY executed_at DESC';
|
117 |
+
$result = mysql_query($query);
|
118 |
+
$num = mysql_numrows($result);
|
119 |
+
echo '<table><tbody><th class="stattitle" colspan="7">Jobs Running: ' . $num . '</th></tr>';
|
120 |
+
echo "<tr><th>ID</th><th>Job Code</th><th>Status</th><th>Created At</th><th>Scheduled At</th>";
|
121 |
+
echo "<th>Executed At</th><th>Finished At</th></tr>";
|
122 |
+
$i = 0;
|
123 |
+
while ($i < $num) {
|
124 |
+
|
125 |
+
$schedule_id = mysql_result($result, $i, "schedule_id");
|
126 |
+
$job_code = mysql_result($result, $i, "job_code");
|
127 |
+
$status = mysql_result($result, $i, "status");
|
128 |
+
$created_at = mysql_result($result, $i, "created_at");
|
129 |
+
$scheduled_at = mysql_result($result, $i, "scheduled_at");
|
130 |
+
$executed_at = mysql_result($result, $i, "executed_at");
|
131 |
+
$finished_at = mysql_result($result, $i, "finished_at");
|
132 |
+
|
133 |
+
//output html
|
134 |
+
echo "<tr>";
|
135 |
+
echo "<td>" . $schedule_id . "</td>";
|
136 |
+
echo "<td>" . $job_code . "</td>";
|
137 |
+
echo "<td>" . $status . "</td>";
|
138 |
+
echo "<td>" . $created_at . "</td>";
|
139 |
+
echo "<td>" . $scheduled_at . "</td>";
|
140 |
+
echo "<td>" . $executed_at . "</td>";
|
141 |
+
echo "<td>" . $finished_at . "</td>";
|
142 |
+
echo "</tr>";
|
143 |
+
$i++;
|
144 |
+
}
|
145 |
+
echo "</tbody>";
|
146 |
+
|
147 |
+
//================================================================
|
148 |
+
//Succsessful jobs
|
149 |
+
|
150 |
+
$query = 'SELECT * FROM ' . $tblname . ' WHERE status ="success" ORDER BY executed_at DESC';
|
151 |
+
$result = mysql_query($query);
|
152 |
+
$num = mysql_numrows($result);
|
153 |
+
echo '<tbody><tr><th class="stattitle" colspan="7">Jobs Successful: ' . $num . '</th></tr>';
|
154 |
+
echo "<tr><th>ID</th><th>Job Code</th><th>Status</th><th>Created At</th><th>Scheduled At</th>";
|
155 |
+
echo "<th>Executed At</th><th>Finished At</th></tr>";
|
156 |
+
$i = 0;
|
157 |
+
while ($i < $num) {
|
158 |
+
|
159 |
+
$schedule_id = mysql_result($result, $i, "schedule_id");
|
160 |
+
$job_code = mysql_result($result, $i, "job_code");
|
161 |
+
$status = mysql_result($result, $i, "status");
|
162 |
+
$created_at = mysql_result($result, $i, "created_at");
|
163 |
+
$scheduled_at = mysql_result($result, $i, "scheduled_at");
|
164 |
+
$executed_at = mysql_result($result, $i, "executed_at");
|
165 |
+
$finished_at = mysql_result($result, $i, "finished_at");
|
166 |
+
|
167 |
+
//output html
|
168 |
+
echo "<tr>";
|
169 |
+
echo "<td>" . $schedule_id . "</td>";
|
170 |
+
echo "<td>" . $job_code . "</td>";
|
171 |
+
echo "<td>" . $status . "</td>";
|
172 |
+
echo "<td>" . $created_at . "</td>";
|
173 |
+
echo "<td>" . $scheduled_at . "</td>";
|
174 |
+
echo "<td>" . $executed_at . "</td>";
|
175 |
+
echo "<td>" . $finished_at . "</td>";
|
176 |
+
echo "</tr>";
|
177 |
+
$i++;
|
178 |
+
}
|
179 |
+
echo "</tbody>";
|
180 |
+
|
181 |
+
//================================================================
|
182 |
+
//Missed jobs
|
183 |
+
|
184 |
+
$query = 'SELECT * FROM ' . $tblname . ' WHERE status ="missed" ORDER BY executed_at DESC';
|
185 |
+
$result = mysql_query($query);
|
186 |
+
$num = mysql_numrows($result);
|
187 |
+
echo '<tbody><tr><th class="stattitle" colspan="7">Jobs Missed: ' . $num . '</th></tr>';
|
188 |
+
echo "<tr><th>ID</th><th>Job Code</th><th>Status</th><th>Created At</th><th>Scheduled At</th>";
|
189 |
+
echo "<th>Executed At</th><th>Finished At</th></tr>";
|
190 |
+
$i = 0;
|
191 |
+
while ($i < $num) {
|
192 |
+
|
193 |
+
$schedule_id = mysql_result($result, $i, "schedule_id");
|
194 |
+
$job_code = mysql_result($result, $i, "job_code");
|
195 |
+
$status = mysql_result($result, $i, "status");
|
196 |
+
$created_at = mysql_result($result, $i, "created_at");
|
197 |
+
$scheduled_at = mysql_result($result, $i, "scheduled_at");
|
198 |
+
$executed_at = mysql_result($result, $i, "executed_at");
|
199 |
+
$finished_at = mysql_result($result, $i, "finished_at");
|
200 |
+
|
201 |
+
//output html
|
202 |
+
echo "<tr>";
|
203 |
+
echo "<td>" . $schedule_id . "</td>";
|
204 |
+
echo "<td>" . $job_code . "</td>";
|
205 |
+
echo "<td>" . $status . "</td>";
|
206 |
+
echo "<td>" . $created_at . "</td>";
|
207 |
+
echo "<td>" . $scheduled_at . "</td>";
|
208 |
+
echo "<td>" . $executed_at . "</td>";
|
209 |
+
echo "<td>" . $finished_at . "</td>";
|
210 |
+
echo "</tr>";
|
211 |
+
$i++;
|
212 |
+
}
|
213 |
+
echo "</tbody>";
|
214 |
+
|
215 |
+
//================================================================
|
216 |
+
//Failed jobs
|
217 |
+
|
218 |
+
$query = 'SELECT * FROM ' . $tblname . ' WHERE status ="error" ORDER BY executed_at DESC';
|
219 |
+
$result = mysql_query($query);
|
220 |
+
$num = mysql_numrows($result);
|
221 |
+
echo '<tbody><tr><th class="stattitle" colspan="7">Jobs Failed: ' . $num . '</th></tr>';
|
222 |
+
echo "<tr><th>ID</th><th>Job Code</th><th>Status</th><th>Created At</th><th>Scheduled At</th>";
|
223 |
+
echo "<th>Executed At</th><th>Finished At</th></tr>";
|
224 |
+
$i = 0;
|
225 |
+
while ($i < $num) {
|
226 |
+
|
227 |
+
$schedule_id = mysql_result($result, $i, "schedule_id");
|
228 |
+
$job_code = mysql_result($result, $i, "job_code");
|
229 |
+
$status = mysql_result($result, $i, "status");
|
230 |
+
$created_at = mysql_result($result, $i, "created_at");
|
231 |
+
$scheduled_at = mysql_result($result, $i, "scheduled_at");
|
232 |
+
$executed_at = mysql_result($result, $i, "executed_at");
|
233 |
+
$finished_at = mysql_result($result, $i, "finished_at");
|
234 |
+
|
235 |
+
//output html
|
236 |
+
echo "<tr>";
|
237 |
+
echo "<td>" . $schedule_id . "</td>";
|
238 |
+
echo "<td>" . $job_code . "</td>";
|
239 |
+
echo "<td>" . $status . "</td>";
|
240 |
+
echo "<td>" . $created_at . "</td>";
|
241 |
+
echo "<td>" . $scheduled_at . "</td>";
|
242 |
+
echo "<td>" . $executed_at . "</td>";
|
243 |
+
echo "<td>" . $finished_at . "</td>";
|
244 |
+
echo "</tr>";
|
245 |
+
$i++;
|
246 |
+
}
|
247 |
+
echo "</tbody></table></body></html>";
|
248 |
+
|
249 |
+
//================================================================
|
250 |
+
// End of report
|
251 |
+
|
252 |
+
mysql_close($conn);
|
253 |
+
}
|
254 |
+
|
255 |
+
protected function _sync() {
|
256 |
+
Mage::getModel('unityreports/cron_sync')->runSync();
|
257 |
+
}
|
258 |
+
protected function _request() {
|
259 |
+
Mage::getModel('unityreports/cron_request')->check();
|
260 |
+
}
|
261 |
+
protected function _abcarts() {
|
262 |
+
Mage::getModel('unityreports/sync_abcart')->runSync();
|
263 |
+
}
|
264 |
+
protected function _customers() {
|
265 |
+
Mage::getModel('unityreports/sync_customer')->runSync();
|
266 |
+
}
|
267 |
+
protected function _actions() {
|
268 |
+
Mage::getModel('unityreports/sync_customerAction')->runSync();
|
269 |
+
}
|
270 |
+
protected function _invoices() {
|
271 |
+
Mage::getModel('unityreports/sync_invoice')->runSync();
|
272 |
+
}
|
273 |
+
protected function _orders() {
|
274 |
+
Mage::getModel('unityreports/sync_order')->runSync();
|
275 |
+
}
|
276 |
+
protected function _returns() {
|
277 |
+
Mage::getModel('unityreports/sync_creditnote')->runSync();
|
278 |
+
}
|
279 |
+
protected function _products() {
|
280 |
+
Mage::getModel('unityreports/sync_product')->runSync();
|
281 |
+
}
|
282 |
+
protected function _counters() {
|
283 |
+
Mage::getModel('unityreports/cron_count')->runSync();
|
284 |
+
}
|
285 |
+
protected function _variations() {
|
286 |
+
Mage::getModel('unityreports/sync_productVariation')->runSync();
|
287 |
+
}
|
288 |
+
|
289 |
+
public function indexAction() {
|
290 |
+
define('APPLICATION_ENV', 'testing');
|
291 |
+
$helper = Mage::helper('unityreports');
|
292 |
+
$key = strip_tags($this->getRequest()->getParam('key'));
|
293 |
+
//check we have key
|
294 |
+
if (!$key) {
|
295 |
+
die('Missing Key Param');
|
296 |
+
}
|
297 |
+
$test = strip_tags($this->getRequest()->getParam('test'));
|
298 |
+
//check we have test name
|
299 |
+
if (!$test) {
|
300 |
+
die('Missing Test Name Param');
|
301 |
+
}
|
302 |
+
//check hey is ok
|
303 |
+
if ($key != $helper->getApiKey()) {
|
304 |
+
die('Key is Wrong');
|
305 |
+
}
|
306 |
+
|
307 |
+
echo "<pre>";
|
308 |
+
try {
|
309 |
+
$this->{'_' . $test}();
|
310 |
+
} catch (Exception $ex) {
|
311 |
+
echo $ex;
|
312 |
+
}
|
313 |
+
echo "</pre>";
|
314 |
+
}
|
315 |
+
|
316 |
+
}
|
app/code/community/Intelivemetrics/Unityreports/etc/config.xml
CHANGED
@@ -57,7 +57,7 @@
|
|
57 |
</entities>
|
58 |
</unityreports_resource>
|
59 |
</models>
|
60 |
-
|
61 |
<unityreports_setup>
|
62 |
<setup>
|
63 |
<module>Intelivemetrics_Unityreports</module>
|
@@ -170,7 +170,7 @@
|
|
170 |
<ws_endpoint>https://ws.unityreports.com/ws</ws_endpoint>
|
171 |
</general>
|
172 |
<advanced>
|
173 |
-
<debug_status>
|
174 |
</advanced>
|
175 |
</unityreports>
|
176 |
</default>
|
@@ -195,5 +195,12 @@
|
|
195 |
</observers>
|
196 |
</controller_action_layout_generate_blocks_before>
|
197 |
</events>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
</frontend>
|
199 |
</config>
|
57 |
</entities>
|
58 |
</unityreports_resource>
|
59 |
</models>
|
60 |
+
<resources>
|
61 |
<unityreports_setup>
|
62 |
<setup>
|
63 |
<module>Intelivemetrics_Unityreports</module>
|
170 |
<ws_endpoint>https://ws.unityreports.com/ws</ws_endpoint>
|
171 |
</general>
|
172 |
<advanced>
|
173 |
+
<debug_status>0</debug_status>
|
174 |
</advanced>
|
175 |
</unityreports>
|
176 |
</default>
|
195 |
</observers>
|
196 |
</controller_action_layout_generate_blocks_before>
|
197 |
</events>
|
198 |
+
<layout>
|
199 |
+
<updates>
|
200 |
+
<Intelivemetrics_Unityreports>
|
201 |
+
<file>unityreports.xml</file>
|
202 |
+
</Intelivemetrics_Unityreports>
|
203 |
+
</updates>
|
204 |
+
</layout>
|
205 |
</frontend>
|
206 |
</config>
|
app/code/community/Intelivemetrics/Unityreports/sql/unityreports_setup/mysql4-install-0.7.3.php
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
|
4 |
+
$installer->startSetup();
|
5 |
+
Mage::log('Running installer '.__FILE__);
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
SET SQL_MODE = \"NO_AUTO_VALUE_ON_ZERO\";
|
9 |
+
SET AUTOCOMMIT = 0;
|
10 |
+
START TRANSACTION;
|
11 |
+
|
12 |
+
|
13 |
+
DROP TABLE IF EXISTS `{$this->getTable('unityreports/abcarts')}`;
|
14 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('unityreports/abcarts')}` (
|
15 |
+
`entity_id` int(11) NOT NULL,
|
16 |
+
`sents` int(11) NOT NULL DEFAULT '0',
|
17 |
+
`synced` tinyint(1) NOT NULL DEFAULT '0',
|
18 |
+
`last_sent_at` datetime NOT NULL,
|
19 |
+
`synced_at` datetime NOT NULL,
|
20 |
+
PRIMARY KEY (`entity_id`),
|
21 |
+
KEY `sents` (`sents`),
|
22 |
+
KEY `synced` (`synced`)
|
23 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
24 |
+
|
25 |
+
|
26 |
+
DROP TABLE IF EXISTS `{$this->getTable('unityreports/campaigns')}`;
|
27 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('unityreports/campaigns')}` (
|
28 |
+
`id` INT(11) NOT NULL,
|
29 |
+
`type` ENUM('order','customer') NOT NULL DEFAULT 'order',
|
30 |
+
`source` VARCHAR(100) NULL DEFAULT '',
|
31 |
+
`medium` VARCHAR(100) NULL DEFAULT '',
|
32 |
+
`content` VARCHAR(100) NULL DEFAULT '',
|
33 |
+
`campaign` VARCHAR(100) NULL DEFAULT '',
|
34 |
+
PRIMARY KEY (`type`, `id`)
|
35 |
+
)
|
36 |
+
COLLATE='utf8_general_ci'
|
37 |
+
ENGINE=InnoDB;
|
38 |
+
|
39 |
+
|
40 |
+
DROP TABLE IF EXISTS `{$this->getTable('unityreports/creditnotes')}`;
|
41 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('unityreports/creditnotes')}` (
|
42 |
+
`increment_id` varchar(50) NOT NULL,
|
43 |
+
`sents` int(11) NOT NULL DEFAULT '0',
|
44 |
+
`synced` tinyint(1) NOT NULL DEFAULT '0',
|
45 |
+
`last_sent_at` datetime NOT NULL,
|
46 |
+
`synced_at` datetime NOT NULL,
|
47 |
+
PRIMARY KEY (`increment_id`),
|
48 |
+
KEY `sents` (`sents`),
|
49 |
+
KEY `synced` (`synced`)
|
50 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
51 |
+
|
52 |
+
|
53 |
+
DROP TABLE IF EXISTS `{$this->getTable('unityreports/customers')}`;
|
54 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('unityreports/customers')}` (
|
55 |
+
`customer_id` int(11) NOT NULL,
|
56 |
+
`sents` int(11) NOT NULL DEFAULT '0',
|
57 |
+
`synced` tinyint(1) NOT NULL DEFAULT '0',
|
58 |
+
`last_sent_at` datetime NOT NULL,
|
59 |
+
`synced_at` datetime NOT NULL,
|
60 |
+
PRIMARY KEY (`customer_id`),
|
61 |
+
KEY `sents` (`sents`),
|
62 |
+
KEY `synced` (`synced`)
|
63 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
64 |
+
|
65 |
+
DROP TABLE IF EXISTS `{$this->getTable('unityreports/customer_actions')}`;
|
66 |
+
CREATE TABLE `{$this->getTable('unityreports/customer_actions')}` (
|
67 |
+
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
68 |
+
`customer_id` INT(11) NOT NULL,
|
69 |
+
`action_code` VARCHAR(50) NOT NULL,
|
70 |
+
`action_desc` VARCHAR(50) NOT NULL,
|
71 |
+
`action_date` DATE NOT NULL,
|
72 |
+
`action_time` TIME NULL DEFAULT NULL,
|
73 |
+
`sents` TINYINT(4) NULL DEFAULT '0',
|
74 |
+
`synced` TINYINT(4) NULL DEFAULT '0',
|
75 |
+
`last_sent_at` DATETIME NOT NULL,
|
76 |
+
`synced_at` DATETIME NOT NULL,
|
77 |
+
PRIMARY KEY (`customer_id`, `action_code`, `action_desc`, `action_date`),
|
78 |
+
INDEX `synced` (`synced`),
|
79 |
+
INDEX `id` (`id`)
|
80 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
81 |
+
|
82 |
+
DROP TABLE IF EXISTS `{$this->getTable('unityreports/invoices')}`;
|
83 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('unityreports/invoices')}` (
|
84 |
+
`increment_id` varchar(50) NOT NULL,
|
85 |
+
`sents` int(11) NOT NULL DEFAULT '0',
|
86 |
+
`synced` tinyint(1) NOT NULL DEFAULT '0',
|
87 |
+
`last_sent_at` datetime NOT NULL,
|
88 |
+
`synced_at` datetime NOT NULL,
|
89 |
+
PRIMARY KEY (`increment_id`),
|
90 |
+
KEY `sents` (`sents`),
|
91 |
+
KEY `synced` (`synced`)
|
92 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
93 |
+
|
94 |
+
|
95 |
+
DROP TABLE IF EXISTS `{$this->getTable('unityreports/orders')}`;
|
96 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('unityreports/orders')}` (
|
97 |
+
`increment_id` varchar(50) NOT NULL,
|
98 |
+
`sents` int(11) NOT NULL DEFAULT '0',
|
99 |
+
`synced` tinyint(1) NOT NULL DEFAULT '0',
|
100 |
+
`last_sent_at` datetime NOT NULL,
|
101 |
+
`synced_at` datetime NOT NULL,
|
102 |
+
PRIMARY KEY (`increment_id`),
|
103 |
+
KEY `sents` (`sents`),
|
104 |
+
KEY `synced` (`synced`)
|
105 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
106 |
+
|
107 |
+
|
108 |
+
DROP TABLE IF EXISTS `{$this->getTable('unityreports/products')}`;
|
109 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('unityreports/products')}` (
|
110 |
+
`product_id` int(11) NOT NULL,
|
111 |
+
`sents` int(11) NOT NULL DEFAULT '0',
|
112 |
+
`synced` tinyint(1) NOT NULL DEFAULT '0',
|
113 |
+
`last_sent_at` datetime NOT NULL,
|
114 |
+
`synced_at` datetime NOT NULL,
|
115 |
+
PRIMARY KEY (`product_id`),
|
116 |
+
KEY `sents` (`sents`),
|
117 |
+
KEY `synced` (`synced`)
|
118 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
119 |
+
|
120 |
+
|
121 |
+
DROP TABLE IF EXISTS `{$this->getTable('unityreports/product_counters')}`;
|
122 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('unityreports/product_counters')}` (
|
123 |
+
`product_id` int(11) NOT NULL,
|
124 |
+
`views` int(11) NOT NULL DEFAULT '0',
|
125 |
+
`unique_views` int(11) DEFAULT '0',
|
126 |
+
`addtocarts` int(11) NOT NULL DEFAULT '0',
|
127 |
+
`last_sent_at` DATETIME NULL,
|
128 |
+
`last_updated_at` DATETIME NULL,
|
129 |
+
PRIMARY KEY (`product_id`),
|
130 |
+
INDEX `last_sent` (`last_sent_at`),
|
131 |
+
INDEX `updated_at` (`last_updated_at`)
|
132 |
+
) ENGINE=InnoDb DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
133 |
+
|
134 |
+
|
135 |
+
DROP TABLE IF EXISTS `{$this->getTable('unityreports/settings')}`;
|
136 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('unityreports/settings')}` (
|
137 |
+
`key` varchar(100) NOT NULL,
|
138 |
+
`val` varchar(100) DEFAULT NULL,
|
139 |
+
PRIMARY KEY (`key`)
|
140 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
141 |
+
|
142 |
+
INSERT INTO `{$this->getTable('unityreports/settings')}` (`key`, `val`) VALUES
|
143 |
+
('max_items_per_sync', '10');
|
144 |
+
|
145 |
+
COMMIT;
|
146 |
+
");
|
147 |
+
|
148 |
+
|
149 |
+
$installer->endSetup();
|
150 |
+
|
app/design/frontend/base/default/layout/unityreports.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<layout version="0.1.0">
|
2 |
+
<default translate="label" module="page">
|
3 |
+
<reference name="head">
|
4 |
+
<action method="addJs">
|
5 |
+
<script>intelivemetrics/unityreports/utmz-alternative.js</script>
|
6 |
+
</action>
|
7 |
+
</reference>
|
8 |
+
</default>
|
9 |
+
</layout>
|
js/intelivemetrics/unityreports/utmz-alternative.js
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* This script provides an alternative method for creating an _utmz cookie
|
3 |
+
* when switching to universal analytics
|
4 |
+
*
|
5 |
+
* @category Unityreports
|
6 |
+
* @package Intelivemetrics_Unityreports
|
7 |
+
* @copyright Copyright (c) 2014 Intelive Metrics Srl
|
8 |
+
* @author Eduard Gabriel Dumitrescu (balaur@gmail.com)
|
9 |
+
*/
|
10 |
+
var Qs = function () {
|
11 |
+
// This function is anonymous, is executed immediately and
|
12 |
+
// the return value is assigned to QueryString!
|
13 |
+
var query_string = {};
|
14 |
+
var query = window.location.search.substring(1);
|
15 |
+
var vars = query.split("&");
|
16 |
+
for (var i = 0; i < vars.length; i++) {
|
17 |
+
var pair = vars[i].split("=");
|
18 |
+
// If first entry with this name
|
19 |
+
if (typeof query_string[pair[0]] === "undefined") {
|
20 |
+
query_string[pair[0]] = pair[1];
|
21 |
+
// If second entry with this name
|
22 |
+
} else if (typeof query_string[pair[0]] === "string") {
|
23 |
+
var arr = [query_string[pair[0]], pair[1]];
|
24 |
+
query_string[pair[0]] = arr;
|
25 |
+
// If third or later entry with this name
|
26 |
+
} else {
|
27 |
+
query_string[pair[0]].push(pair[1]);
|
28 |
+
}
|
29 |
+
}
|
30 |
+
return query_string;
|
31 |
+
}();
|
32 |
+
|
33 |
+
//utm_campaign=app_listing&utm_medium=referral&utm_source=ga_partner_gallery
|
34 |
+
var Utmza = function (domain) {
|
35 |
+
var c = Qs.utm_campaign || null,
|
36 |
+
s = Qs.utm_source || null,
|
37 |
+
m = Qs.utm_medium || null,
|
38 |
+
j = [],
|
39 |
+
expires = new Date(),
|
40 |
+
cookie = '__utmza'
|
41 |
+
;
|
42 |
+
domain = domain || window.location.hostname;
|
43 |
+
|
44 |
+
if (c) j.push('c=' + c);
|
45 |
+
if (s) j.push('s=' + s);
|
46 |
+
if (m) j.push('m=' + m);
|
47 |
+
|
48 |
+
if(j.length > 0){
|
49 |
+
//create top level cookie
|
50 |
+
expires.setTime(expires.getTime() + 1000*60*60*24*365); // (1 years)
|
51 |
+
document.cookie = cookie + "=" + j.join('|') + "; expires=" + expires.toGMTString() + "; domain=" + domain + "; path=/";
|
52 |
+
}
|
53 |
+
}();
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Intelivemetrics_Unityreports</name>
|
4 |
-
<version>0.7.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://choosealicense.com/licenses/apache-2.0/">APACHE</license>
|
7 |
<channel>community</channel>
|
@@ -10,11 +10,11 @@
|
|
10 |
<description>Unityreports brings powerful e-commerce analytics by combining Magento, Google Analytics and Google Adwords data.
|
11 |
http://www.unityreports.com
|
12 |
</description>
|
13 |
-
<notes>
|
14 |
<authors><author><name>Eduard G. Dumitrescu</name><user>bregoiu</user><email>eddie.dumitrescu@gmail.com</email></author></authors>
|
15 |
-
<date>2015-
|
16 |
-
<time>
|
17 |
-
<contents><target name="magecommunity"><dir name="Intelivemetrics"><dir name="Unityreports"><dir name="Block"><dir name="Adminhtml"><dir name="Button"><file name="Test.php" hash="f23e261d8cf7ef8314f121978b3b03d3"/></dir><dir name="Label"><file name="Renderer.php" hash="89a6ec5dddca5fcf86fbe85b83d87650"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.1.0</min><max>7.0.0</max></php></required></dependencies>
|
20 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Intelivemetrics_Unityreports</name>
|
4 |
+
<version>0.7.6</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://choosealicense.com/licenses/apache-2.0/">APACHE</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Unityreports brings powerful e-commerce analytics by combining Magento, Google Analytics and Google Adwords data.
|
11 |
http://www.unityreports.com
|
12 |
</description>
|
13 |
+
<notes>Adding support for Universal Analytics</notes>
|
14 |
<authors><author><name>Eduard G. Dumitrescu</name><user>bregoiu</user><email>eddie.dumitrescu@gmail.com</email></author></authors>
|
15 |
+
<date>2015-02-10</date>
|
16 |
+
<time>15:14:00</time>
|
17 |
+
<contents><target name="magecommunity"><dir name="Intelivemetrics"><dir name="Unityreports"><dir name="Block"><dir name="Adminhtml"><dir name="Button"><file name="Test.php" hash="f23e261d8cf7ef8314f121978b3b03d3"/></dir><dir name="Label"><file name="Renderer.php" hash="89a6ec5dddca5fcf86fbe85b83d87650"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="28ec3fc4be05e608c27da2722b75d2d1"/></dir><dir name="Model"><dir name="Admin"><dir name="Status"><file name="Active.php" hash="28d46ddb38425dcdddf34a694fcbcd84"/><dir name="Cron"><file name="Count.php" hash="8f8de0b781e5889c63b508dcba24532b"/><file name="GlobalCounters.php" hash="7b89f230d9a4fbd65bbf1dd87fd2d196"/><file name="Mage.php" hash="922159223ba73f6ecb4cb019595009f4"/><file name="Stat.php" hash="64e4b605214a0a966adada181d413d79"/><file name="Sync.php" hash="ab2313a6949823565001b9787a1a255a"/></dir><file name="Cron.php" hash="2f5e7a78dcdf1f593d239851316787cf"/></dir></dir><file name="Config.php" hash="590dd9e3939f58560d9b004763d48c05"/><dir name="Cron"><file name="Count.php" hash="e9fb746dabb7a9e2c8433f43fa723df8"/><file name="GlobalCounters.php" hash="c55ce27f8ea8c9a22b22053ae3715bff"/><file name="Request.php" hash="121bce122eb50f72e0d6d4c8a74d4900"/><file name="Sync.php" hash="7bae69af328b6aae62bc3a9dc23462e3"/></dir><file name="Cron.php" hash="51f800a9c3c0ab0acdcda3aa9ba51104"/><file name="Customer.php" hash="c99b23d2ec6ffd8acdcc11cf7ed6421e"/><file name="Observer.php" hash="6d29e3b6e3b740f8fcdbaf8f78feabba"/><dir name="Request"><file name="Base.php" hash="2c3fea1af836bedb205786d67465b97d"/><file name="Diagnose.php" hash="5e8525e5392c705660e800faf9b3e057"/><file name="GetCounters.php" hash="58350a26c70f552349a1eac4a29bb729"/><file name="HandShake.php" hash="8c1fb4cfef7fd9c7fb91ccc2c9503260"/><file name="Interface.php" hash="680707fa0a26ecd7237d116bc0b0a3da"/><file name="ResetAbcarts.php" hash="facdc1c2486398a2a62db126c8518174"/><file name="ResetAll.php" hash="b2533da935c5c66f741490f7f082c8df"/><file name="ResetCreditmemos.php" hash="a199f6f07c67e219d85990a3a08454cc"/><file name="ResetCustomers.php" hash="570aff03d862608cea5e09ded7e7fd9b"/><file name="ResetInvoices.php" hash="7c62cfe07c089b6ca64e32c9f4667297"/><file name="ResetOrders.php" hash="b73a88a0b1bd908c9e9e1d386f23087f"/><file name="ResetProductCounters.php" hash="e84ea87e8c2dcf28189e870c84118317"/><file name="ResetProducts.php" hash="9cfbc9b3f2a1388ef61f0af516ea8e02"/><file name="SetSpeed.php" hash="48496a1971c80fdaa689e0d65d0acd16"/><file name="StartSync.php" hash="30d94be6608c4bce5cebb114ad241fdb"/><file name="StopSync.php" hash="61fb6758c1600eed20c40e4ec28fcef1"/><file name="SyncResult.php" hash="c2f9893e2a083f9c792bc43a212196e4"/></dir><dir name="Resource"><dir name="Config"><file name="Collection.php" hash="dc7cc10daf7e597be061d7bf841d0f66"/></dir><file name="Config.php" hash="e3f733d66219ffc946a1b3cd5eca980d"/><file name="Setup.php" hash="2f7cb85c64bd6103faf9208c7d5f451f"/></dir><dir name="Sync"><file name="Abcart.php" hash="9c4132a0d377a5b8ea5b20d2a3f3fb3b"/><file name="Creditnote.php" hash="6485779bff48de00a9ba0960c906cf9f"/><file name="Customer.php" hash="b49c41bf3a310a1b874f0498b4863af7"/><file name="CustomerAction.php" hash="160ace0a2e9fa8e28ce522f0d03db25d"/><file name="Interface.php" hash="d74a42d2d34c34ce8ec3379bb220127f"/><file name="Invoice.php" hash="3fd8fd3caa22f3202facb9c1c002ee32"/><file name="Order.php" hash="62d3a2e30cbe00b38773a0a6279ee11e"/><file name="Product.php" hash="e2ccb7f50d2acbaca1220c86d51cca27"/><file name="ProductVariation.php" hash="c3042550b9849335c1af13cc26d61504"/></dir><file name="Sync.php" hash="3b17b54554140f94b95dcf98970a5fe1"/><file name="Utils.php" hash="911a0d029646f3c6ed69c812b472afe4"/><file name="Utmz.php" hash="b3b1d805e042142f8d713e253836b1b1"/></dir><dir name="controllers"><file name="IndexController.php" hash="78bbd2f188e41de6220d79b7f74e2c9c"/><file name="TestController.php" hash="dc6b68613aacabdd8c24b0a85247524f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="aab2ef0e4aedb050d8b60937a085537c"/><file name="config.xml" hash="cbf1b8cfc7a0567bdd690eef69b3a1aa"/><file name="system.xml" hash="dd6cee8070b16c894b64f1b7d84a4571"/></dir><dir name="sql"><dir name="unityreports_setup"><file name="mysql4-install-0.7.2.php" hash="54f2cbb15d70806b1756c6196d9b3ec1"/><file name="mysql4-install-0.7.3.php" hash="54f2cbb15d70806b1756c6196d9b3ec1"/><file name="mysql4-upgrade-0.6.2-0.7.2.php" hash="7c1abd7bed806f811ffedf9cdb2c0cc0"/><file name="mysql4-upgrade-0.7.2-0.7.3.php" hash="fcbc4f1c8b216548ee212855142857f8"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Intelivemetrics_Unityreports.xml" hash="ccb9d92196bbc626b5552746ac3ad08b"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="unityreports.xml" hash="1378f49dd55356156426785b3d1e3eab"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="intelivemetrics"><dir name="unityreports"><file name="utmz-alternative.js" hash="20f145b83473ec9c13b738b3f15ee969"/></dir></dir></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.1.0</min><max>7.0.0</max></php></required></dependencies>
|
20 |
</package>
|