cadence_fbpixel - Version 1.2.0

Version Notes

Tested on CE 1.9.x;
Added Events:
- AddToWishlist
- AddToCart
- InitiateCheckout
- ViewContent (Product)
- Search

Download this release

Release Info

Developer Cadence Labs
Extension cadence_fbpixel
Version 1.2.0
Comparing to
See all releases


Code changes from version 1.1.1 to 1.2.0

app/code/community/Cadence/Fbpixel/Helper/Data.php CHANGED
@@ -1,7 +1,8 @@
1
  <?php
 
2
  /**
3
  * @author Alan Barber <alan@cadence-labs.com>
4
- */
5
  class Cadence_Fbpixel_Helper_Data extends Mage_Core_Helper_Abstract
6
  {
7
  public function isVisitorPixelEnabled()
@@ -14,6 +15,31 @@ class Cadence_Fbpixel_Helper_Data extends Mage_Core_Helper_Abstract
14
  return Mage::getStoreConfig("cadence_fbpixel/conversion/enabled");
15
  }
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  public function getVisitorPixelId()
18
  {
19
  return Mage::getStoreConfig("cadence_fbpixel/visitor/pixel_id");
@@ -23,4 +49,27 @@ class Cadence_Fbpixel_Helper_Data extends Mage_Core_Helper_Abstract
23
  {
24
  return Mage::getStoreConfig("cadence_fbpixel/conversion/pixel_id");
25
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  }
1
  <?php
2
+
3
  /**
4
  * @author Alan Barber <alan@cadence-labs.com>
5
+ */
6
  class Cadence_Fbpixel_Helper_Data extends Mage_Core_Helper_Abstract
7
  {
8
  public function isVisitorPixelEnabled()
15
  return Mage::getStoreConfig("cadence_fbpixel/conversion/enabled");
16
  }
17
 
18
+ public function isAddToCartPixelEnabled()
19
+ {
20
+ return Mage::getStoreConfig("cadence_fbpixel/add_to_cart/enabled");
21
+ }
22
+
23
+ public function isAddToWishlistPixelEnabled()
24
+ {
25
+ return Mage::getStoreConfig('cadence_fbpixel/add_to_wishlist/enabled');
26
+ }
27
+
28
+ public function isInitiateCheckoutPixelEnabled()
29
+ {
30
+ return Mage::getStoreConfig('cadence_fbpixel/inititiate_checkout/enabled');
31
+ }
32
+
33
+ public function isViewProductPixelEnabled()
34
+ {
35
+ return Mage::getStoreConfig('cadence_fbpixel/view_product/enabled');
36
+ }
37
+
38
+ public function isSearchPixelEnabled()
39
+ {
40
+ return Mage::getStoreConfig('cadence_fbpixel/search/enabled');
41
+ }
42
+
43
  public function getVisitorPixelId()
44
  {
45
  return Mage::getStoreConfig("cadence_fbpixel/visitor/pixel_id");
49
  {
50
  return Mage::getStoreConfig("cadence_fbpixel/conversion/pixel_id");
51
  }
52
+
53
+ /**
54
+ * @param $event
55
+ * @param $data
56
+ * @return string
57
+ */
58
+ public function getPixelHtml($event, $data = false)
59
+ {
60
+ $id = $this->getVisitorPixelId();
61
+ $json = '';
62
+ $query = '';
63
+ if ($data) {
64
+ $json = ', ' . json_encode($data);
65
+ }
66
+ $html = <<<HTML
67
+ <!-- Begin Facebook {$event} Pixel -->
68
+ <script type="text/javascript">
69
+ fbq('track', '{$event}'{$json});
70
+ </script>
71
+ <!-- End Facebook {$event} Pixel -->
72
+ HTML;
73
+ return $html;
74
+ }
75
  }
app/code/community/Cadence/Fbpixel/Model/Observer.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Alan Barber <alan@cadence-labs.com>
5
+ */
6
+ Class Cadence_Fbpixel_Model_Observer
7
+ {
8
+ /**
9
+ * @param Varien_Event_Observer $obs
10
+ * @return $this
11
+ */
12
+ public function onSalesQuoteProductAddAfter(Varien_Event_Observer $obs)
13
+ {
14
+ if (!$this->_helper()->isAddToCartPixelEnabled()) {
15
+ return $this;
16
+ }
17
+
18
+ $items = $obs->getItems();
19
+
20
+ $candidates = array_replace(array(
21
+ 'content_ids' => [],
22
+ 'value' => 0.00
23
+ ), $this->_getSession()->getAddToCart() ?: array());
24
+
25
+ /** @var Mage_Sales_Model_Quote_Item $item */
26
+ foreach ($items as $item) {
27
+ if ($item->getParentItem()) {
28
+ continue;
29
+ }
30
+ $candidates['content_ids'][] = $item->getSku();
31
+ $candidates['value'] += $item->getProduct()->getFinalPrice() * $item->getProduct()->getQty();
32
+ }
33
+
34
+ $data = array(
35
+ 'content_type' => 'product',
36
+ 'content_ids' => $candidates['content_ids'],
37
+ 'value' => $candidates['value'],
38
+ 'currency' => Mage::app()->getStore()->getCurrentCurrencyCode()
39
+ );
40
+
41
+ $this->_getSession()->setAddToCart($data);
42
+
43
+ return $this;
44
+ }
45
+
46
+ /**
47
+ * @param Varien_Event_Observer $obs
48
+ * @return $this
49
+ */
50
+ public function onWishlistAddProduct(Varien_Event_Observer $obs)
51
+ {
52
+ /** @var Mage_Catalog_Model_Product $product */
53
+ $product = $obs->getProduct();
54
+ if (!$this->_helper()->isAddToWishlistPixelEnabled() || !$product) {
55
+ return $this;
56
+ }
57
+
58
+ $data = [
59
+ 'content_type' => 'product',
60
+ 'content_ids' => [$product->getSku()],
61
+ 'value' => $product->getFinalPrice(),
62
+ 'currency' => Mage::app()->getStore()->getCurrentCurrencyCode()
63
+ ];
64
+
65
+ $this->_getSession()->setAddToWishlist($data);
66
+
67
+ return $this;
68
+ }
69
+
70
+ /**
71
+ * @return $this
72
+ */
73
+ public function onInitiateCheckout($obs)
74
+ {
75
+ if (!$this->_helper()->isInitiateCheckoutPixelEnabled()) {
76
+ return $this;
77
+ }
78
+ if (!count(Mage::getSingleton('checkout/session')->getQuote()->getAllVisibleItems())) {
79
+ return $this;
80
+ }
81
+
82
+ $this->_getSession()->setInitiateCheckout();
83
+
84
+ return $this;
85
+ }
86
+
87
+ /**
88
+ * @param Varien_Event_Observer $obs
89
+ * @return $this
90
+ */
91
+ public function onCatalogControllerProductInitAfter(Varien_Event_Observer $obs)
92
+ {
93
+ /** @var Mage_Catalog_Model_Product $product */
94
+ $product = $obs->getProduct();
95
+ if (!$this->_helper()->isViewProductPixelEnabled() || !$product) {
96
+ return $this;
97
+ }
98
+ $data = [
99
+ 'content_type' => 'product',
100
+ 'content_ids' => [$product->getSku()],
101
+ 'value' => $product->getFinalPrice(),
102
+ 'currency' => Mage::app()->getStore()->getCurrentCurrencyCode(),
103
+ 'content_name' => $product->getName()
104
+ ];
105
+
106
+ $this->_getSession()->setViewProduct($data);
107
+
108
+ return $this;
109
+ }
110
+
111
+ /**
112
+ * @param $obs
113
+ * @return $this
114
+ */
115
+ public function onSearch($obs)
116
+ {
117
+ $text = Mage::helper('catalogsearch')->getQueryText();
118
+ if (!$this->_helper()->isSearchPixelEnabled() || !$text || !strlen($text)) {
119
+ return $this;
120
+ }
121
+
122
+ $data = [
123
+ 'search_string' => $text
124
+ ];
125
+
126
+ $this->_getSession()->setSearch($data);
127
+
128
+ return $this;
129
+ }
130
+
131
+ /**
132
+ * @return Cadence_Fbpixel_Model_Session
133
+ */
134
+ protected function _getSession()
135
+ {
136
+ return Mage::getSingleton('cadence_fbpixel/session');
137
+ }
138
+
139
+ /**
140
+ * @return Cadence_Fbpixel_Helper_Data
141
+ */
142
+ protected function _helper()
143
+ {
144
+ return Mage::helper("cadence_fbpixel");
145
+ }
146
+ }
app/code/community/Cadence/Fbpixel/Model/Session.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Alan Barber <alan@cadence-labs.com>
4
+ */
5
+ Class Cadence_Fbpixel_Model_Session extends Mage_Core_Model_Session_Abstract
6
+ {
7
+ public function __construct()
8
+ {
9
+ $this->init('cadence_fbpixel');
10
+ }
11
+
12
+ /**
13
+ * @param $data
14
+ * @return $this
15
+ */
16
+ public function setAddToCart($data)
17
+ {
18
+ $this->setData('add_to_cart', $data);
19
+ return $this;
20
+ }
21
+
22
+ /**
23
+ * @return mixed|null
24
+ */
25
+ public function getAddToCart()
26
+ {
27
+ if ($this->hasAddToCart()) {
28
+ $data = $this->getData('add_to_cart');
29
+ $this->unsetData('add_to_cart');
30
+ return $data;
31
+ }
32
+ return null;
33
+ }
34
+
35
+ /**
36
+ * @return bool
37
+ */
38
+ public function hasAddToCart()
39
+ {
40
+ return $this->hasData('add_to_cart');
41
+ }
42
+
43
+ /**
44
+ * @param $data
45
+ * @return $this
46
+ */
47
+ public function setAddToWishlist($data)
48
+ {
49
+ $this->setData('add_to_wishlist', $data);
50
+ return $this;
51
+ }
52
+
53
+ /**
54
+ * @return mixed|null
55
+ */
56
+ public function getAddToWishlist()
57
+ {
58
+ if ($this->hasAddToWishlist()) {
59
+ $data = $this->getData('add_to_wishlist');
60
+ $this->unsetData('add_to_wishlist');
61
+ return $data;
62
+ }
63
+ return null;
64
+ }
65
+
66
+ /**
67
+ * @return bool
68
+ */
69
+ public function hasAddToWishlist()
70
+ {
71
+ return $this->hasData('add_to_wishlist');
72
+ }
73
+
74
+ /**
75
+ * @return bool
76
+ */
77
+ public function hasInitiateCheckout()
78
+ {
79
+ $has = $this->hasData('initiate_checkout');
80
+ if ($has) {
81
+ $this->unsetData('initiate_checkout');
82
+ }
83
+ return $has;
84
+ }
85
+
86
+ /**
87
+ * @return $this
88
+ */
89
+ public function setInitiateCheckout()
90
+ {
91
+ $this->setData('initiate_checkout', true);
92
+ return $this;
93
+ }
94
+
95
+ /**
96
+ * @return bool
97
+ */
98
+ public function hasViewProduct()
99
+ {
100
+ return $this->hasData('view_product');
101
+ }
102
+
103
+ /**
104
+ * @return mixed|null
105
+ */
106
+ public function getViewProduct()
107
+ {
108
+ if ($this->hasViewProduct()) {
109
+ $data = $this->getData('view_product');
110
+ $this->unsetData('view_product');
111
+ return $data;
112
+ }
113
+ return null;
114
+ }
115
+
116
+ /**
117
+ * @param $data
118
+ * @return $this
119
+ */
120
+ public function setViewProduct($data)
121
+ {
122
+ $this->setData('view_product', $data);
123
+ return $this;
124
+ }
125
+
126
+ /**
127
+ * @return bool
128
+ */
129
+ public function hasSearch()
130
+ {
131
+ return $this->hasData('search');
132
+ }
133
+
134
+ /**
135
+ * @return mixed|null
136
+ */
137
+ public function getSearch()
138
+ {
139
+ if ($this->hasSearch()) {
140
+ $data = $this->getData('search');
141
+ $this->unsetData('search');
142
+ return $data;
143
+ }
144
+ return null;
145
+ }
146
+
147
+ /**
148
+ * @param $value
149
+ * @return $this
150
+ */
151
+ public function setSearch($value)
152
+ {
153
+ $this->setData('search', $value);
154
+ return $this;
155
+ }
156
+ }
app/code/community/Cadence/Fbpixel/etc/config.xml CHANGED
@@ -34,6 +34,56 @@
34
  </cadence_fbpixel>
35
  </updates>
36
  </layout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  </frontend>
38
  <default>
39
  <cadence_fbpixel>
34
  </cadence_fbpixel>
35
  </updates>
36
  </layout>
37
+ <events>
38
+ <sales_quote_product_add_after>
39
+ <observers>
40
+ <cadence_fbpixel_add_to_cart>
41
+ <class>Cadence_Fbpixel_Model_Observer</class>
42
+ <method>onSalesQuoteProductAddAfter</method>
43
+ </cadence_fbpixel_add_to_cart>
44
+ </observers>
45
+ </sales_quote_product_add_after>
46
+ <wishlist_add_product>
47
+ <observers>
48
+ <cadence_fbpixel_add_to_wishlist>
49
+ <class>Cadence_Fbpixel_Model_Observer</class>
50
+ <method>onWishlistAddProduct</method>
51
+ </cadence_fbpixel_add_to_wishlist>
52
+ </observers>
53
+ </wishlist_add_product>
54
+ <controller_action_predispatch_checkout_multishipping_index>
55
+ <observers>
56
+ <cadence_fbpixel_initiate_checkout_multi>
57
+ <class>Cadence_Fbpixel_Model_Observer</class>
58
+ <method>onInitiateCheckout</method>
59
+ </cadence_fbpixel_initiate_checkout_multi>
60
+ </observers>
61
+ </controller_action_predispatch_checkout_multishipping_index>
62
+ <controller_action_predispatch_checkout_onepage_index>
63
+ <observers>
64
+ <cadence_fbpixel_initiate_checkout_onepage>
65
+ <class>Cadence_Fbpixel_Model_Observer</class>
66
+ <method>onInitiateCheckout</method>
67
+ </cadence_fbpixel_initiate_checkout_onepage>
68
+ </observers>
69
+ </controller_action_predispatch_checkout_onepage_index>
70
+ <controller_action_predispatch_catalogsearch_result_index>
71
+ <observers>
72
+ <cadence_fbpixel_search>
73
+ <class>Cadence_Fbpixel_Model_Observer</class>
74
+ <method>onSearch</method>
75
+ </cadence_fbpixel_search>
76
+ </observers>
77
+ </controller_action_predispatch_catalogsearch_result_index>
78
+ <catalog_controller_product_init_after>
79
+ <observers>
80
+ <cadence_fbpixel_product_init_after>
81
+ <class>Cadence_Fbpixel_Model_Observer</class>
82
+ <method>onCatalogControllerProductInitAfter</method>
83
+ </cadence_fbpixel_product_init_after>
84
+ </observers>
85
+ </catalog_controller_product_init_after>
86
+ </events>
87
  </frontend>
88
  <default>
89
  <cadence_fbpixel>
app/code/community/Cadence/Fbpixel/etc/system.xml CHANGED
@@ -58,10 +58,105 @@
58
  <show_in_default>1</show_in_default>
59
  <show_in_website>1</show_in_website>
60
  <show_in_store>1</show_in_store>
61
- <comment>The base pixel must be enabled to track conversions.</comment>
62
  </enabled>
63
  </fields>
64
  </conversion>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  </groups>
66
  </cadence_fbpixel>
67
  </sections>
58
  <show_in_default>1</show_in_default>
59
  <show_in_website>1</show_in_website>
60
  <show_in_store>1</show_in_store>
61
+ <comment>The base pixel must be enabled to track conversions. Includes parameters for grand total and currency.</comment>
62
  </enabled>
63
  </fields>
64
  </conversion>
65
+ <add_to_cart translate="label">
66
+ <label>Add To Cart (Optional)</label>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ <sort_order>3</sort_order>
71
+ <fields>
72
+ <enabled translate="label" module="cadence_fbpixel">
73
+ <label>Enable</label>
74
+ <frontend_type>select</frontend_type>
75
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
76
+ <sort_order>10</sort_order>
77
+ <show_in_default>1</show_in_default>
78
+ <show_in_website>1</show_in_website>
79
+ <show_in_store>1</show_in_store>
80
+ <comment>The base pixel must be enabled to track addToCart. Includes parameters for all product SKU's added, the total value for added products, and currency.</comment>
81
+ </enabled>
82
+ </fields>
83
+ </add_to_cart>
84
+ <add_to_wishlist translate="label">
85
+ <label>Add To Wishlist (Optional)</label>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ <show_in_store>1</show_in_store>
89
+ <sort_order>4</sort_order>
90
+ <fields>
91
+ <enabled translate="label" module="cadence_fbpixel">
92
+ <label>Enable</label>
93
+ <frontend_type>select</frontend_type>
94
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
95
+ <sort_order>10</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>1</show_in_website>
98
+ <show_in_store>1</show_in_store>
99
+ <comment>The base pixel must be enabled to track addToWishlist. Includes parameters for the product sku added, price of product, and currency.</comment>
100
+ </enabled>
101
+ </fields>
102
+ </add_to_wishlist>
103
+ <inititiate_checkout translate="label">
104
+ <label>Initiate Checkout (Optional)</label>
105
+ <show_in_default>1</show_in_default>
106
+ <show_in_website>1</show_in_website>
107
+ <show_in_store>1</show_in_store>
108
+ <sort_order>5</sort_order>
109
+ <fields>
110
+ <enabled translate="label" module="cadence_fbpixel">
111
+ <label>Enable</label>
112
+ <frontend_type>select</frontend_type>
113
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
114
+ <sort_order>10</sort_order>
115
+ <show_in_default>1</show_in_default>
116
+ <show_in_website>1</show_in_website>
117
+ <show_in_store>1</show_in_store>
118
+ <comment>The base pixel must be enabled to track initiateCheckout. Includes no parameters</comment>
119
+ </enabled>
120
+ </fields>
121
+ </inititiate_checkout>
122
+ <view_product translate="label">
123
+ <label>View Product (Optional)</label>
124
+ <show_in_default>1</show_in_default>
125
+ <show_in_website>1</show_in_website>
126
+ <show_in_store>1</show_in_store>
127
+ <sort_order>6</sort_order>
128
+ <fields>
129
+ <enabled translate="label" module="cadence_fbpixel">
130
+ <label>Enable</label>
131
+ <frontend_type>select</frontend_type>
132
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
133
+ <sort_order>10</sort_order>
134
+ <show_in_default>1</show_in_default>
135
+ <show_in_website>1</show_in_website>
136
+ <show_in_store>1</show_in_store>
137
+ <comment>The base pixel must be enabled to track viewProduct. Includes parameters for product price, product name, product sku, and currency</comment>
138
+ </enabled>
139
+ </fields>
140
+ </view_product>
141
+ <search translate="label">
142
+ <label>Search (Optional)</label>
143
+ <show_in_default>1</show_in_default>
144
+ <show_in_website>1</show_in_website>
145
+ <show_in_store>1</show_in_store>
146
+ <sort_order>7</sort_order>
147
+ <fields>
148
+ <enabled translate="label" module="cadence_fbpixel">
149
+ <label>Enable</label>
150
+ <frontend_type>select</frontend_type>
151
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
152
+ <sort_order>10</sort_order>
153
+ <show_in_default>1</show_in_default>
154
+ <show_in_website>1</show_in_website>
155
+ <show_in_store>1</show_in_store>
156
+ <comment>The base pixel must be enabled to track search. Includes a parameter for the search string.</comment>
157
+ </enabled>
158
+ </fields>
159
+ </search>
160
  </groups>
161
  </cadence_fbpixel>
162
  </sections>
app/design/frontend/base/default/layout/cadence_fbpixel.xml CHANGED
@@ -2,7 +2,8 @@
2
  <layout version="0.1.0">
3
  <default>
4
  <reference name="head">
5
- <block type="core/template" template="cadence/fbpixel/visitor.phtml" />
 
6
  </reference>
7
  </default>
8
  <checkout_onepage_success translate="label">
2
  <layout version="0.1.0">
3
  <default>
4
  <reference name="head">
5
+ <block type="core/template" template="cadence/fbpixel/visitor.phtml" name="cadence_fbpixel_visitor" />
6
+ <block type="core/template" template="cadence/fbpixel/events.phtml" name="cadence_fbpixel_events" />
7
  </reference>
8
  </default>
9
  <checkout_onepage_success translate="label">
app/design/frontend/base/default/template/cadence/fbpixel/conversion.phtml CHANGED
@@ -21,5 +21,5 @@ $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
21
  fbq('track', 'Purchase', {value: '<?php echo $grand_total ?>', currency: '<?php echo $currency_code ?>'});
22
  </script>
23
  <noscript><img height="1" width="1" style="display:none"
24
- src="https://www.facebook.com/tr?id=<?php echo $id ?>&ev=Purchase&value=<?php echo $grand_total ?>&currency=<?php echo $currency_code ?>&noscript=1"
25
  /></noscript>
21
  fbq('track', 'Purchase', {value: '<?php echo $grand_total ?>', currency: '<?php echo $currency_code ?>'});
22
  </script>
23
  <noscript><img height="1" width="1" style="display:none"
24
+ src="https://www.facebook.com/tr?id=<?php echo $id ?>&ev=Purchase&cd[value]=<?php echo $grand_total ?>&cd[currency]=<?php echo $currency_code ?>&noscript=1"
25
  /></noscript>
app/design/frontend/base/default/template/cadence/fbpixel/events.phtml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $helper = Mage::helper("cadence_fbpixel");
3
+ $session = Mage::getSingleton('cadence_fbpixel/session');
4
+ $id = $helper->getVisitorPixelId();?>
5
+ <?php if ($helper->isAddToCartPixelEnabled() && $session->hasAddToCart()) : ?>
6
+ <?php echo $helper->getPixelHtml('AddToCart', $session->getAddToCart()); ?>
7
+ <?php endif; ?>
8
+ <?php if ($helper->isAddToWishlistPixelEnabled() && $session->hasAddToWishlist()): ?>
9
+ <?php echo $helper->getPixelHtml('AddToWishlist', $session->getAddToWishlist()); ?>
10
+ <?php endif; ?>
11
+ <?php if ($helper->isInitiateCheckoutPixelEnabled() && $session->hasInitiateCheckout()): ?>
12
+ <?php echo $helper->getPixelHtml('InitiateCheckout'); ?>
13
+ <?php endif; ?>
14
+ <?php if ($helper->isViewProductPixelEnabled() && $session->hasViewProduct()): ?>
15
+ <?php echo $helper->getPixelHtml('ViewContent', $session->getViewProduct()); ?>
16
+ <?php endif; ?>
17
+ <?php if ($helper->isSearchPixelEnabled() && $session->hasSearch()): ?>
18
+ <?php echo $helper->getPixelHtml('Search', $session->getSearch()); ?>
19
+ <?php endif; ?>
package.xml CHANGED
@@ -1,25 +1,31 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>cadence_fbpixel</name>
4
- <version>1.1.1</version>
5
  <stability>stable</stability>
6
  <license>GNU GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>This extension allows you to quickly implement Facebook tracking and conversion code on your Magento store. Supports Visitor and Purchase tracking events through the Facebook pixel</summary>
10
- <description>&lt;p&gt;This Facebook Conversion Code extension allows you to quickly implement visitor and purchase events through the new Facebook Pixel. &lt;a href="http://www.cadence-labs.com/2015/03/free-magento-mail-chimp-popup-extention/" title="User Manual"&gt;&lt;strong&gt;Learn how it works.&lt;/strong&gt;&lt;/a&gt;. &lt;/p&gt;&#xD;
11
  &lt;p&gt;Click here to view the official&#xD;
12
  &lt;a href="http://www.cadence-labs.com/2015/03/free-magento-mail-chimp-popup-extention/" title="User Manual"&gt;Facebook Tracking &amp;amp; Conversion Code User Guide&lt;/a&gt; with detailed step-by-step instructions. &lt;/p&gt;&#xD;
13
  &lt;h2&gt;Tracks Currency &amp;amp; Grand Total&lt;/h2&gt;&#xD;
14
- &lt;p&gt;This extension supports stores with multiple currencies, and tracks both the order grand total &amp;amp; order currency (conversion pixel only).&lt;/p&gt; &#xD;
15
  &#xD;
16
  &lt;h2&gt;About The Developer&lt;/h2&gt;&#xD;
17
  &lt;p&gt;&lt;a href="http://www.cadence-labs.com/" title="Cadence Labs"&gt;Cadence Labs&lt;/a&gt; is a digital marketing, design, and Magento agency based in Boulder, Colorado. Our developers are Magento certified eCommerce geeks!&lt;/p&gt;</description>
18
- <notes>Tested on 1.9</notes>
 
 
 
 
 
 
19
  <authors><author><name>Cadence Labs</name><user>cadencelabs</user><email>alan@cadence-labs.com</email></author></authors>
20
- <date>2016-07-19</date>
21
- <time>02:43:54</time>
22
- <contents><target name="magecommunity"><dir name="Cadence"><dir name="Fbpixel"><dir name="Helper"><file name="Data.php" hash="473e99657209bd2e1639640321cf0ae3"/></dir><dir name="etc"><file name="adminhtml.xml" hash="5b6a3e063450264720f766584dbd5055"/><file name="config.xml" hash="6cd8b235fdc17c943bb6efb3dda75e52"/><file name="system.xml" hash="17100ac3d7e76238368a4bf09b564a30"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cadence_Fbpixel.xml" hash="3a82d06be6deb217df2bf11c543bc068"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="cadence_fbpixel.xml" hash="3287578213b7a92169d531606efbb9a4"/></dir><dir name="template"><dir name="cadence"><dir name="fbpixel"><file name="conversion.phtml" hash="956fccead55a19c4b19f3b8cbe71ffee"/><file name="visitor.phtml" hash="7752c825fd59c10b6971353d2e65fcd8"/></dir></dir></dir></dir></dir></dir></target></contents>
23
  <compatible/>
24
- <dependencies><required><php><min>5.2.0</min><max>5.6.999</max></php></required></dependencies>
25
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>cadence_fbpixel</name>
4
+ <version>1.2.0</version>
5
  <stability>stable</stability>
6
  <license>GNU GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>This extension allows you to quickly implement Facebook tracking and conversion code on your Magento store. Supports Visitor, Purchase, AddToCart, AddToWishlist, ViewProduct, Search, &amp; Initiate Checkout Events</summary>
10
+ <description>&lt;p&gt;This Facebook Conversion Code extension allows you to quickly implement events using the new Facebook Pixel. &lt;a href="http://www.cadence-labs.com/2015/03/free-magento-mail-chimp-popup-extention/" title="User Manual"&gt;&lt;strong&gt;Learn how it works.&lt;/strong&gt;&lt;/a&gt;. &lt;/p&gt;&#xD;
11
  &lt;p&gt;Click here to view the official&#xD;
12
  &lt;a href="http://www.cadence-labs.com/2015/03/free-magento-mail-chimp-popup-extention/" title="User Manual"&gt;Facebook Tracking &amp;amp; Conversion Code User Guide&lt;/a&gt; with detailed step-by-step instructions. &lt;/p&gt;&#xD;
13
  &lt;h2&gt;Tracks Currency &amp;amp; Grand Total&lt;/h2&gt;&#xD;
14
+ &lt;p&gt;This extension supports stores with multiple currencies, and supports Visitor, Purchase, AddToCart, AddToWishlist, ViewProduct, Search, &amp; Initiate Checkout Events.&lt;/p&gt; &#xD;
15
  &#xD;
16
  &lt;h2&gt;About The Developer&lt;/h2&gt;&#xD;
17
  &lt;p&gt;&lt;a href="http://www.cadence-labs.com/" title="Cadence Labs"&gt;Cadence Labs&lt;/a&gt; is a digital marketing, design, and Magento agency based in Boulder, Colorado. Our developers are Magento certified eCommerce geeks!&lt;/p&gt;</description>
18
+ <notes>Tested on CE 1.9.x; &#xD;
19
+ Added Events:&#xD;
20
+ - AddToWishlist&#xD;
21
+ - AddToCart&#xD;
22
+ - InitiateCheckout&#xD;
23
+ - ViewContent (Product)&#xD;
24
+ - Search</notes>
25
  <authors><author><name>Cadence Labs</name><user>cadencelabs</user><email>alan@cadence-labs.com</email></author></authors>
26
+ <date>2017-03-11</date>
27
+ <time>22:52:00</time>
28
+ <contents><target name="magecommunity"><dir name="Cadence"><dir name="Fbpixel"><dir name="Helper"><file name="Data.php" hash="df6d52af7fe615f77a53a18210b97104"/></dir><dir name="Model"><file name="Observer.php" hash="79f6413f672154a566f4fa2ec85982bf"/><file name="Session.php" hash="285559645c2b83a79556746a16065463"/></dir><dir name="etc"><file name="adminhtml.xml" hash="5b6a3e063450264720f766584dbd5055"/><file name="config.xml" hash="196df3b90f07c5fc95960622463d73c7"/><file name="system.xml" hash="f8f314ddb543665cd206bbd379ce3119"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cadence_Fbpixel.xml" hash="3a82d06be6deb217df2bf11c543bc068"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="cadence_fbpixel.xml" hash="84c0ad44bca8b73138e31fbce73554a2"/></dir><dir name="template"><dir name="cadence"><dir name="fbpixel"><file name="conversion.phtml" hash="e602b1ffe10f1b2e21064ba09002657a"/><file name="events.phtml" hash="e3a770f7b4dec9c4632073cb3fb1191f"/><file name="visitor.phtml" hash="7752c825fd59c10b6971353d2e65fcd8"/></dir></dir></dir></dir></dir></dir></target></contents>
29
  <compatible/>
30
+ <dependencies><required><php><min>5.2.0</min><max>7.1.9</max></php></required></dependencies>
31
  </package>