Version Notes
First preview release
Download this release
Release Info
| Developer | Lewis Theobald |
| Extension | IntileryAnalytics |
| Version | 1.0.1 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.0 to 1.0.1
app/code/local/Intilery/Analytics/Model/Observer.php
CHANGED
|
@@ -10,6 +10,25 @@ class Intilery_Analytics_Model_Observer {
|
|
| 10 |
# Get the product
|
| 11 |
$product = $observer->getProduct();
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# Store in the session
|
| 14 |
Mage::getSingleton('core/session')->setData('productViewData', array(
|
| 15 |
'id' => $product->getId(),
|
|
@@ -17,7 +36,9 @@ class Intilery_Analytics_Model_Observer {
|
|
| 17 |
'price' => $product->getPrice(),
|
| 18 |
'sku' => $product->getSku(),
|
| 19 |
'image' => $product->getImage(),
|
| 20 |
-
'description' => $product->getDescription()
|
|
|
|
|
|
|
| 21 |
)
|
| 22 |
);
|
| 23 |
|
| 10 |
# Get the product
|
| 11 |
$product = $observer->getProduct();
|
| 12 |
|
| 13 |
+
# Get the categories
|
| 14 |
+
$categories = array();
|
| 15 |
+
$categoryCollection = $product->getCategoryIds();
|
| 16 |
+
|
| 17 |
+
# Get all categories
|
| 18 |
+
foreach($categoryCollection as $categoryID) {
|
| 19 |
+
|
| 20 |
+
# Load category model
|
| 21 |
+
$_category = Mage::getModel('catalog/category');
|
| 22 |
+
$_category->load($categoryID);
|
| 23 |
+
|
| 24 |
+
# Get the category name
|
| 25 |
+
$categories[] = $_category->getName();
|
| 26 |
+
|
| 27 |
+
# Clear up
|
| 28 |
+
unset($_category);
|
| 29 |
+
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
# Store in the session
|
| 33 |
Mage::getSingleton('core/session')->setData('productViewData', array(
|
| 34 |
'id' => $product->getId(),
|
| 36 |
'price' => $product->getPrice(),
|
| 37 |
'sku' => $product->getSku(),
|
| 38 |
'image' => $product->getImage(),
|
| 39 |
+
'description' => $product->getDescription(),
|
| 40 |
+
'category' => implode(', ', $categories),
|
| 41 |
+
'categoryIds' => $product->getCategoryIds()
|
| 42 |
)
|
| 43 |
);
|
| 44 |
|
app/design/frontend/base/default/template/intilery/footer.phtml
CHANGED
|
@@ -38,8 +38,8 @@ _itq.push(["_setAccount", "'.$intileryConfig['code'].'"]);
|
|
| 38 |
_itq.push(['_trackUserEvent','register account',
|
| 39 |
[
|
| 40 |
{name:'Customer.Email', value:'{$customerRegisterData['email']}'},
|
| 41 |
-
{name:'Customer.First Name', value
|
| 42 |
-
{name:'Customer.Last Name', value
|
| 43 |
{name:'Customer.Subscribed', value:'{$customerRegisterData['subscribe']}'}
|
| 44 |
]]);
|
| 45 |
</script>";
|
|
@@ -90,7 +90,7 @@ _itq.push(["_setAccount", "'.$intileryConfig['code'].'"]);
|
|
| 90 |
{name:'Add To Basket.SKU', value:'{$productAddedToCart['sku']}'},
|
| 91 |
{name:'Add To Basket.Quantity', value:'{$productAddedToCart['quantity']}'},
|
| 92 |
{name:'Add To Basket.Price', value:'{$productAddedToCart['price']}'},
|
| 93 |
-
{name:'Product.Name', value
|
| 94 |
], 'Add To Basket']);
|
| 95 |
</script>";
|
| 96 |
|
|
@@ -107,7 +107,7 @@ _itq.push(["_setAccount", "'.$intileryConfig['code'].'"]);
|
|
| 107 |
echo "<script>
|
| 108 |
var _itq = _itq || [];
|
| 109 |
_itq.push(['_trackUserEvent', 'remove from basket', [
|
| 110 |
-
{name:'Product.Name',value
|
| 111 |
], 'Remove From Basket']);
|
| 112 |
</script>";
|
| 113 |
|
|
@@ -126,7 +126,7 @@ _itq.push(["_setAccount", "'.$intileryConfig['code'].'"]);
|
|
| 126 |
_itq.push(['_trackUserEvent', 'update basket', [
|
| 127 |
{name:'Update Basket.Quantity', value:'{$productUpdatedInCart['quantity']}'},
|
| 128 |
{name:'Update Basket.Price', value:'{$productUpdatedInCart['price']}'},
|
| 129 |
-
{name:'Product.Name', value
|
| 130 |
], 'Update Basket']);
|
| 131 |
</script>";
|
| 132 |
|
|
@@ -142,7 +142,7 @@ _itq.push(["_setAccount", "'.$intileryConfig['code'].'"]);
|
|
| 142 |
|
| 143 |
echo "<script>
|
| 144 |
var _itq = _itq || [];
|
| 145 |
-
_itq.push(['_trackUserEvent', 'Search', [{name:'Search.Term',value
|
| 146 |
</script>";
|
| 147 |
|
| 148 |
}
|
|
@@ -158,10 +158,11 @@ _itq.push(["_setAccount", "'.$intileryConfig['code'].'"]);
|
|
| 158 |
echo "<script>
|
| 159 |
var _itq = _itq || [];
|
| 160 |
_itq.push(['_trackUserEvent', 'view product', [
|
| 161 |
-
{name:'Product.Name', value:
|
| 162 |
{name:'Product.Price', value: '{$productViewData['price']}'},
|
| 163 |
-
{name:'Product.Description', value:
|
| 164 |
-
{name:'Product.Image', value: '{$productViewData['image']}'}
|
|
|
|
| 165 |
]]);
|
| 166 |
</script>";
|
| 167 |
|
|
@@ -173,4 +174,39 @@ _itq.push(["_setAccount", "'.$intileryConfig['code'].'"]);
|
|
| 173 |
|
| 174 |
}
|
| 175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
?>
|
| 38 |
_itq.push(['_trackUserEvent','register account',
|
| 39 |
[
|
| 40 |
{name:'Customer.Email', value:'{$customerRegisterData['email']}'},
|
| 41 |
+
{name:'Customer.First Name', value:\"{$customerRegisterData['forename']}\"},
|
| 42 |
+
{name:'Customer.Last Name', value:\"{$customerRegisterData['surname']}\"},
|
| 43 |
{name:'Customer.Subscribed', value:'{$customerRegisterData['subscribe']}'}
|
| 44 |
]]);
|
| 45 |
</script>";
|
| 90 |
{name:'Add To Basket.SKU', value:'{$productAddedToCart['sku']}'},
|
| 91 |
{name:'Add To Basket.Quantity', value:'{$productAddedToCart['quantity']}'},
|
| 92 |
{name:'Add To Basket.Price', value:'{$productAddedToCart['price']}'},
|
| 93 |
+
{name:'Product.Name', value:\"{$productAddedToCart['name']}\"}
|
| 94 |
], 'Add To Basket']);
|
| 95 |
</script>";
|
| 96 |
|
| 107 |
echo "<script>
|
| 108 |
var _itq = _itq || [];
|
| 109 |
_itq.push(['_trackUserEvent', 'remove from basket', [
|
| 110 |
+
{name:'Product.Name',value:\"{$productRemovedFromCart['name']}\"}
|
| 111 |
], 'Remove From Basket']);
|
| 112 |
</script>";
|
| 113 |
|
| 126 |
_itq.push(['_trackUserEvent', 'update basket', [
|
| 127 |
{name:'Update Basket.Quantity', value:'{$productUpdatedInCart['quantity']}'},
|
| 128 |
{name:'Update Basket.Price', value:'{$productUpdatedInCart['price']}'},
|
| 129 |
+
{name:'Product.Name', value:\"{$productUpdatedInCart['name']}\"}
|
| 130 |
], 'Update Basket']);
|
| 131 |
</script>";
|
| 132 |
|
| 142 |
|
| 143 |
echo "<script>
|
| 144 |
var _itq = _itq || [];
|
| 145 |
+
_itq.push(['_trackUserEvent', 'Search', [{name:'Search.Term',value:\"{$searchQueryText}\"}]]);
|
| 146 |
</script>";
|
| 147 |
|
| 148 |
}
|
| 158 |
echo "<script>
|
| 159 |
var _itq = _itq || [];
|
| 160 |
_itq.push(['_trackUserEvent', 'view product', [
|
| 161 |
+
{name:'Product.Name', value: \"{$productViewData['name']}\"},
|
| 162 |
{name:'Product.Price', value: '{$productViewData['price']}'},
|
| 163 |
+
{name:'Product.Description', value: \"{$productViewData['description']}\"},
|
| 164 |
+
{name:'Product.Image', value: '{$productViewData['image']}'},
|
| 165 |
+
{name:'Product.Category', value: \"{$productViewData['category']}\"}
|
| 166 |
]]);
|
| 167 |
</script>";
|
| 168 |
|
| 174 |
|
| 175 |
}
|
| 176 |
|
| 177 |
+
# Read session
|
| 178 |
+
$checkSessionExists = Mage::getSingleton('core/session')->getData('intilerySessionExists', true);
|
| 179 |
+
|
| 180 |
+
# Nothing passed over yet
|
| 181 |
+
if(is_null($checkSessionExists) || empty($checkSessionExists)) {
|
| 182 |
+
|
| 183 |
+
# Get the user session
|
| 184 |
+
$session = Mage::getSingleton('customer/session');
|
| 185 |
+
|
| 186 |
+
# Are we logged in?
|
| 187 |
+
if($session->isLoggedIn()) {
|
| 188 |
+
|
| 189 |
+
# Get customer data
|
| 190 |
+
$customer = $session->getCustomer();
|
| 191 |
+
|
| 192 |
+
# All the bits we need
|
| 193 |
+
$customerEmail = $customer->getEmail();
|
| 194 |
+
$customerFirstName = $customer->getFirstname();
|
| 195 |
+
$customerLastName = $customer->getLastname();
|
| 196 |
+
|
| 197 |
+
echo "<script>
|
| 198 |
+
_itq.push(['_trackUserEvent', 'identify', [
|
| 199 |
+
{name:'Customer.Email', value:'{$customerEmail}'},
|
| 200 |
+
{name:'Customer.First Name', value:\"{$customerFirstName}\"},
|
| 201 |
+
{name:'Customer.Last Name', value:\"{$customerLastName}\"}
|
| 202 |
+
]]);
|
| 203 |
+
</script>";
|
| 204 |
+
|
| 205 |
+
# Set intilery action
|
| 206 |
+
Mage::getSingleton('core/session')->setData('intilerySessionExists', '1');
|
| 207 |
+
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
?>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>IntileryAnalytics</name>
|
| 4 |
-
<version>1.0.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>GNU General Public License (GPL)</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -10,9 +10,9 @@
|
|
| 10 |
<description>Allows the user to connect their Magento installation with their Intilery tracking dashboard.</description>
|
| 11 |
<notes>First preview release</notes>
|
| 12 |
<authors><author><name>Lewis Theobald</name><user>LewisTheobald</user><email>lewis@aljtmedia.com</email></author></authors>
|
| 13 |
-
<date>2014-
|
| 14 |
-
<time>
|
| 15 |
-
<contents><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="intilery"><file name="footer.phtml" hash="
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>IntileryAnalytics</name>
|
| 4 |
+
<version>1.0.1</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>GNU General Public License (GPL)</license>
|
| 7 |
<channel>community</channel>
|
| 10 |
<description>Allows the user to connect their Magento installation with their Intilery tracking dashboard.</description>
|
| 11 |
<notes>First preview release</notes>
|
| 12 |
<authors><author><name>Lewis Theobald</name><user>LewisTheobald</user><email>lewis@aljtmedia.com</email></author></authors>
|
| 13 |
+
<date>2014-02-16</date>
|
| 14 |
+
<time>20:38:36</time>
|
| 15 |
+
<contents><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="intilery"><file name="footer.phtml" hash="6317b32f4afa644002b4bcf7abaddc96"/></dir></dir><dir name="layout"><file name="intileryanalytics.xml" hash="029805cde7e0a232ae1c34ca9c9294dc"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="Intilery"><dir name="Analytics"><dir name="Helper"><file name="Data.php" hash="73eea83351ad9a89cdf5f5ad14054a81"/></dir><dir name="Model"><file name="Observer.php" hash="71fd96d35303e83a9940a25a1e83d50b"/></dir><dir name="etc"><file name="adminhtml.xml" hash="02d8db0ec3a9f95fb0f0a8b80c56764a"/><file name="config.xml" hash="2e694f64f95ce0e87843aeafca8abb8e"/><file name="system.xml" hash="073880c6cbfc851b4c7f32c5a60c03cc"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Intilery_Analytics.xml" hash="943756b51b7a8bab8175c9132a7473c8"/></dir></target></contents>
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
</package>
|
