Version Notes
Initial release
Download this release
Release Info
Developer | Trialfire Inc |
Extension | Trialfire |
Version | 1.0.0.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.0.0.1
- app/code/community/Trialfire/Tracker/Block/Cart.php +65 -0
- app/code/community/Trialfire/Tracker/Block/Customer.php +116 -0
- app/code/community/Trialfire/Tracker/Block/Event/Catalog/Category/View.php +23 -0
- app/code/community/Trialfire/Tracker/Block/Event/Catalog/Product/View.php +27 -0
- app/code/community/Trialfire/Tracker/Block/Event/Checkout/Onepage/Guest.php +73 -0
- app/code/community/Trialfire/Tracker/Block/Event/Checkout/Onepage/Index.php +40 -0
- app/code/community/Trialfire/Tracker/Block/Event/Checkout/Onepage/Success.php +46 -0
- app/code/community/Trialfire/Tracker/Block/Head.php +32 -0
- app/code/community/Trialfire/Tracker/Block/Identify.php +51 -0
- app/code/community/Trialfire/Tracker/Block/Track.php +80 -0
- app/code/community/Trialfire/Tracker/Helper/Data.php +58 -0
- app/code/community/Trialfire/Tracker/Model/Observer.php +307 -0
- app/code/community/Trialfire/Tracker/etc/adminhtml.xml +32 -0
- app/code/community/Trialfire/Tracker/etc/config.xml +135 -0
- app/code/community/Trialfire/Tracker/etc/system.xml +51 -0
- app/design/frontend/base/default/template/trialfire/tracker/head.phtml +13 -0
- app/design/frontend/base/default/template/trialfire/tracker/identify.phtml +19 -0
- app/design/frontend/base/default/template/trialfire/tracker/track.phtml +19 -0
- app/design/frontend/base/default/template/trialfire/tracker/track_observe.phtml +26 -0
- package.xml +4 -4
app/code/community/Trialfire/Tracker/Block/Cart.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Trialfire
|
4 |
+
* @package Trialfire_Tracker
|
5 |
+
* @author Mark Lieberman <mark@trialfire.com>
|
6 |
+
* @copyright Copyright (c) Trialfire
|
7 |
+
*
|
8 |
+
* Outputs a track() call whenever a product is added or removed from the shopping cart.
|
9 |
+
*/
|
10 |
+
class Trialfire_Tracker_Block_Cart extends Trialfire_Tracker_Block_Track {
|
11 |
+
|
12 |
+
protected function _construct() {
|
13 |
+
parent::_construct();
|
14 |
+
|
15 |
+
$session = Mage::getSingleton("checkout/session");
|
16 |
+
|
17 |
+
// Check if a product ID was added to the shopping cart.
|
18 |
+
$productId = $session->getItemAddedToCart();
|
19 |
+
if (!empty($productId)) {
|
20 |
+
// Clear the product ID.
|
21 |
+
$session->setItemAddedToCart(null);
|
22 |
+
|
23 |
+
// Track the product added to the cart.
|
24 |
+
$this->setTrackName('Added to Cart');
|
25 |
+
$properties = $this->getProductInfo($productId);
|
26 |
+
$properties['quoteId'] = $session->getQuoteId();
|
27 |
+
$this->setTrackProperties($properties);
|
28 |
+
return;
|
29 |
+
}
|
30 |
+
|
31 |
+
// Check if a product ID was removed from the shopping cart.
|
32 |
+
$productId = $session->getItemRemovedFromCart();
|
33 |
+
if (!empty($productId)) {
|
34 |
+
// Clear the product ID.
|
35 |
+
$session->setItemRemovedFromCart(null);
|
36 |
+
|
37 |
+
// Track the product removed from the cart.
|
38 |
+
$this->setTrackName('Removed from Cart');
|
39 |
+
$properties = $this->getProductInfo($productId);
|
40 |
+
$properties['quoteId'] = $session->getQuoteId();
|
41 |
+
$this->setTrackProperties($properties);
|
42 |
+
return;
|
43 |
+
}
|
44 |
+
|
45 |
+
// Nothing added or removed - don't render a track call.
|
46 |
+
$this->setShouldTrack(false);
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Get the information about a product.
|
51 |
+
*/
|
52 |
+
private function getProductInfo($productId) {
|
53 |
+
$store = Mage::app()->getStore();
|
54 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
55 |
+
return array(
|
56 |
+
'id' => $product->getId(),
|
57 |
+
'sku' => $product->getSku(),
|
58 |
+
'name' => $product->getName(),
|
59 |
+
'price' => floatval($product->getPrice()),
|
60 |
+
'currency' => $store->getCurrentCurrencyCode()
|
61 |
+
);
|
62 |
+
}
|
63 |
+
|
64 |
+
}
|
65 |
+
?>
|
app/code/community/Trialfire/Tracker/Block/Customer.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Trialfire
|
4 |
+
* @package Trialfire_Tracker
|
5 |
+
* @author Mark Lieberman <mark@trialfire.com>
|
6 |
+
* @copyright Copyright (c) Trialfire
|
7 |
+
*
|
8 |
+
* Outputs a Trialfire.identify() call whenever the logged in customer is updated.
|
9 |
+
*/
|
10 |
+
class Trialfire_Tracker_Block_Customer extends Trialfire_Tracker_Block_Identify {
|
11 |
+
|
12 |
+
protected function _construct() {
|
13 |
+
parent::_construct();
|
14 |
+
|
15 |
+
if (Mage::helper('customer')->isLoggedIn()) {
|
16 |
+
$session = Mage::getSingleton('customer/session');
|
17 |
+
$customer = $session->getCustomer();
|
18 |
+
|
19 |
+
switch (Mage::app()->getRequest()->getActionName()) {
|
20 |
+
case 'success': // checkout/onepage/success
|
21 |
+
// No need to re-identify existing customers after an order is placed.
|
22 |
+
// Ignoring the update to supress the identify() call in the following case.
|
23 |
+
$session->setTfUpdatedAt(strtotime($customer->getUpdatedAt()));
|
24 |
+
|
25 |
+
// However, we do want to identify() during register and checkout.
|
26 |
+
// Changing customer ID will trigger an identify() call in the following case.
|
27 |
+
// no break;
|
28 |
+
default:
|
29 |
+
if ($this->customerWasUpdated($session, $customer)) {
|
30 |
+
// Identify the customer to Trialfire.
|
31 |
+
$this->setShouldIdentify(true);
|
32 |
+
$this->setUserId($customer->getId());
|
33 |
+
$this->setUserTraits($this->getCustomerInfo($customer));
|
34 |
+
}
|
35 |
+
break;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* True if the customer was updated since the last call, otherwise false.
|
42 |
+
* Checks the customer information and primary billing address for changes.
|
43 |
+
* Always true on the first call.
|
44 |
+
*/
|
45 |
+
private function customerWasUpdated($session, $customer) {
|
46 |
+
// We won't call identify() unless the customer was updated after this time.
|
47 |
+
$tfUpdatedAt = $session->getTfUpdatedAt() ?: 0;
|
48 |
+
$tfCustomerId = $session->getTfCustomerId() ?: 0;
|
49 |
+
|
50 |
+
// Watch the customer itself and the primary billing address for changes.
|
51 |
+
try {
|
52 |
+
$checkUpdatedAt = strtotime($customer->getUpdatedAt());
|
53 |
+
$billing = $customer->getPrimaryBillingAddress();
|
54 |
+
if (!empty($billing)) {
|
55 |
+
$billingUpdatedAt = strtotime($billing->getUpdatedAt());
|
56 |
+
$checkUpdatedAt = max($checkUpdatedAt, $billingUpdatedAt);
|
57 |
+
}
|
58 |
+
|
59 |
+
// Copy updatedAt property into a new session variable and watch for changes.
|
60 |
+
if (($checkUpdatedAt > $tfUpdatedAt) || ($tfCustomerId !== $customer->getId())) {
|
61 |
+
$session->setTfUpdatedAt($checkUpdatedAt);
|
62 |
+
$session->setTfCustomerId($customer->getId());
|
63 |
+
return true;
|
64 |
+
}
|
65 |
+
} catch (Exception $e) {
|
66 |
+
Mage::log('customerWasUpdated error: ' + $e->getMessage());
|
67 |
+
}
|
68 |
+
|
69 |
+
return false;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Builds a user traits array from information about the customer.
|
74 |
+
*/
|
75 |
+
private function getCustomerInfo($customer) {
|
76 |
+
$userTraits = array(
|
77 |
+
'firstName' => $customer->getFirstname(),
|
78 |
+
'lastName' => $customer->getLastname(),
|
79 |
+
'email' => $customer->getEmail()
|
80 |
+
);
|
81 |
+
|
82 |
+
// Get the date of birth if the attribute is enabled.
|
83 |
+
$dateOfBirth = $customer->getDob();
|
84 |
+
if (!empty($dateOfBirth)) {
|
85 |
+
$userTraits['dateOfBirth'] = explode(' ', $dateOfBirth, 2)[0];
|
86 |
+
}
|
87 |
+
|
88 |
+
// Get the gender if the attribute is enabled.
|
89 |
+
$gender = $customer->getGender();
|
90 |
+
if (!empty($gender)) {
|
91 |
+
// Get the attribute text for gender.
|
92 |
+
$userTraits['gender'] = Mage::getResourceSingleton('customer/customer')
|
93 |
+
->getAttribute('gender')
|
94 |
+
->getSource()
|
95 |
+
->getOptionText($gender);
|
96 |
+
}
|
97 |
+
|
98 |
+
// Get address information.
|
99 |
+
$billing = $customer->getPrimaryBillingAddress();
|
100 |
+
if (!empty($billing)) {
|
101 |
+
$userTraits['company'] = $billing->getCompany();
|
102 |
+
$userTraits['country'] = $billing->getCountry();
|
103 |
+
$userTraits['city'] = $billing->getCity();
|
104 |
+
$userTraits['region'] = $billing->getRegion();
|
105 |
+
$userTraits['postal'] = $billing->getPostcode();
|
106 |
+
$userTraits['phone'] = $billing->getTelephone();
|
107 |
+
|
108 |
+
// Implode the streets in the address into one line.
|
109 |
+
$userTraits['address'] = implode("\n", $billing->getStreet());
|
110 |
+
}
|
111 |
+
|
112 |
+
return $userTraits;
|
113 |
+
}
|
114 |
+
|
115 |
+
}
|
116 |
+
?>
|
app/code/community/Trialfire/Tracker/Block/Event/Catalog/Category/View.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Trialfire
|
4 |
+
* @package Trialfire_Tracker
|
5 |
+
* @author Mark Lieberman <mark@trialfire.com>
|
6 |
+
* @copyright Copyright (c) Trialfire
|
7 |
+
*/
|
8 |
+
class Trialfire_Tracker_Block_Event_Catalog_Category_View extends Trialfire_Tracker_Block_Track {
|
9 |
+
|
10 |
+
protected function _construct() {
|
11 |
+
parent::_construct();
|
12 |
+
|
13 |
+
$category = Mage::registry('current_category');
|
14 |
+
|
15 |
+
$this->setTrackName('Viewed Category');
|
16 |
+
$this->setTrackProperties(array(
|
17 |
+
'id' => $category->getId(),
|
18 |
+
'name' => $category->getName()
|
19 |
+
));
|
20 |
+
}
|
21 |
+
|
22 |
+
}
|
23 |
+
?>
|
app/code/community/Trialfire/Tracker/Block/Event/Catalog/Product/View.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Trialfire
|
4 |
+
* @package Trialfire_Tracker
|
5 |
+
* @author Mark Lieberman <mark@trialfire.com>
|
6 |
+
* @copyright Copyright (c) Trialfire
|
7 |
+
*/
|
8 |
+
class Trialfire_Tracker_Block_Event_Catalog_Product_View extends Trialfire_Tracker_Block_Track {
|
9 |
+
|
10 |
+
protected function _construct() {
|
11 |
+
parent::_construct();
|
12 |
+
|
13 |
+
$store = Mage::app()->getStore();
|
14 |
+
$product = Mage::registry('current_product');
|
15 |
+
|
16 |
+
$this->setTrackName('Viewed Product');
|
17 |
+
$this->setTrackProperties(array(
|
18 |
+
'id' => $product->getId(),
|
19 |
+
'sku' => $product->getSku(),
|
20 |
+
'name' => $product->getName(),
|
21 |
+
'price' => floatval($product->getPrice()),
|
22 |
+
'currency' => $store->getCurrentCurrencyCode()
|
23 |
+
));
|
24 |
+
}
|
25 |
+
|
26 |
+
}
|
27 |
+
?>
|
app/code/community/Trialfire/Tracker/Block/Event/Checkout/Onepage/Guest.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Trialfire
|
4 |
+
* @package Trialfire_Tracker
|
5 |
+
* @author Mark Lieberman <mark@trialfire.com>
|
6 |
+
* @copyright Copyright (c) Trialfire
|
7 |
+
*
|
8 |
+
* Output an identify() call to populate the user traits for guest customers in Trialfire.
|
9 |
+
*/
|
10 |
+
class Trialfire_Tracker_Block_Event_Checkout_Onepage_Guest extends Trialfire_Tracker_Block_Identify {
|
11 |
+
|
12 |
+
protected function _construct() {
|
13 |
+
parent::_construct();
|
14 |
+
|
15 |
+
$store = Mage::app()->getStore();
|
16 |
+
$lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
17 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($lastOrderId);
|
18 |
+
|
19 |
+
if ($order->getCustomerIsGuest()) {
|
20 |
+
// We cannot identify() the customer as there is no customer ID.
|
21 |
+
// However, we can record traits about the anonymous visitor.
|
22 |
+
$this->setShouldIdentify(true);
|
23 |
+
$this->setUserId(null);
|
24 |
+
$this->setUserTraits($this->getCustomerInfo($order));
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Builds a user traits array from information about the customer.
|
30 |
+
* Information is collected from the order because the customer is a guest.
|
31 |
+
*/
|
32 |
+
private function getCustomerInfo($order) {
|
33 |
+
$userTraits = array(
|
34 |
+
'firstName' => $order->getCustomerFirstname(),
|
35 |
+
'lastName' => $order->getCustomerLastname(),
|
36 |
+
'email' => $order->getCustomerEmail()
|
37 |
+
);
|
38 |
+
|
39 |
+
// Get the date of birth if the attribute is enabled.
|
40 |
+
$dateOfBirth = $order->getCustomerDob();
|
41 |
+
if (!empty($dateOfBirth)) {
|
42 |
+
$userTraits['dateOfBirth'] = explode(' ', $dateOfBirth, 2)[0];
|
43 |
+
}
|
44 |
+
|
45 |
+
// Get the gender if the attribute is enabled.
|
46 |
+
$gender = $order->getCustomerGender();
|
47 |
+
if (!empty($gender)) {
|
48 |
+
// Get the attribute text for gender.
|
49 |
+
$userTraits['gender'] = Mage::getResourceSingleton('customer/customer')
|
50 |
+
->getAttribute('gender')
|
51 |
+
->getSource()
|
52 |
+
->getOptionText($gender);
|
53 |
+
}
|
54 |
+
|
55 |
+
// Get address information.
|
56 |
+
$billing = $order->getBillingAddress();
|
57 |
+
if (!empty($billing)) {
|
58 |
+
$userTraits['company'] = $billing->getCompany();
|
59 |
+
$userTraits['country'] = $billing->getCountry();
|
60 |
+
$userTraits['city'] = $billing->getCity();
|
61 |
+
$userTraits['region'] = $billing->getRegion();
|
62 |
+
$userTraits['postal'] = $billing->getPostcode();
|
63 |
+
$userTraits['phone'] = $billing->getTelephone();
|
64 |
+
|
65 |
+
// Implode the streets in the address into one line.
|
66 |
+
$userTraits['address'] = implode("\n", $billing->getStreet());
|
67 |
+
}
|
68 |
+
|
69 |
+
return $userTraits;
|
70 |
+
}
|
71 |
+
|
72 |
+
}
|
73 |
+
?>
|
app/code/community/Trialfire/Tracker/Block/Event/Checkout/Onepage/Index.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Trialfire
|
4 |
+
* @package Trialfire_Tracker
|
5 |
+
* @author Mark Lieberman <mark@trialfire.com>
|
6 |
+
* @copyright Copyright (c) Trialfire
|
7 |
+
*
|
8 |
+
* Output a track() call containing all the product information going into the checkout process.
|
9 |
+
*/
|
10 |
+
class Trialfire_Tracker_Block_Event_Checkout_Onepage_Index extends Trialfire_Tracker_Block_Track {
|
11 |
+
|
12 |
+
protected function _construct() {
|
13 |
+
parent::_construct();
|
14 |
+
|
15 |
+
$store = Mage::app()->getStore();
|
16 |
+
$quote = Mage::getModel('checkout/cart')->getQuote();
|
17 |
+
$session = Mage::getSingleton('checkout/session');
|
18 |
+
|
19 |
+
// Build the list of products in the quote.
|
20 |
+
$products = array();
|
21 |
+
foreach ($quote->getAllVisibleItems() as $product) {
|
22 |
+
$products[] = array(
|
23 |
+
'id' => $product->getId(),
|
24 |
+
'sku' => $product->getSku(),
|
25 |
+
'name' => $product->getName(),
|
26 |
+
'price' => floatval($product->getPrice()),
|
27 |
+
'quantity' => intval($product->getQty())
|
28 |
+
);
|
29 |
+
}
|
30 |
+
|
31 |
+
$this->setTrackName('Started Checkout');
|
32 |
+
$this->setTrackProperties(array(
|
33 |
+
'quoteId' => $session->getQuoteId(),
|
34 |
+
'currency' => $store->getCurrentCurrencyCode(),
|
35 |
+
'products' => $products
|
36 |
+
));
|
37 |
+
}
|
38 |
+
|
39 |
+
}
|
40 |
+
?>
|
app/code/community/Trialfire/Tracker/Block/Event/Checkout/Onepage/Success.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Trialfire
|
4 |
+
* @package Trialfire_Tracker
|
5 |
+
* @author Mark Lieberman <mark@trialfire.com>
|
6 |
+
* @copyright Copyright (c) Trialfire
|
7 |
+
*
|
8 |
+
* Output a track() call which containing all the information about the completed order.
|
9 |
+
*/
|
10 |
+
class Trialfire_Tracker_Block_Event_Checkout_Onepage_Success extends Trialfire_Tracker_Block_Track {
|
11 |
+
|
12 |
+
protected function _construct() {
|
13 |
+
parent::_construct();
|
14 |
+
|
15 |
+
$store = Mage::app()->getStore();
|
16 |
+
$lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
17 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($lastOrderId);
|
18 |
+
|
19 |
+
// Build the list of products in the order.
|
20 |
+
$products = array();
|
21 |
+
foreach ($order->getAllVisibleItems() as $product) {
|
22 |
+
$products[] = array(
|
23 |
+
'id' => $product->getId(),
|
24 |
+
'sku' => $product->getSku(),
|
25 |
+
'name' => $product->getName(),
|
26 |
+
'price' => $product->getPrice()
|
27 |
+
);
|
28 |
+
}
|
29 |
+
|
30 |
+
$this->setTrackName('Completed Order');
|
31 |
+
$this->setTrackProperties(array(
|
32 |
+
'quoteId' => $order->getQuoteId(),
|
33 |
+
'orderId' => $lastOrderId,
|
34 |
+
'total' => floatval($order->getGrandTotal()),
|
35 |
+
'shipping' => floatval($order->getShippingAmount()),
|
36 |
+
'shippingMethod' => $order->getShippingDescription(),
|
37 |
+
'tax' => floatval($order->getTaxAmount()),
|
38 |
+
'coupon' => $order->getCouponCode(),
|
39 |
+
'discount' => floatval($order->getDiscountAmount()),
|
40 |
+
'currency' => $store->getCurrentCurrencyCode(),
|
41 |
+
'products' => $products
|
42 |
+
));
|
43 |
+
}
|
44 |
+
|
45 |
+
}
|
46 |
+
?>
|
app/code/community/Trialfire/Tracker/Block/Head.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Trialfire
|
4 |
+
* @package Trialfire_Tracker
|
5 |
+
* @author Mark Lieberman <mark@trialfire.com>
|
6 |
+
* @copyright Copyright (c) Trialfire
|
7 |
+
*
|
8 |
+
* Outputs the tracking script at the end of <head> on every page.
|
9 |
+
*/
|
10 |
+
class Trialfire_Tracker_Block_Head extends Mage_Core_Block_Template {
|
11 |
+
|
12 |
+
protected function _construct() {
|
13 |
+
parent::_construct();
|
14 |
+
$this->setTemplate('trialfire/tracker/head.phtml');
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Get the Trialfire API Token from the extension settings.
|
19 |
+
*/
|
20 |
+
public function getApiToken() {
|
21 |
+
return Mage::helper('trialfire_tracker')->getApiToken();
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Get the Trialfire Asset URL from the extension settings.
|
26 |
+
*/
|
27 |
+
public function getAssetUrl() {
|
28 |
+
return Mage::helper('trialfire_tracker')->getAssetUrl();
|
29 |
+
}
|
30 |
+
|
31 |
+
}
|
32 |
+
?>
|
app/code/community/Trialfire/Tracker/Block/Identify.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Trialfire
|
4 |
+
* @package Trialfire_Tracker
|
5 |
+
* @author Mark Lieberman <mark@trialfire.com>
|
6 |
+
* @copyright Copyright (c) Trialfire
|
7 |
+
*
|
8 |
+
* A basic identify() controller to render a Trialfire.identify() call.
|
9 |
+
*
|
10 |
+
* Does not output the call by default. Use setShouldIdentify(true) to output the identify call.
|
11 |
+
*/
|
12 |
+
class Trialfire_Tracker_Block_Identify extends Mage_Core_Block_Template {
|
13 |
+
|
14 |
+
private $_shouldIdentify = false;
|
15 |
+
private $_userId = null;
|
16 |
+
private $_userTraits = array();
|
17 |
+
|
18 |
+
protected function _construct() {
|
19 |
+
parent::_construct();
|
20 |
+
$this->setTemplate('trialfire/tracker/identify.phtml');
|
21 |
+
}
|
22 |
+
|
23 |
+
public function getShouldIdentify() {
|
24 |
+
return $this->_shouldIdentify;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function setShouldIdentify($shouldIdentify) {
|
28 |
+
$this->_shouldIdentify = $shouldIdentify;
|
29 |
+
return $this;
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getUserId() {
|
33 |
+
return is_null($this->_userId) ? 'null': "'{$this->_userId}'";
|
34 |
+
}
|
35 |
+
|
36 |
+
public function setUserId($userId) {
|
37 |
+
$this->_userId = $userId;
|
38 |
+
return $this;
|
39 |
+
}
|
40 |
+
|
41 |
+
public function getUserTraits() {
|
42 |
+
return $this->helper('trialfire_tracker')->getJsonArray($this->_userTraits);
|
43 |
+
}
|
44 |
+
|
45 |
+
public function setUserTraits($userTraits) {
|
46 |
+
$this->_userTraits = $userTraits;
|
47 |
+
return $this;
|
48 |
+
}
|
49 |
+
|
50 |
+
}
|
51 |
+
?>
|
app/code/community/Trialfire/Tracker/Block/Track.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Trialfire
|
4 |
+
* @package Trialfire_Tracker
|
5 |
+
* @author Mark Lieberman <mark@trialfire.com>
|
6 |
+
* @copyright Copyright (c) Trialfire
|
7 |
+
*
|
8 |
+
* A basic track() controller to render a Trialfire.track() call.
|
9 |
+
*
|
10 |
+
* Outputs the call by default. Use setShouldTrack(false) to suppress the track call.
|
11 |
+
*/
|
12 |
+
class Trialfire_Tracker_Block_Track extends Mage_Core_Block_Template {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Template variant: track
|
16 |
+
* The basic track template invokes Trialfire.track() with given event name and properties.
|
17 |
+
*/
|
18 |
+
private $_shouldTrack = true;
|
19 |
+
private $_trackName = '';
|
20 |
+
private $_trackProperties = array();
|
21 |
+
|
22 |
+
protected function _construct() {
|
23 |
+
parent::_construct();
|
24 |
+
$this->setTemplate('trialfire/tracker/track.phtml');
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getShouldTrack() {
|
28 |
+
return $this->_shouldTrack;
|
29 |
+
}
|
30 |
+
|
31 |
+
public function setShouldTrack($shouldTrack) {
|
32 |
+
$this->_shouldTrack = $shouldTrack;
|
33 |
+
return $this;
|
34 |
+
}
|
35 |
+
|
36 |
+
public function getTrackName() {
|
37 |
+
return $this->_trackName;
|
38 |
+
}
|
39 |
+
|
40 |
+
public function setTrackName($trackName) {
|
41 |
+
$this->_trackName = $trackName;
|
42 |
+
return $this;
|
43 |
+
}
|
44 |
+
|
45 |
+
public function getTrackProperties() {
|
46 |
+
return $this->helper('trialfire_tracker')->getJsonArray($this->_trackProperties);
|
47 |
+
}
|
48 |
+
|
49 |
+
public function setTrackProperties($trackProperties) {
|
50 |
+
$this->_trackProperties = $trackProperties;
|
51 |
+
return $this;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Template variant: track_observe
|
56 |
+
* Adds some properties to hook into DOM events using jQuery for a conditional track.
|
57 |
+
*/
|
58 |
+
private $_observeSelector = '';
|
59 |
+
private $_observeEvent = 'mouseover';
|
60 |
+
|
61 |
+
public function getObserveSelector() {
|
62 |
+
return $this->_observeSelector;
|
63 |
+
}
|
64 |
+
|
65 |
+
public function setObserveSelector($observeSelector) {
|
66 |
+
$this->_observeSelector = $observeSelector;
|
67 |
+
return $this;
|
68 |
+
}
|
69 |
+
|
70 |
+
public function getObserveEvent() {
|
71 |
+
return $this->_observeEvent;
|
72 |
+
}
|
73 |
+
|
74 |
+
public function setObserveEvent($observeEvent) {
|
75 |
+
$this->_observeEvent = $observeEvent;
|
76 |
+
return $this;
|
77 |
+
}
|
78 |
+
|
79 |
+
}
|
80 |
+
?>
|
app/code/community/Trialfire/Tracker/Helper/Data.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Trialfire
|
4 |
+
* @package Trialfire_Tracker
|
5 |
+
* @author Mark Lieberman <mark@trialfire.com>
|
6 |
+
* @copyright Copyright (c) Trialfire
|
7 |
+
*/
|
8 |
+
class Trialfire_Tracker_Helper_Data extends Mage_Core_Helper_Data {
|
9 |
+
|
10 |
+
const CONFIG_API_TOKEN = 'trialfire_tracker/settings/api_token';
|
11 |
+
|
12 |
+
const CONFIG_ASSET_URL = 'trialfire_tracker/settings/asset_url';
|
13 |
+
|
14 |
+
// Settings
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Get the Trialfire API Token from the extension settings.
|
18 |
+
*/
|
19 |
+
public function getApiToken($store = null) {
|
20 |
+
return Mage::getStoreConfig(self::CONFIG_API_TOKEN, $store);
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Get the Trialfire Asset URL from the extension settings.
|
25 |
+
*/
|
26 |
+
public function getAssetUrl($store = null) {
|
27 |
+
return Mage::getStoreConfig(self::CONFIG_ASSET_URL, $store);
|
28 |
+
}
|
29 |
+
|
30 |
+
// Helpers
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Safely encode a PHP object as JSON.
|
34 |
+
*/
|
35 |
+
public function getJsonArray($array) {
|
36 |
+
// Jackson handles Unicode escape sequences.
|
37 |
+
return json_encode(array_filter($array));
|
38 |
+
|
39 |
+
/*
|
40 |
+
if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
|
41 |
+
// Can use JSON_UNESCAPED_UNICODE
|
42 |
+
return json_encode($array, JSON_UNESCAPED_UNICODE);
|
43 |
+
} else {
|
44 |
+
// Adapted from Inchoo_KISSmetris but it's wrong.
|
45 |
+
// Only works if strings are ISO-8859-1.
|
46 |
+
// See: http://stackoverflow.com/a/7382130
|
47 |
+
array_walk_recursive($array, function(&$item, $key) {
|
48 |
+
if (is_string($item)) {
|
49 |
+
$item = htmlentities($item, ENT_NOQUOTES);
|
50 |
+
}
|
51 |
+
});
|
52 |
+
return html_entity_decode(json_encode($arr));
|
53 |
+
}
|
54 |
+
*/
|
55 |
+
}
|
56 |
+
|
57 |
+
}
|
58 |
+
?>
|
app/code/community/Trialfire/Tracker/Model/Observer.php
ADDED
@@ -0,0 +1,307 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Trialfire
|
4 |
+
* @package Trialfire_Tracker
|
5 |
+
* @author Mark Lieberman <mark@trialfire.com>
|
6 |
+
* @copyright Copyright (c) Trialfire
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
class Trialfire_Tracker_Model_Observer {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Do not modify the blocks and responses if module output is disabled.
|
13 |
+
*/
|
14 |
+
private function isModuleDisabled() {
|
15 |
+
$helper = Mage::helper('trialfire_tracker');
|
16 |
+
return !($helper->isModuleEnabled() && $helper->isModuleOutputEnabled());
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Unset the session property used to track changes to the customer.
|
21 |
+
* This forces an identify() call after login, even if the customer hasn't changed.
|
22 |
+
* Mainly to handle cases of different accounts logging into Magento from one browser.
|
23 |
+
*/
|
24 |
+
public function customerLogin(Varien_Event_Observer $observer) {
|
25 |
+
if ($this->isModuleDisabled()) {
|
26 |
+
return $this;
|
27 |
+
}
|
28 |
+
|
29 |
+
$session = Mage::getSingleton('customer/session')->unsTfUpdatedAt();
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Fired when an item is added to the shopping cart.
|
34 |
+
* The product ID is stored in the session.
|
35 |
+
* A template block will lookup the SKU and fire an event at render time.
|
36 |
+
*/
|
37 |
+
public function addedToCart(Varien_Event_Observer $observer) {
|
38 |
+
if ($this->isModuleDisabled()) {
|
39 |
+
return $this;
|
40 |
+
}
|
41 |
+
|
42 |
+
switch (Mage::app()->getRequest()->getActionName()) {
|
43 |
+
case 'loginPost':
|
44 |
+
// Logging in during a guest checkout will add guest's items to the logged in customer's existing quote.
|
45 |
+
// Ignore the items being added to the quote during this process.
|
46 |
+
// Quote IDs for viewed items, etc. may be incorrectly reported due to changing quote ID in this case.
|
47 |
+
break;
|
48 |
+
default:
|
49 |
+
// Record the item ID in the session.
|
50 |
+
$productId = $observer->getQuoteItem()->getProduct()->getId();
|
51 |
+
$session = Mage::getSingleton("checkout/session");
|
52 |
+
$session->setItemAddedToCart($productId);
|
53 |
+
break;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Fired when an item is removed from the shopping cart.
|
59 |
+
* The product ID is stored in the session.
|
60 |
+
* A template block will lookup the SKU and fire an event at render time.
|
61 |
+
*/
|
62 |
+
public function removedFromCart(Varien_Event_Observer $observer) {
|
63 |
+
if ($this->isModuleDisabled()) {
|
64 |
+
return $this;
|
65 |
+
}
|
66 |
+
|
67 |
+
// Record the item ID in the session.
|
68 |
+
$productId = $observer->getQuoteItem()->getProduct()->getId();
|
69 |
+
$session = Mage::getSingleton("checkout/session");
|
70 |
+
$session->setItemRemovedFromCart($productId);
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Hook into block rendering logic and inject the tracking code into the checkout method block
|
75 |
+
* (checkout.onepage.login) and billing information block (checkout.onepage.billing).
|
76 |
+
*/
|
77 |
+
public function coreBlockAbstractToHtmlAfter(Varien_Event_Observer $observer) {
|
78 |
+
if ($this->isModuleDisabled()) {
|
79 |
+
return $this;
|
80 |
+
}
|
81 |
+
|
82 |
+
switch ($observer->getEvent()->getBlock()->getNameInLayout()) {
|
83 |
+
case 'minicart_content':
|
84 |
+
// Add the "Cart" block to the minicart content.
|
85 |
+
$this->minicartContent($observer);
|
86 |
+
break;
|
87 |
+
case 'checkout.onepage.login':
|
88 |
+
// Saw the "Checkout Method" step because they are not logged in.
|
89 |
+
$this->checkoutOnepageRenderLogin($observer);
|
90 |
+
break;
|
91 |
+
case 'checkout.onepage.billing':
|
92 |
+
// Always rendered into the onepage checkout.
|
93 |
+
$this->checkoutOnepageRenderBilling($observer);
|
94 |
+
break;
|
95 |
+
case 'checkout.onepage.shipping':
|
96 |
+
// Always rendered into the onepage checkout.
|
97 |
+
$this->checkoutOnepageRenderShipping($observer);
|
98 |
+
break;
|
99 |
+
|
100 |
+
}
|
101 |
+
|
102 |
+
return $this;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Inject a track() call into the minicart.
|
107 |
+
*
|
108 |
+
* This handles the case where an item is removed via the minicart. We inject a track call into the HTML that
|
109 |
+
* replaces the minicart content.
|
110 |
+
*
|
111 |
+
* This is a block rendering event - modify the HTML in the transport object.
|
112 |
+
*/
|
113 |
+
private function minicartContent(Varien_Event_Observer $observer) {
|
114 |
+
// Pull the original block HMTL from transport.
|
115 |
+
$blockHtml = $observer->getEvent()->getTransport()->getHtml();
|
116 |
+
|
117 |
+
// Generate the track call to inject into the block.
|
118 |
+
$trackHtml = Mage::app()->getLayout()
|
119 |
+
->createBlock('trialfire_tracker/cart')
|
120 |
+
->toHtml();
|
121 |
+
|
122 |
+
// Put the modified block HTML into transport.
|
123 |
+
$observer->getEvent()->getTransport()->setHtml($blockHtml . $trackHtml);
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Inject a track() call into the login block.
|
128 |
+
*
|
129 |
+
* This is the "Checkout Method" step which is displayed when the user is a guest. It will be displayed along with
|
130 |
+
* the billing step block. However, the billing step block will contain additional fields to facilitate a guest
|
131 |
+
* checkout and possibly registration.
|
132 |
+
*
|
133 |
+
* If they login, the page will reload and begin the checkout process again.
|
134 |
+
*
|
135 |
+
* This is a block rendering event - modify the HTML in the transport object.
|
136 |
+
*/
|
137 |
+
private function checkoutOnepageRenderLogin(Varien_Event_Observer $observer) {
|
138 |
+
// Pull the original block HMTL from transport.
|
139 |
+
$blockHtml = $observer->getEvent()->getTransport()->getHtml();
|
140 |
+
|
141 |
+
// Generate the track call to inject into the block.
|
142 |
+
$session = Mage::getSingleton("checkout/session");
|
143 |
+
$trackHtml = Mage::app()->getLayout()
|
144 |
+
->createBlock('trialfire_tracker/track')
|
145 |
+
->setTrackName('Viewed Checkout Method Step')
|
146 |
+
->setTrackProperties(array(
|
147 |
+
'quoteId' => $session->getQuoteId()
|
148 |
+
))
|
149 |
+
->toHtml();
|
150 |
+
|
151 |
+
// Put the modified block HTML into transport.
|
152 |
+
$observer->getEvent()->getTransport()->setHtml($blockHtml . $trackHtml);
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Inject a track() call into the billing block.
|
157 |
+
*
|
158 |
+
* This is rendered but hidden until the section is displayed. Inject a script to fire a track event when a
|
159 |
+
* mouseover event is generated over the billing section.
|
160 |
+
*
|
161 |
+
* This is a block rendering event - modify the HTML in the transport object.
|
162 |
+
*/
|
163 |
+
private function checkoutOnepageRenderBilling(Varien_Event_Observer $observer) {
|
164 |
+
// Pull the original block HMTL from transport.
|
165 |
+
$blockHtml = $observer->getEvent()->getTransport()->getHtml();
|
166 |
+
|
167 |
+
// Generate the track call to inject into the block.
|
168 |
+
$session = Mage::getSingleton("checkout/session");
|
169 |
+
$trackHtml = Mage::app()->getLayout()
|
170 |
+
->createBlock('trialfire_tracker/track')
|
171 |
+
->setTemplate('trialfire/tracker/track_observe.phtml')
|
172 |
+
->setTrackName('Viewed Checkout Billing Step')
|
173 |
+
->setTrackProperties(array(
|
174 |
+
'quoteId' => $session->getQuoteId()
|
175 |
+
))
|
176 |
+
->setObserveSelector('co-billing-form')
|
177 |
+
->setObserveEvent('mouseover')
|
178 |
+
->toHtml();
|
179 |
+
|
180 |
+
// Put the modified block HTML into transport.
|
181 |
+
$observer->getEvent()->getTransport()->setHtml($blockHtml . $trackHtml);
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Inject a track() call into the shipping block.
|
186 |
+
*
|
187 |
+
* This is rendered but hidden until the section is displayed. Inject a script to fire a track event when a
|
188 |
+
* mouseover event is generated over the shipping section.
|
189 |
+
*
|
190 |
+
* This is a block rendering event - modify the HTML in the transport object.
|
191 |
+
*/
|
192 |
+
private function checkoutOnepageRenderShipping(Varien_Event_Observer $observer) {
|
193 |
+
// Pull the original block HMTL from transport.
|
194 |
+
$blockHtml = $observer->getEvent()->getTransport()->getHtml();
|
195 |
+
|
196 |
+
// Generate the track call to inject into the block.
|
197 |
+
$session = Mage::getSingleton("checkout/session");
|
198 |
+
$trackHtml = Mage::app()->getLayout()
|
199 |
+
->createBlock('trialfire_tracker/track')
|
200 |
+
->setTemplate('trialfire/tracker/track_observe.phtml')
|
201 |
+
->setTrackName('Viewed Checkout Shipping Step')
|
202 |
+
->setTrackProperties(array(
|
203 |
+
'quoteId' => $session->getQuoteId()
|
204 |
+
))
|
205 |
+
->setObserveSelector('co-shipping-form')
|
206 |
+
->setObserveEvent('mouseover')
|
207 |
+
->toHtml();
|
208 |
+
|
209 |
+
// Put the modified block HTML into transport.
|
210 |
+
$observer->getEvent()->getTransport()->setHtml($blockHtml . $trackHtml);
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Saving the billing information - which means starting the shipping step or the shipping method step.
|
215 |
+
*
|
216 |
+
* This is a controller action - modify the response body.
|
217 |
+
*/
|
218 |
+
public function checkoutOnepageSaveBillingOrShipping(Varien_Event_Observer $observer) {
|
219 |
+
if ($this->isModuleDisabled()) {
|
220 |
+
return $this;
|
221 |
+
}
|
222 |
+
|
223 |
+
// Decode the original JSON response.
|
224 |
+
$body = $observer->getEvent()->getControllerAction()->getResponse()->getBody();
|
225 |
+
$json = Mage::helper('core')->jsonDecode($body);
|
226 |
+
|
227 |
+
if ($json['goto_section'] === 'shipping_method') {
|
228 |
+
// Generate the track call to inject into the block.
|
229 |
+
$session = Mage::getSingleton("checkout/session");
|
230 |
+
$json['update_section']['html'] .= Mage::app()->getLayout()
|
231 |
+
->createBlock('trialfire_tracker/track')
|
232 |
+
->setTrackName('Viewed Checkout Shipping Method Step')
|
233 |
+
->setTrackProperties(array(
|
234 |
+
'quoteId' => $session->getQuoteId()
|
235 |
+
))
|
236 |
+
->toHtml();
|
237 |
+
}
|
238 |
+
|
239 |
+
// Encode the modified JSON and return.
|
240 |
+
$body = Mage::helper('core')->jsonEncode($json);
|
241 |
+
$observer->getEvent()->getControllerAction()->getResponse()->setBody($body);
|
242 |
+
}
|
243 |
+
|
244 |
+
/**
|
245 |
+
* Saving the shipping method - which means starting the payment step.
|
246 |
+
*
|
247 |
+
* This is a controller action - modify the response body.
|
248 |
+
*/
|
249 |
+
public function checkoutOnepageSaveShippingMethod(Varien_Event_Observer $observer) {
|
250 |
+
if ($this->isModuleDisabled()) {
|
251 |
+
return $this;
|
252 |
+
}
|
253 |
+
|
254 |
+
// Decode the original JSON response.
|
255 |
+
$body = $observer->getEvent()->getControllerAction()->getResponse()->getBody();
|
256 |
+
$json = Mage::helper('core')->jsonDecode($body);
|
257 |
+
|
258 |
+
if ($json['goto_section'] === 'payment') {
|
259 |
+
// Generate the track call to inject into the block.
|
260 |
+
$session = Mage::getSingleton("checkout/session");
|
261 |
+
$json['update_section']['html'] .= Mage::app()->getLayout()
|
262 |
+
->createBlock('trialfire_tracker/track')
|
263 |
+
->setTrackName('Viewed Checkout Payment Step')
|
264 |
+
->setTrackProperties(array(
|
265 |
+
'quoteId' => $session->getQuoteId()
|
266 |
+
))
|
267 |
+
->toHtml();
|
268 |
+
}
|
269 |
+
|
270 |
+
// Encode the modified JSON and return.
|
271 |
+
$body = Mage::helper('core')->jsonEncode($json);
|
272 |
+
$observer->getEvent()->getControllerAction()->getResponse()->setBody($body);
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Saving the payment method - which means starting the review step.
|
277 |
+
*
|
278 |
+
* This is a controller action - modify the response body.
|
279 |
+
*/
|
280 |
+
public function checkoutOnepageSavePayment(Varien_Event_Observer $observer) {
|
281 |
+
if ($this->isModuleDisabled()) {
|
282 |
+
return $this;
|
283 |
+
}
|
284 |
+
|
285 |
+
// Decode the original JSON response.
|
286 |
+
$body = $observer->getEvent()->getControllerAction()->getResponse()->getBody();
|
287 |
+
$json = Mage::helper('core')->jsonDecode($body);
|
288 |
+
|
289 |
+
if ($json['goto_section'] === 'review') {
|
290 |
+
// Generate the track call to inject into the block.
|
291 |
+
$session = Mage::getSingleton("checkout/session");
|
292 |
+
$json['update_section']['html'] .= Mage::app()->getLayout()
|
293 |
+
->createBlock('trialfire_tracker/track')
|
294 |
+
->setTrackName('Viewed Checkout Review Step')
|
295 |
+
->setTrackProperties(array(
|
296 |
+
'quoteId' => $session->getQuoteId()
|
297 |
+
))
|
298 |
+
->toHtml();
|
299 |
+
}
|
300 |
+
|
301 |
+
// Encode the modified JSON and return.
|
302 |
+
$body = Mage::helper('core')->jsonEncode($json);
|
303 |
+
$observer->getEvent()->getControllerAction()->getResponse()->setBody($body);
|
304 |
+
}
|
305 |
+
|
306 |
+
}
|
307 |
+
?>
|
app/code/community/Trialfire/Tracker/etc/adminhtml.xml
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Trialfire
|
5 |
+
* @package Trialfire_Tracker
|
6 |
+
* @author Mark Lieberman <mark@trialfire.com>
|
7 |
+
* @copyright Copyright (c) Trialfire
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<!-- Setup ACL to control visibility of admin items -->
|
12 |
+
<acl>
|
13 |
+
<resources>
|
14 |
+
<admin>
|
15 |
+
<children>
|
16 |
+
<system>
|
17 |
+
<children>
|
18 |
+
<config>
|
19 |
+
<!-- ACL for admin/system/config -->
|
20 |
+
<children>
|
21 |
+
<trialfire_tracker translate="title" module="trialfire_tracker">
|
22 |
+
<title>Trialfire Tracker</title>
|
23 |
+
</trialfire_tracker>
|
24 |
+
</children>
|
25 |
+
</config>
|
26 |
+
</children>
|
27 |
+
</system>
|
28 |
+
</children>
|
29 |
+
</admin>
|
30 |
+
</resources>
|
31 |
+
</acl>
|
32 |
+
</config>
|
app/code/community/Trialfire/Tracker/etc/config.xml
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Trialfire
|
5 |
+
* @package Trialfire_Tracker
|
6 |
+
* @author Mark Lieberman <mark@trialfire.com>
|
7 |
+
* @copyright Copyright (c) Trialfire
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Trialfire_Tracker>
|
13 |
+
<version>1.0.0.0</version>
|
14 |
+
</Trialfire_Tracker>
|
15 |
+
</modules>
|
16 |
+
|
17 |
+
<global>
|
18 |
+
<models>
|
19 |
+
<trialfire_tracker>
|
20 |
+
<class>Trialfire_Tracker_Model</class>
|
21 |
+
</trialfire_tracker>
|
22 |
+
</models>
|
23 |
+
<blocks>
|
24 |
+
<trialfire_tracker>
|
25 |
+
<class>Trialfire_Tracker_Block</class>
|
26 |
+
</trialfire_tracker>
|
27 |
+
</blocks>
|
28 |
+
<helpers>
|
29 |
+
<trialfire_tracker>
|
30 |
+
<class>Trialfire_Tracker_Helper</class>
|
31 |
+
</trialfire_tracker>
|
32 |
+
</helpers>
|
33 |
+
</global>
|
34 |
+
|
35 |
+
<frontend>
|
36 |
+
<layout>
|
37 |
+
<updates>
|
38 |
+
<trialfire_tracker>
|
39 |
+
<file>trialfire_tracker.xml</file>
|
40 |
+
</trialfire_tracker>
|
41 |
+
</updates>
|
42 |
+
</layout>
|
43 |
+
<events>
|
44 |
+
<!-- Customer events -->
|
45 |
+
<customer_login>
|
46 |
+
<observers>
|
47 |
+
<lpf_modulecookie_customer_login>
|
48 |
+
<class>trialfire_tracker/observer</class>
|
49 |
+
<method>customerLogin</method>
|
50 |
+
</lpf_modulecookie_customer_login>
|
51 |
+
</observers>
|
52 |
+
</customer_login>
|
53 |
+
<!-- Shopping Cart events -->
|
54 |
+
<sales_quote_add_item>
|
55 |
+
<observers>
|
56 |
+
<trialfire_tracker_addedToCart>
|
57 |
+
<class>trialfire_tracker/observer</class>
|
58 |
+
<method>addedToCart</method>
|
59 |
+
</trialfire_tracker_addedToCart>
|
60 |
+
</observers>
|
61 |
+
</sales_quote_add_item>
|
62 |
+
<sales_quote_remove_item>
|
63 |
+
<observers>
|
64 |
+
<trialfire_tracker_addedToCart>
|
65 |
+
<class>trialfire_tracker/observer</class>
|
66 |
+
<method>removedFromCart</method>
|
67 |
+
</trialfire_tracker_addedToCart>
|
68 |
+
</observers>
|
69 |
+
</sales_quote_remove_item>
|
70 |
+
<!-- Onepage Checkout events -->
|
71 |
+
<core_block_abstract_to_html_after>
|
72 |
+
<observers>
|
73 |
+
<trialfire_tracker_coreBlockAbstractToHtmlAfter>
|
74 |
+
<class>trialfire_tracker/observer</class>
|
75 |
+
<method>coreBlockAbstractToHtmlAfter</method>
|
76 |
+
</trialfire_tracker_coreBlockAbstractToHtmlAfter>
|
77 |
+
</observers>
|
78 |
+
</core_block_abstract_to_html_after>
|
79 |
+
<controller_action_postdispatch_checkout_onepage_saveBilling>
|
80 |
+
<observers>
|
81 |
+
<trialfire_tracker_checkoutOnepageSaveBilling>
|
82 |
+
<class>trialfire_tracker/observer</class>
|
83 |
+
<method>checkoutOnepageSaveBillingOrShipping</method>
|
84 |
+
</trialfire_tracker_checkoutOnepageSaveBilling>
|
85 |
+
</observers>
|
86 |
+
</controller_action_postdispatch_checkout_onepage_saveBilling>
|
87 |
+
<controller_action_postdispatch_checkout_onepage_saveShipping>
|
88 |
+
<observers>
|
89 |
+
<trialfire_tracker_checkoutOnepageSaveShipping>
|
90 |
+
<class>trialfire_tracker/observer</class>
|
91 |
+
<method>checkoutOnepageSaveBillingOrShipping</method>
|
92 |
+
</trialfire_tracker_checkoutOnepageSaveShipping>
|
93 |
+
</observers>
|
94 |
+
</controller_action_postdispatch_checkout_onepage_saveShipping>
|
95 |
+
<controller_action_postdispatch_checkout_onepage_saveShippingMethod>
|
96 |
+
<observers>
|
97 |
+
<trialfire_tracker_checkoutOnepageSaveShippingMethod>
|
98 |
+
<class>trialfire_tracker/observer</class>
|
99 |
+
<method>checkoutOnepageSaveShippingMethod</method>
|
100 |
+
</trialfire_tracker_checkoutOnepageSaveShippingMethod>
|
101 |
+
</observers>
|
102 |
+
</controller_action_postdispatch_checkout_onepage_saveShippingMethod>
|
103 |
+
<controller_action_postdispatch_checkout_onepage_savePayment>
|
104 |
+
<observers>
|
105 |
+
<trialfire_tracker_checkoutOnepageSavePayment>
|
106 |
+
<class>trialfire_tracker/observer</class>
|
107 |
+
<method>checkoutOnepageSavePayment</method>
|
108 |
+
</trialfire_tracker_checkoutOnepageSavePayment>
|
109 |
+
</observers>
|
110 |
+
</controller_action_postdispatch_checkout_onepage_savePayment>
|
111 |
+
</events>
|
112 |
+
</frontend>
|
113 |
+
|
114 |
+
<admin>
|
115 |
+
<routers>
|
116 |
+
<adminhtml>
|
117 |
+
<args>
|
118 |
+
<modules>
|
119 |
+
<Trialfire_Tracker after="Mage_adminhtml">Trialfire_Tracker</Trialfire_Tracker>
|
120 |
+
</modules>
|
121 |
+
</args>
|
122 |
+
</adminhtml>
|
123 |
+
</routers>
|
124 |
+
</admin>
|
125 |
+
|
126 |
+
<default>
|
127 |
+
<trialfire_tracker>
|
128 |
+
<settings>
|
129 |
+
<active>0</active>
|
130 |
+
<api_token></api_token>
|
131 |
+
<asset_url>//cdn.trialfire.com/tf.js</asset_url>
|
132 |
+
</settings>
|
133 |
+
</trialfire_tracker>
|
134 |
+
</default>
|
135 |
+
</config>
|
app/code/community/Trialfire/Tracker/etc/system.xml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Trialfire
|
5 |
+
* @package Trialfire_Tracker
|
6 |
+
* @author Mark Lieberman <mark@trialfire.com>
|
7 |
+
* @copyright Copyright (c) Trialfire
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<sections>
|
12 |
+
<trialfire_tracker translate="label" module="trialfire_tracker">
|
13 |
+
<!-- Adding a label to the Service tab -->
|
14 |
+
<label>Trialfire</label>
|
15 |
+
<tab>service</tab>
|
16 |
+
<frontend_type>text</frontend_type>
|
17 |
+
<sort_order>200</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 |
+
<groups>
|
22 |
+
<settings translate="label">
|
23 |
+
<label>Trialfire Settings</label>
|
24 |
+
<frontend_type>text</frontend_type>
|
25 |
+
<sort_order>10</sort_order>
|
26 |
+
<show_in_default>1</show_in_default>
|
27 |
+
<show_in_website>1</show_in_website>
|
28 |
+
<show_in_store>1</show_in_store>
|
29 |
+
<fields>
|
30 |
+
<api_token translate="label">
|
31 |
+
<label>API Token</label>
|
32 |
+
<frontend_type>text</frontend_type>
|
33 |
+
<sort_order>20</sort_order>
|
34 |
+
<show_in_default>1</show_in_default>
|
35 |
+
<show_in_website>1</show_in_website>
|
36 |
+
<show_in_store>1</show_in_store>
|
37 |
+
</api_token>
|
38 |
+
<asset_url translate="label">
|
39 |
+
<label>Asset URL</label>
|
40 |
+
<frontend_type>text</frontend_type>
|
41 |
+
<sort_order>100</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
</asset_url>
|
46 |
+
</fields>
|
47 |
+
</settings>
|
48 |
+
</groups>
|
49 |
+
</trialfire_tracker>
|
50 |
+
</sections>
|
51 |
+
</config>
|
app/design/frontend/base/default/template/trialfire/tracker/head.phtml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Trialfire
|
4 |
+
* @package Trialfire_Tracker
|
5 |
+
* @author Mark Lieberman <mark@trialfire.com>
|
6 |
+
* @copyright Copyright (c) Trialfire
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<!-- Trialfire tracker include -->
|
10 |
+
<script type="text/javascript" src="<?php echo $this->getAssetUrl(); ?>"></script>
|
11 |
+
<script type="text/javascript">
|
12 |
+
Trialfire.init('<?php echo $this->getApiToken(); ?>');
|
13 |
+
</script>
|
app/design/frontend/base/default/template/trialfire/tracker/identify.phtml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Trialfire
|
4 |
+
* @package Trialfire_Tracker
|
5 |
+
* @author Mark Lieberman <mark@trialfire.com>
|
6 |
+
* @copyright Copyright (c) Trialfire
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<!-- Trialfire.identify() call -->
|
10 |
+
<?php if ($this->getShouldIdentify()): ?>
|
11 |
+
<script type="text/javascript">
|
12 |
+
try {
|
13 |
+
if (window.sessionStorage && !!window.sessionStorage.getItem('tf-log')) {
|
14 |
+
console.log('trialfire_tacker: identify()', <?php echo $this->getUserId(); ?>, <?php echo $this->getUserTraits(); ?>);
|
15 |
+
}
|
16 |
+
} catch (e) {}
|
17 |
+
Trialfire.identify(<?php echo $this->getUserId(); ?>, <?php echo $this->getUserTraits(); ?>);
|
18 |
+
</script>
|
19 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/trialfire/tracker/track.phtml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Trialfire
|
4 |
+
* @package Trialfire_Tracker
|
5 |
+
* @author Mark Lieberman <mark@trialfire.com>
|
6 |
+
* @copyright Copyright (c) Trialfire
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<!-- Trialfire.track() call -->
|
10 |
+
<?php if ($this->getShouldTrack()): ?>
|
11 |
+
<script type="text/javascript">
|
12 |
+
try {
|
13 |
+
if (window.sessionStorage && !!window.sessionStorage.getItem('tf-log')) {
|
14 |
+
console.log('trialfire_tacker: track()', '<?php echo $this->getTrackName(); ?>', <?php echo $this->getTrackProperties(); ?>);
|
15 |
+
}
|
16 |
+
} catch (e) {}
|
17 |
+
Trialfire.track('<?php echo $this->getTrackName(); ?>', <?php echo $this->getTrackProperties(); ?>);
|
18 |
+
</script>
|
19 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/trialfire/tracker/track_observe.phtml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Trialfire
|
4 |
+
* @package Trialfire_Tracker
|
5 |
+
* @author Mark Lieberman <mark@trialfire.com>
|
6 |
+
* @copyright Copyright (c) Trialfire
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<!-- Trialfire.track() call -->
|
10 |
+
<script type="text/javascript">
|
11 |
+
(function(){
|
12 |
+
var fired = false;
|
13 |
+
$('<?php echo $this->getObserveSelector(); ?>').observe('<?php echo $this->getObserveEvent(); ?>', function() {
|
14 |
+
if (!fired) {
|
15 |
+
try {
|
16 |
+
if (window.sessionStorage && !!window.sessionStorage.getItem('tf-log')) {
|
17 |
+
console.log('trialfire_tacker: track()', '<?php echo $this->getTrackName(); ?>', <?php echo $this->getTrackProperties(); ?>);
|
18 |
+
}
|
19 |
+
} catch (e) {}
|
20 |
+
Trialfire.track('<?php echo $this->getTrackName(); ?>', <?php echo $this->getTrackProperties(); ?>);
|
21 |
+
fired = true;
|
22 |
+
}
|
23 |
+
});
|
24 |
+
})();
|
25 |
+
</script>
|
26 |
+
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Trialfire</name>
|
4 |
-
<version>1.0.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
@@ -14,9 +14,9 @@ With Trialfire you'll unlock the insight you need to optimize campaigns, convers
|
|
14 |
This plugin adds the Trialfire tracking code to your Magento store.</description>
|
15 |
<notes>Initial release</notes>
|
16 |
<authors><author><name>Trialfire Inc</name><user>trialfire</user><email>dev@trialfire.com</email></author></authors>
|
17 |
-
<date>2016-01-
|
18 |
-
<time>
|
19 |
-
<contents><target name="magecommunity"><dir name="."><file name="
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Trialfire</name>
|
4 |
+
<version>1.0.0.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
14 |
This plugin adds the Trialfire tracking code to your Magento store.</description>
|
15 |
<notes>Initial release</notes>
|
16 |
<authors><author><name>Trialfire Inc</name><user>trialfire</user><email>dev@trialfire.com</email></author></authors>
|
17 |
+
<date>2016-01-28</date>
|
18 |
+
<time>18:44:41</time>
|
19 |
+
<contents><target name="magecommunity"><dir name="Trialfire"><dir name="Tracker"><dir name="Block"><file name="Cart.php" hash="e75a2250f009ee7ca22033b35d578bca"/><file name="Customer.php" hash="3d8b2749a11e6edc7bd0adf51f9df51f"/><dir name="Event"><dir name="Catalog"><dir name="Category"><file name="View.php" hash="4c9969127af57c8c95fa9e7e6036e6c8"/></dir><dir name="Product"><file name="View.php" hash="cab211406a3cf8a2ee002bb7e065ba71"/></dir></dir><dir name="Checkout"><dir name="Onepage"><file name="Guest.php" hash="65e4eb16e9ecad5cbc61f3cedd74f263"/><file name="Index.php" hash="fe7058aff3e104eca04c41414ab55809"/><file name="Success.php" hash="329568d3aed49247d9a1d8d717843eaa"/></dir></dir></dir><file name="Head.php" hash="8b5c7304d23623e01bc55d85d9c4ffa6"/><file name="Identify.php" hash="b6acf4f5dacf244bb7d0fb54cedd5884"/><file name="Track.php" hash="2eda408f8f23418263714deed7495094"/></dir><dir name="Helper"><file name="Data.php" hash="7a7a24170f3c8340c7c4cf12fc224113"/></dir><dir name="Model"><file name="Observer.php" hash="0e77dcda35fdd974efc194fba2e3ab91"/></dir><dir name="etc"><file name="adminhtml.xml" hash="48f436b8767f8bf907d2d4267009753a"/><file name="config.xml" hash="beba83aad414a27f13d7695c6f8559cc"/><file name="system.xml" hash="2adae09d370c8efa1d440831a1d3b1e3"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="trialfire_tracker.xml" hash="f97a42f08627af655f8db6781dd777fb"/></dir><dir name="template"><dir name="trialfire"><dir name="tracker"><file name="head.phtml" hash="92020d75fed67ede5a4310a938bb72fa"/><file name="identify.phtml" hash="bedf0b05692a11d7ca761fc26f02c364"/><file name="track.phtml" hash="5d2a0880940d1da8124a81be2c4aa045"/><file name="track_observe.phtml" hash="df05bd94fad61300ded5f575ee943d56"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Trialfire_Tracker.xml" hash="f5635971c563f892c7d80fdf3e7f145f"/></dir></target></contents>
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|