Remmote_Facebookpixel - Version 1.0.0

Version Notes

Release version

Download this release

Release Info

Developer Remmote
Extension Remmote_Facebookpixel
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Remmote/Facebookpixel/Block/Code.php ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @extension Remmote_Facebookpixel
4
+ * @author Remmote
5
+ * @copyright 2016 - Remmote.com
6
+ * @descripion Code Block
7
+ */
8
+ class Remmote_Facebookpixel_Block_Code extends Mage_Core_Block_Template {
9
+
10
+ /**
11
+ * Renders pixel code if module is enabled
12
+ * @return [type]
13
+ * @author edudeleon
14
+ * @date 2016-10-10
15
+ */
16
+ public function _toHtml()
17
+ {
18
+ if (Mage::helper('remmote_facebookpixel')->isEnabled()){
19
+ return parent::_toHtml();
20
+ }
21
+ }
22
+
23
+ /**
24
+ * Return Facebook Pixel Id
25
+ * @return [type]
26
+ * @author edudeleon
27
+ * @date 2016-10-10
28
+ */
29
+ public function getPixelId(){
30
+ return Mage::helper('remmote_facebookpixel')->getPixelId();
31
+ }
32
+
33
+ /**
34
+ * Get store current section
35
+ * @return [type]
36
+ * @author edudeleon
37
+ * @date 2016-10-11
38
+ */
39
+ private function _getSection(){
40
+ $pageSection = Mage::app()->getFrontController()->getAction()->getFullActionName();
41
+ return $pageSection;
42
+ }
43
+
44
+ /**
45
+ * Get current store currency
46
+ * @return [type]
47
+ * @author edudeleon
48
+ * @date 2016-10-11
49
+ */
50
+ private function _getStoreCurrency(){
51
+ return Mage::app()->getStore()->getCurrentCurrencyCode();
52
+ }
53
+
54
+ /**
55
+ * Return View Content event track
56
+ * @return [type]
57
+ * @author edudeleon
58
+ * @date 2016-10-11
59
+ */
60
+ public function getViewContentEvent(){
61
+ $pageSection = $this->_getSection();
62
+
63
+ //Check if event is enabled
64
+ if(Mage::helper('remmote_facebookpixel')->viewContentEnabled()){
65
+ if($pageSection == 'catalog_product_view'){
66
+ return "fbq('track', 'ViewContent');";
67
+ }
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Return Search event track
73
+ * @return [type]
74
+ * @author edudeleon
75
+ * @date 2016-10-11
76
+ */
77
+ public function getSearchEvent(){
78
+ $pageSection = $this->_getSection();
79
+
80
+ //Check if event is enabled
81
+ if(Mage::helper('remmote_facebookpixel')->searchEnabled()){
82
+ if($pageSection == 'catalogsearch_result_index' || $pageSection == 'catalogsearch_advanced_result'){
83
+ return "fbq('track', 'Search');";
84
+ }
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Return AddToCart event track
90
+ * @return [type]
91
+ * @author edudeleon
92
+ * @date 2016-10-11
93
+ */
94
+ public function getAddToCartEvent(){
95
+ $pageSection = $this->_getSection();
96
+
97
+ //Check if event is enabled
98
+ if(Mage::helper('remmote_facebookpixel')->addToCartEnabled()){
99
+
100
+ $pixelEvent = Mage::getModel('core/session')->getPixelAddToCart();
101
+ if($pixelEvent){
102
+ //Unset event
103
+ Mage::getModel('core/session')->unsPixelAddToCart();
104
+ return "fbq('track', 'AddToCart');";
105
+ }
106
+ }
107
+ }
108
+
109
+ /**
110
+ * Return AddToWishlist event track
111
+ * @return [type]
112
+ * @author edudeleon
113
+ * @date 2016-10-11
114
+ */
115
+ public function getAddToWishlistEvent(){
116
+ $pageSection = $this->_getSection();
117
+
118
+ //Check if event is enabled
119
+ if(Mage::helper('remmote_facebookpixel')->addToWhishlistEnabled()){
120
+ $pixelEvent = Mage::getModel('core/session')->getPixelAddToWishlist();
121
+ if($pixelEvent){
122
+ //Unset event
123
+ Mage::getModel('core/session')->unsPixelAddToWishlist();
124
+ return "fbq('track', 'AddToWishlist');";
125
+ }
126
+ }
127
+ }
128
+
129
+ /**
130
+ * Return InitiateCheckout event track
131
+ * @return [type]
132
+ * @author edudeleon
133
+ * @date 2016-10-11
134
+ */
135
+ public function getInitiateCheckoutEvent(){
136
+ $pageSection = $this->_getSection();
137
+
138
+ //Check if event is enabled
139
+ if(Mage::helper('remmote_facebookpixel')->initiateCheckoutEnabled()){
140
+ if ($pageSection == 'checkout_onepage_index' || $pageSection == 'onestepcheckout_index_index' || $pageSection == 'opc_index_index'){
141
+ return "fbq('track', 'InitiateCheckout');";
142
+ }
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Return AddPaymentInfo event track
148
+ * @return [type]
149
+ * @author edudeleon
150
+ * @date 2016-10-11
151
+ */
152
+ public function getAddPaymentInfoEvent(){
153
+ $pageSection = $this->_getSection();
154
+
155
+ //Check if event is enabled
156
+ if(Mage::helper('remmote_facebookpixel')->addPaymentInfoEnabled()){
157
+ $pixelEvent = Mage::getModel('core/session')->getPixelPaymentInfo();
158
+ if($pixelEvent){
159
+ //Unset event
160
+ Mage::getModel('core/session')->unsPixelPaymentInfo();
161
+
162
+ return "fbq('track', 'AddPaymentInfo');";
163
+ }
164
+ }
165
+ }
166
+
167
+ /**
168
+ * Return Purchase event track
169
+ * @return [type]
170
+ * @author edudeleon
171
+ * @date 2016-10-11
172
+ */
173
+ public function getPurchaseEvent(){
174
+ $pageSection = $this->_getSection();
175
+ $currentCurrency = $this->_getStoreCurrency();
176
+
177
+ //Check if event is enabled
178
+ if(Mage::helper('remmote_facebookpixel')->purchaseEnabled()){
179
+
180
+ $pixelEvent = Mage::getModel('core/session')->getPixelPurchase();
181
+ if($pixelEvent){
182
+ //Unset event
183
+ Mage::getModel('core/session')->unsPixelPurchase();
184
+
185
+ $orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
186
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
187
+ $orderGrandTotal = number_format($order->getGrandTotal(),2);
188
+
189
+ return "fbq('track', 'Purchase', {
190
+ value: '".$orderGrandTotal."',
191
+ currency: '".$currentCurrency."'
192
+ });";
193
+ }
194
+ }
195
+ }
196
+
197
+ /**
198
+ * Return Lead event track
199
+ * @return [type]
200
+ * @author edudeleon
201
+ * @date 2016-10-11
202
+ */
203
+ public function getLeadEvent(){
204
+ $pageSection = $this->_getSection();
205
+
206
+ //Check if event is enabled
207
+ if(Mage::helper('remmote_facebookpixel')->leadEnabled()){
208
+ $pixelEvent = Mage::getModel('core/session')->getPixelLead();
209
+ if($pixelEvent){
210
+ //Unset event
211
+ Mage::getModel('core/session')->unsPixelLead();
212
+
213
+ return "fbq('track', 'Lead');";
214
+ }
215
+ }
216
+ }
217
+
218
+ /**
219
+ * Return CompleteRegistration event track
220
+ * @return [type]
221
+ * @author edudeleon
222
+ * @date 2016-10-11
223
+ */
224
+ public function getCompleteRegistrationEvent(){
225
+ $pageSection = $this->_getSection();
226
+
227
+ //Check if event is enabled
228
+ if(Mage::helper('remmote_facebookpixel')->completeRegistrationEnabled()){
229
+ $pixelEvent = Mage::getModel('core/session')->getPixelCompleteRegistration();
230
+ if($pixelEvent){
231
+ //Unset event
232
+ Mage::getModel('core/session')->unsPixelCompleteRegistration();
233
+
234
+ return "fbq('track', 'CompleteRegistration');";
235
+ }
236
+ }
237
+ }
238
+ }
app/code/community/Remmote/Facebookpixel/Helper/Data.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @extension Remmote_Facebookpixel
4
+ * @author Remmote
5
+ * @copyright 2016 - Remmote.com
6
+ * @descripion Helper
7
+ */
8
+ class Remmote_Facebookpixel_Helper_Data extends Mage_Core_Helper_Abstract
9
+ {
10
+
11
+ //Config paths
12
+ const MODULE_ENABLED = 'remmote_facebookpixel/general/enabled';
13
+ const PIXEL_ID = 'remmote_facebookpixel/general/pixel_id';
14
+ const VIEW_CONTENT = 'remmote_facebookpixel/events/view_content';
15
+ const SEARCH = 'remmote_facebookpixel/events/search';
16
+ const ADD_TO_CART = 'remmote_facebookpixel/events/add_to_cart';
17
+ const ADD_TO_WISHLIST = 'remmote_facebookpixel/events/add_to_wishlist';
18
+ const ADD_PAYMENT_INFO = 'remmote_facebookpixel/events/add_payment_info';
19
+ const INITIATE_CHECKOUT = 'remmote_facebookpixel/events/initiate_checkout';
20
+ const PURCHASE = 'remmote_facebookpixel/events/purchase';
21
+ const LEAD = 'remmote_facebookpixel/events/lead';
22
+ const COMPLETE_REGISTRATION = 'remmote_facebookpixel/events/complete_registration';
23
+
24
+ /**
25
+ * Check if module is enabled and Pixel ID is set
26
+ * @param [type] $store
27
+ * @return boolean
28
+ * @author edudeleon
29
+ * @date 2016-10-10
30
+ */
31
+ public function isEnabled($store = null)
32
+ {
33
+ $pixelId = $this->getPixelId($store);
34
+ return $pixelId && Mage::getStoreConfig(self::MODULE_ENABLED, $store);
35
+ }
36
+
37
+ /**
38
+ * Get Pixel ID
39
+ * @param [type] $store
40
+ * @return [type]
41
+ * @author edudeleon
42
+ * @date 2016-10-10
43
+ */
44
+ public function getPixelId($store = null)
45
+ {
46
+ return Mage::getStoreConfig(self::PIXEL_ID, $store);
47
+ }
48
+
49
+ /**
50
+ * Check if viewContent event is enabled
51
+ * @param [type] $store
52
+ * @return [type]
53
+ * @author edudeleon
54
+ * @date 2016-10-11
55
+ */
56
+ public function viewContentEnabled($store = null){
57
+ return Mage::getStoreConfig(self::VIEW_CONTENT, $store);
58
+ }
59
+
60
+ /**
61
+ * Check if Search event is enabled
62
+ * @param [type] $store
63
+ * @return [type]
64
+ * @author edudeleon
65
+ * @date 2016-10-11
66
+ */
67
+ public function searchEnabled($store = null){
68
+ return Mage::getStoreConfig(self::SEARCH, $store);
69
+ }
70
+
71
+ /**
72
+ * Check if AddToCart event is enabled
73
+ * @param [type] $store
74
+ * @author edudeleon
75
+ * @date 2016-10-11
76
+ */
77
+ public function addToCartEnabled($store = null){
78
+ return Mage::getStoreConfig(self::ADD_TO_CART, $store);
79
+ }
80
+
81
+ /**
82
+ * Check if AddToWhislist event is enabled
83
+ * @param [type] $store
84
+ * @author edudeleon
85
+ * @date 2016-10-11
86
+ */
87
+ public function addToWhishlistEnabled($store = null){
88
+ return Mage::getStoreConfig(self::ADD_TO_WISHLIST, $store);
89
+ }
90
+
91
+ /**
92
+ * Check if AddPaymentInfo event is enabled
93
+ * @param [type] $store
94
+ * @author edudeleon
95
+ * @date 2016-10-11
96
+ */
97
+ public function addPaymentInfoEnabled($store = null){
98
+ return Mage::getStoreConfig(self::ADD_PAYMENT_INFO, $store);
99
+ }
100
+
101
+ /**
102
+ * Check if InitiateCheckout event is enabled
103
+ * @param [type] $store
104
+ * @return [type]
105
+ * @author edudeleon
106
+ * @date 2016-10-11
107
+ */
108
+ public function initiateCheckoutEnabled($store = null){
109
+ return Mage::getStoreConfig(self::INITIATE_CHECKOUT, $store);
110
+ }
111
+
112
+ /**
113
+ * Check if Purchase event is enabled
114
+ * @param [type] $store
115
+ * @return [type]
116
+ * @author edudeleon
117
+ * @date 2016-10-11
118
+ */
119
+ public function purchaseEnabled($store = null){
120
+ return Mage::getStoreConfig(self::PURCHASE, $store);
121
+ }
122
+
123
+ /**
124
+ * check if Lead event is enabled
125
+ * @param [type] $store
126
+ * @return [type]
127
+ * @author edudeleon
128
+ * @date 2016-10-11
129
+ */
130
+ public function leadEnabled($store = null){
131
+ return Mage::getStoreConfig(self::LEAD, $store);
132
+ }
133
+
134
+ /**
135
+ * check if CompleteRegistration event is enabled
136
+ * @param [type] $store
137
+ * @return [type]
138
+ * @author edudeleon
139
+ * @date 2016-10-11
140
+ */
141
+ public function completeRegistrationEnabled($store = null){
142
+ return Mage::getStoreConfig(self::COMPLETE_REGISTRATION, $store);
143
+ }
144
+ }
app/code/community/Remmote/Facebookpixel/Model/Observer.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @extension Remmote_Facebookpixel
4
+ * @author Remmote
5
+ * @copyright 2016 - Remmote.com
6
+ * @descripion Facebook Pixel Events observer
7
+ */
8
+ class Remmote_Facebookpixel_Model_Observer
9
+ {
10
+ /**
11
+ * Set a flag in session when a product is added to the cart
12
+ * @param [type] $observer
13
+ * @return [type]
14
+ * @author edudeleon
15
+ * @date 2016-10-12
16
+ */
17
+ public function logPixelAddToCart($observer) {
18
+ //Logging event
19
+ Mage::getModel('core/session')->setPixelAddToCart(true);
20
+ }
21
+
22
+ /**
23
+ * Set a flag in session when a product is added to the wishlist
24
+ * @param [type] $observer
25
+ * @return [type]
26
+ * @author edudeleon
27
+ * @date 2016-10-12
28
+ */
29
+ public function logPixelAddToWishlist($observer) {
30
+ //Logging event
31
+ Mage::getModel('core/session')->setPixelAddToWishlist(true);
32
+ }
33
+
34
+ /**
35
+ * Set a flag in session when a customer selects the payment method
36
+ * @param [type] $observer
37
+ * @return [type]
38
+ * @author edudeleon
39
+ * @date 2016-10-12
40
+ */
41
+ public function logPixelPaymentInfo($observer){
42
+ //Logging event
43
+ Mage::getModel('core/session')->setPixelPaymentInfo(true);
44
+ }
45
+
46
+ /**
47
+ * Set a flag in session when a purchase is made
48
+ * @param [type] $observer
49
+ * @return [type]
50
+ * @author edudeleon
51
+ * @date 2016-10-12
52
+ */
53
+ public function logPixelPurchase($observer){
54
+ //Logging event
55
+ Mage::getModel('core/session')->setPixelPurchase(true);
56
+ }
57
+
58
+ /**
59
+ * Set a flag in session when a customer creates an account
60
+ * @param [type] $observer
61
+ * @return [type]
62
+ * @author edudeleon
63
+ * @date 2016-10-12
64
+ */
65
+ public function logPixelCompleteRegistration($observer){
66
+ //Logging event
67
+ Mage::getModel('core/session')->setPixelCompleteRegistration(true);
68
+ }
69
+
70
+ /**
71
+ * Set a flag in session when a customer signup to the newsletter
72
+ * @param [type] $observer
73
+ * @return [type]
74
+ * @author edudeleon
75
+ * @date 2016-10-12
76
+ */
77
+ public function logPixelCompleteRegistrationNewsletter($observer) {
78
+ $subscriber = $observer->getEvent()->getSubscriber();
79
+ $statusChanged = $subscriber->getIsStatusChanged();
80
+ if($subscriber->getStatus() == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED && $statusChanged) {
81
+ Mage::getModel('core/session')->setPixelCompleteRegistration(true);
82
+
83
+ //Set flag for Lead Event
84
+ Mage::getModel('core/session')->setPixelLead(true);
85
+ }
86
+ }
87
+ }
app/code/community/Remmote/Facebookpixel/etc/config.xml ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <!--
3
+ /**
4
+ * @extension Remmote_Facebookpixel
5
+ * @author Remmote
6
+ * @copyright 2016 - Remmote.com
7
+ * @descripion Module config
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Remmote_Facebookpixel>
13
+ <version>1.0.0</version>
14
+ </Remmote_Facebookpixel>
15
+ </modules>
16
+
17
+ <frontend>
18
+ <layout>
19
+ <updates>
20
+ <remmote_facebookpixel>
21
+ <file>remmote_facebookpixel.xml</file>
22
+ </remmote_facebookpixel>
23
+ </updates>
24
+ </layout>
25
+
26
+ <events>
27
+ <checkout_cart_product_add_after>
28
+ <observers>
29
+ <remmote_facebookpixel_logpixeladdtocart>
30
+ <class>remmote_facebookpixel/observer</class>
31
+ <method>logPixelAddToCart</method>
32
+ </remmote_facebookpixel_logpixeladdtocart>
33
+ </observers>
34
+ </checkout_cart_product_add_after>
35
+
36
+ <wishlist_add_product>
37
+ <observers>
38
+ <remmote_facebookpixel_logpixeladdtowishlist>
39
+ <class>remmote_facebookpixel/observer</class>
40
+ <method>logPixelAddToWishlist</method>
41
+ </remmote_facebookpixel_logpixeladdtowishlist>
42
+ </observers>
43
+ </wishlist_add_product>
44
+
45
+ <sales_quote_payment_import_data_before>
46
+ <observers>
47
+ <remmote_facebookpixel_logpixelpaymentinfo>
48
+ <class>remmote_facebookpixel/observer</class>
49
+ <method>logPixelPaymentInfo</method>
50
+ </remmote_facebookpixel_logpixelpaymentinfo>
51
+ </observers>
52
+ </sales_quote_payment_import_data_before>
53
+
54
+ <sales_order_place_after>
55
+ <observers>
56
+ <remmote_facebookpixel_logpixelpurchase>
57
+ <class>remmote_facebookpixel/observer</class>
58
+ <method>logPixelPurchase</method>
59
+ </remmote_facebookpixel_logpixelpurchase>
60
+ </observers>
61
+ </sales_order_place_after>
62
+
63
+ <newsletter_subscriber_save_before>
64
+ <observers>
65
+ <remmote_facebookpixel_logpixelcompleteregistrationnewsletter>
66
+ <class>remmote_facebookpixel/observer</class>
67
+ <method>logPixelCompleteRegistrationNewsletter</method>
68
+ </remmote_facebookpixel_logpixelcompleteregistrationnewsletter>
69
+ </observers>
70
+ </newsletter_subscriber_save_before>
71
+
72
+ <customer_register_success>
73
+ <observers>
74
+ <remmote_facebookpixel_logpixelcompleteregistration>
75
+ <class>remmote_facebookpixel/observer</class>
76
+ <method>logPixelCompleteRegistration</method>
77
+ </remmote_facebookpixel_logpixelcompleteregistration>
78
+ </observers>
79
+ </customer_register_success>
80
+
81
+ </events>
82
+ </frontend>
83
+
84
+ <global>
85
+ <helpers>
86
+ <remmote_facebookpixel>
87
+ <class>Remmote_Facebookpixel_Helper</class>
88
+ </remmote_facebookpixel>
89
+ </helpers>
90
+ <models>
91
+ <remmote_facebookpixel>
92
+ <class>Remmote_Facebookpixel_Model</class>
93
+ </remmote_facebookpixel>
94
+ </models>
95
+ <blocks>
96
+ <remmote_facebookpixel>
97
+ <class>Remmote_Facebookpixel_Block</class>
98
+ </remmote_facebookpixel>
99
+ </blocks>
100
+ </global>
101
+
102
+ <!-- Admin panel sections -->
103
+ <adminhtml>
104
+ <acl>
105
+ <resources>
106
+ <admin>
107
+ <children>
108
+ <system>
109
+ <children>
110
+ <config>
111
+ <children>
112
+ <remmote_facebookpixel>
113
+ <title>Facebook Pixel Extension</title>
114
+ </remmote_facebookpixel>
115
+ </children>
116
+ </config>
117
+ </children>
118
+ </system>
119
+ </children>
120
+ </admin>
121
+ </resources>
122
+ </acl>
123
+ </adminhtml>
124
+ </config>
app/code/community/Remmote/Facebookpixel/etc/system.xml ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @extension Remmote_Facebookpixel
5
+ * @author Remmote
6
+ * @copyright 2016 - Remmote.com
7
+ * @descripion Module admin panel settings
8
+ */
9
+ -->
10
+ <config>
11
+ <tabs>
12
+ <remmote_extensions translate="label" module="remmote_facebookpixel">
13
+ <label>Remmote Extensions</label>
14
+ <sort_order>250</sort_order>
15
+ </remmote_extensions>
16
+ </tabs>
17
+ <sections>
18
+ <remmote_facebookpixel translate="label" module="remmote_facebookpixel">
19
+ <label>Facebook Pixel Settings</label>
20
+ <tab>remmote_extensions</tab>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>1</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <groups>
27
+ <general translate="label">
28
+ <label>General Configuration</label>
29
+ <frontend_type>text</frontend_type>
30
+ <sort_order>10</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ <comment><![CDATA[This extension will install Facebook Pixel in your Magento store. Test in real time using the Google Chrome extension: <a href="https://chrome.google.com/webstore/detail/facebook-pixel-helper/fdgfkebogiimcoedlicjlajpkdmockpc" target="_blank">Facebook Pixel Helper</a>]]>
35
+ </comment>
36
+ <fields>
37
+ <enabled translate="label">
38
+ <label>Module Enabled</label>
39
+ <frontend_type>select</frontend_type>
40
+ <source_model>adminhtml/system_config_source_yesno</source_model>
41
+ <sort_order>10</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
+ <comment>Enable Facebook Pixel Extension?</comment>
46
+ </enabled>
47
+
48
+ <pixel_id translate="label">
49
+ <label>Facebook Pixel ID</label>
50
+ <frontend_type>text</frontend_type>
51
+ <sort_order>20</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ <comment>Your Facebook Pixel ID</comment>
56
+ </pixel_id>
57
+ </fields>
58
+ </general>
59
+
60
+ <events translate="label">
61
+ <label>Facebook Pixel Standard Events</label>
62
+ <frontend_type>text</frontend_type>
63
+ <sort_order>30</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>1</show_in_store>
67
+ <comment><![CDATA[You can choose to enable standard events separately. Find more information about Facebook Standard Events <a href="https://web.facebook.com/business/help/952192354843755" target="_blank">here</a> <br/> If you have any question or need a custom extension development, just drop us a message in <a href="http://www.remmote.com/contact-us/" target="_blank">Remmote.com </a> ]]>
68
+ </comment>
69
+ <fields>
70
+ <view_content translate="label">
71
+ <label>Enable ViewContent Event</label>
72
+ <frontend_type>select</frontend_type>
73
+ <source_model>adminhtml/system_config_source_yesno</source_model>
74
+ <sort_order>10</sort_order>
75
+ <show_in_default>1</show_in_default>
76
+ <show_in_website>1</show_in_website>
77
+ <show_in_store>1</show_in_store>
78
+ <comment>Event triggers when someone visits the product page view.</comment>
79
+ </view_content>
80
+
81
+ <search translate="label">
82
+ <label>Enable Search Event</label>
83
+ <frontend_type>select</frontend_type>
84
+ <source_model>adminhtml/system_config_source_yesno</source_model>
85
+ <sort_order>20</sort_order>
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
+ <comment>Event triggers when someone searches for something using the search feature. Compatible with Advanced Search.</comment>
90
+ </search>
91
+
92
+ <add_to_cart translate="label">
93
+ <label>Enable AddToCart Event</label>
94
+ <frontend_type>select</frontend_type>
95
+ <source_model>adminhtml/system_config_source_yesno</source_model>
96
+ <sort_order>30</sort_order>
97
+ <show_in_default>1</show_in_default>
98
+ <show_in_website>1</show_in_website>
99
+ <show_in_store>1</show_in_store>
100
+ <comment>Event triggers when someone adds a product to the cart (e.g. click on 'Add To Cart' button).</comment>
101
+ </add_to_cart>
102
+
103
+ <add_to_wishlist translate="label">
104
+ <label>Enable AddToWishlist Event</label>
105
+ <frontend_type>select</frontend_type>
106
+ <source_model>adminhtml/system_config_source_yesno</source_model>
107
+ <sort_order>40</sort_order>
108
+ <show_in_default>1</show_in_default>
109
+ <show_in_website>1</show_in_website>
110
+ <show_in_store>1</show_in_store>
111
+ <comment>Event triggers when someone adds a product to the wishlist (e.g. click on 'Add To Wishlist' button).</comment>
112
+ </add_to_wishlist>
113
+
114
+ <initiate_checkout translate="label">
115
+ <label>Enable InitiateCheckout Event</label>
116
+ <frontend_type>select</frontend_type>
117
+ <source_model>adminhtml/system_config_source_yesno</source_model>
118
+ <sort_order>50</sort_order>
119
+ <show_in_default>1</show_in_default>
120
+ <show_in_website>1</show_in_website>
121
+ <show_in_store>1</show_in_store>
122
+ <comment>Event triggers when someone lands in the checkout process page. Compatible with One Step Checkout.</comment>
123
+ </initiate_checkout>
124
+
125
+ <add_payment_info translate="label">
126
+ <label>Enable AddPaymentInfo Event</label>
127
+ <frontend_type>select</frontend_type>
128
+ <source_model>adminhtml/system_config_source_yesno</source_model>
129
+ <sort_order>60</sort_order>
130
+ <show_in_default>1</show_in_default>
131
+ <show_in_website>1</show_in_website>
132
+ <show_in_store>1</show_in_store>
133
+ <comment>Event triggers when someone selects a payment method in the checkout process page. </comment>
134
+ </add_payment_info>
135
+
136
+ <purchase translate="label">
137
+ <label>Enable Purchase Event</label>
138
+ <frontend_type>select</frontend_type>
139
+ <source_model>adminhtml/system_config_source_yesno</source_model>
140
+ <sort_order>70</sort_order>
141
+ <show_in_default>1</show_in_default>
142
+ <show_in_website>1</show_in_website>
143
+ <show_in_store>1</show_in_store>
144
+ <comment>Event triggers when someone places an order (success page view).</comment>
145
+ </purchase>
146
+
147
+ <lead translate="label">
148
+ <label>Enable Lead Event</label>
149
+ <frontend_type>select</frontend_type>
150
+ <source_model>adminhtml/system_config_source_yesno</source_model>
151
+ <sort_order>80</sort_order>
152
+ <show_in_default>1</show_in_default>
153
+ <show_in_website>1</show_in_website>
154
+ <show_in_store>1</show_in_store>
155
+ <comment>Event triggers when someone signup to the newsletter.</comment>
156
+ </lead>
157
+
158
+ <complete_registration translate="label">
159
+ <label>Enable CompleteRegistration Event</label>
160
+ <frontend_type>select</frontend_type>
161
+ <source_model>adminhtml/system_config_source_yesno</source_model>
162
+ <sort_order>90</sort_order>
163
+ <show_in_default>1</show_in_default>
164
+ <show_in_website>1</show_in_website>
165
+ <show_in_store>1</show_in_store>
166
+ <comment>Event triggers when someone creates an account or signup to the newsletter.</comment>
167
+ </complete_registration>
168
+ </fields>
169
+ </events>
170
+ </groups>
171
+ </remmote_facebookpixel>
172
+ </sections>
173
+ </config>
app/design/frontend/base/default/layout/remmote_facebookpixel.xml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @extension Remmote_Facebookpixel
5
+ * @author Remmote
6
+ * @copyright 2016 - Remmote.com
7
+ * @descripion Layout file
8
+ */
9
+ -->
10
+ <layout version="1.0.0">
11
+ <default>
12
+ <reference name="head">
13
+ <block type="remmote_facebookpixel/code" name="remmote_facebookpixel" as="remmote_facebookpixel" template="remmote/facebookpixel/code.phtml"/>
14
+ </reference>
15
+ </default>
16
+ </layout>
app/design/frontend/base/default/template/remmote/facebookpixel/code.phtml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @extension Remmote_Facebookpixel
4
+ * @author Remmote
5
+ * @copyright 2016 - Remmote.com
6
+ * @descripion Pixel code template
7
+ */
8
+ ?>
9
+
10
+ <!-- Facebook Pixel Code -->
11
+ <script>
12
+ !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
13
+ n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
14
+ n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
15
+ t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
16
+ document,'script','//connect.facebook.net/en_US/fbevents.js');
17
+
18
+ <?php
19
+ $pixel_id = $this->getPixelId();
20
+ ?>
21
+
22
+ fbq('init', '<?php echo $pixel_id ?>');
23
+ fbq('track', 'PageView');
24
+
25
+ <?php
26
+ //Stardand events
27
+ echo $this->getViewContentEvent();
28
+ echo $this->getSearchEvent();
29
+ echo $this->getAddToCartEvent();
30
+ echo $this->getAddToWishlistEvent();
31
+ echo $this->getInitiateCheckoutEvent();
32
+ echo $this->getAddPaymentInfoEvent();
33
+ echo $this->getPurchaseEvent();
34
+ echo $this->getLeadEvent();
35
+ echo $this->getCompleteRegistrationEvent();
36
+ ?>
37
+
38
+ </script>
39
+ <noscript><img height="1" width="1" style="display:none"
40
+ src="https://www.facebook.com/tr?id=<?php echo $pixel_id?>&ev=PageView&noscript=1"
41
+ /></noscript>
42
+ <!-- End Facebook Pixel Code -->
app/etc/modules/Remmote_Facebookpixel.xml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Copyright © 2016 Remmote.com
5
+ * Module Config
6
+ * @autor eduedeleon
7
+ */
8
+ -->
9
+ <config>
10
+ <modules>
11
+ <Remmote_Facebookpixel>
12
+ <active>true</active>
13
+ <codePool>community</codePool>
14
+ </Remmote_Facebookpixel>
15
+ </modules>
16
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Remmote_Facebookpixel</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Install Facebook Pixel in Magento. Extension tracks standard events accurately using Magento events.</summary>
10
+ <description>This extension install Facebook Pixel in Magento stores. All the events are tracked using Magento Events which makes the tracking more accurate than the rest of extensions.</description>
11
+ <notes>Release version</notes>
12
+ <authors><author><name>Remmote</name><user>remmote</user><email>info@remmote.com</email></author></authors>
13
+ <date>2016-10-12</date>
14
+ <time>20:12:59</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Remmote_Facebookpixel.xml" hash="43d40e05033b4ead5b8f65ae873bbcb1"/></dir></target><target name="magecommunity"><dir name="Remmote"><dir name="Facebookpixel"><dir name="Block"><file name="Code.php" hash="efd82fa03963e539424dc091c8c9fe1c"/></dir><dir name="Helper"><file name="Data.php" hash="86f813a208979b520e372040edd6734a"/></dir><dir name="Model"><file name="Observer.php" hash="07e1686bf545a717bdd8bb6100011ce9"/></dir><dir name="etc"><file name="config.xml" hash="8a9cd2635b32252de81eafa7c6aff7b9"/><file name="system.xml" hash="11514e3be9cd57b9ff13d2dafddc6173"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="remmote_facebookpixel.xml" hash="d87afaed251f9545c9dc5213ac6533d9"/></dir><dir name="template"><dir name="remmote"><dir name="facebookpixel"><file name="code.phtml" hash="7112891ef16c97368d9c5c0000b4033b"/></dir></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.3.0</min><max>7.0.0</max></php></required></dependencies>
18
+ </package>