Panalysis_TagManager - Version 0.5.10

Version Notes

Late beta release. This has been tested on 1.8 and 1.9 editions plus 1.4.1.1

Bug fixes include:
- corrections to multiple currency support to ensure correct order and shipping totals
- performance improvements in product listings
- Prevent add to cart and remove from cart dataLayer calls being fired at the same time as order transaction details

Additional features:
- Add Magento page type to data layer
- Added Customer Group attribute to data layer
- Added number of previous orders to data layer

Various other minor updates.

Download this release

Release Info

Developer Rod Jacka
Extension Panalysis_TagManager
Version 0.5.10
Comparing to
See all releases


Code changes from version 0.5.3.1 to 0.5.10

app/code/community/Panalysis/TagManager/.DS_Store DELETED
Binary file
app/code/community/Panalysis/TagManager/Block/.DS_Store DELETED
Binary file
app/code/community/Panalysis/TagManager/Block/Tagmanager.php CHANGED
@@ -6,70 +6,89 @@ class Panalysis_TagManager_Block_Tagmanager extends Mage_Core_Block_Template
6
  {
7
 
8
  $helper = Mage::helper('panalysis_tagmanager');
9
- $session = Mage::getSingleton('core/session');
10
- $trackProductLists = $helper->getTrackProductList();
11
-
12
- // to store the main data layer values
13
- $dataLayer = array();
14
- // to store other secondary events that can occur once the page has loaded such as add to cart, remove from cart
15
- $additionalEventsAdd = array();
16
- $additionalEventsRemove = array();
17
 
18
- $visitorState = $this->getVisitorData();
19
- $dataLayer += $visitorState;
20
-
21
- if ($this->getPage() == 'Product Detail') $dataLayer += $helper->buildProductDetailsData($this->getProductDetails());
22
- if ($this->getPage() == 'Order Success') $dataLayer += $helper->buildOrderData($this->getOrderData());
23
- //if ($this->getPage() == 'Product Category' && $trackProductLists) $dataLayer += $helper->buildCategoryData($this->getCategoryProducts());
24
- if ($this->getPage() == 'Shopping Cart') $dataLayer += $helper->buildCheckoutData($this->getCartProducts());
25
- if ($this->getPage() == 'Onepage Checkout') $dataLayer += $helper->buildOnePageCartCheckoutData($this->getCartProducts());
26
-
27
- // Add to Cart Events
28
- $tmProduct = $session->getTmProduct();
29
- if($tmProduct) $additionalEventsAdd = $helper->buildAddToCartData($tmProduct); // then there is an add to cart product
30
- $session->unsTmProduct();
31
 
32
- // Remove from Cart Events
33
- $rmProducts = $session->getRmProducts();
34
- if ($rmProducts) $additionalEventsRemove = $this->buildRemoveFromCartData($rmProducts);
35
- $session->unsRmProducts();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
- $dataLayerJs = "dataLayer.push(" . json_encode($dataLayer,JSON_PRETTY_PRINT) .");";
38
- if($additionalEventsAdd) $dataLayerJs .= "dataLayer.push(" . json_encode($additionalEventsAdd,JSON_PRETTY_PRINT) .");";
39
- if($additionalEventsRemove) $dataLayerJs .= "dataLayer.push(" . json_encode($additionalEventsRemove,JSON_PRETTY_PRINT) .");";
40
-
 
 
 
 
 
 
 
 
 
 
 
 
41
  return $dataLayerJs;
42
  }
43
 
44
 
45
  public function getTwitterDetails()
46
  {
47
- $helper = Mage::helper('panalysis_tagmanager');
48
- $twitterData = [];
49
- $twitterData['store_username'] = $helper->getTwitterStoreUsername();
50
- if($helper->getTwitterCreatorUsername() != "")
51
- {
52
  $twitterData['creator_username'] = $helper->getTwitterCreatorUsername();
53
- }
54
- else
55
  {
56
  $twitterData['creator_username'] = $twitterData['store_username'];
57
- }
58
-
59
- if($helper->useTwitterLageImage()){
60
- $twitterData['card_format'] = 'summary_large_image';
61
- }else{
62
- $twitterData['card_format'] = 'summary';
63
- }
64
-
65
- if($this->getPage() == "Product Detail"){
66
  $twitterData['image'] = Mage::registry('product')->getImageUrl();
67
- }
68
- else{
69
  $twitterData['image'] = $helper->getTwitterImage();
70
- }
71
-
72
- return $twitterData;
73
  }
74
 
75
  public function getPage()
@@ -105,6 +124,9 @@ class Panalysis_TagManager_Block_Tagmanager extends Mage_Core_Block_Template
105
  ) {
106
  $page = 'Product Category';
107
  }
 
 
 
108
 
109
  Mage::log("Panalysis - " . $page, null, 'events.log', true);
110
  return $page;
@@ -112,31 +134,31 @@ class Panalysis_TagManager_Block_Tagmanager extends Mage_Core_Block_Template
112
 
113
  public function getProductDetails()
114
  {
115
- $helper = Mage::helper('panalysis_tagmanager');
116
  $_product = Mage::registry('current_product');
117
  $tm = Mage::getModel('panalysis_tagmanager/tagmanager');
118
  $products = array();
119
- $productType = $_product->getTypeId();
120
- if ($productType === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE)
121
- {
122
- $associated_ids = $helper->getBundleProducts($_product->getId());
123
- foreach($associated_ids as $child)
124
- {
125
- $products[] = $helper->CreateProductArray($child);
126
- }
127
- } elseif($productType === Mage_Catalog_Model_Product_Type::TYPE_GROUPED) {
128
- $associatedProducts = $_product->getTypeInstance(true)->getAssociatedProducts($_product);
129
- $i = 0;
130
- foreach($associatedProducts as $option)
131
  {
132
- $products[$i] = $helper->CreateProductArray($option->getId(), $option->getQty());
133
- $products[$i]['id'] = $option->getSku();
134
- $products[$i]['name'] = $option->getName();
135
- ++$i;
136
- }
 
 
 
 
 
 
 
 
 
 
137
 
138
- } else {
139
- $products[] = $helper->CreateProductArray($_product->getId());
140
  }
141
 
142
  return $products;
@@ -144,9 +166,9 @@ class Panalysis_TagManager_Block_Tagmanager extends Mage_Core_Block_Template
144
 
145
  public function getOrderData()
146
  {
147
-
148
  $tm = Mage::getModel('panalysis_tagmanager/tagmanager');
149
- $helper = Mage::helper('panalysis_tagmanager');
150
  $order = Mage::getSingleton('sales/order');
151
  $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
152
  $storeName = Mage::app()->getStore()->getName();
@@ -155,48 +177,53 @@ class Panalysis_TagManager_Block_Tagmanager extends Mage_Core_Block_Template
155
  try {
156
  if ($order->getId()) {
157
 
158
- $products = array();
159
-
160
- $data = array(
161
- 'actionField' => array(
162
- 'id' => $order->getIncrementId(),
163
- 'affiliation' => $storeName,
164
- 'revenue' => (float) $order->getBaseGrandTotal(),
165
- 'tax' => (float) $order->getBaseTaxAmount(),
166
- 'shipping' => (float) $order->getBaseShippingAmount(),
167
- 'coupon' => ($order->getCouponCode() ? $order->getCouponCode() : ''),
168
- ),
169
- 'products' => array()
170
- );
171
-
172
- foreach ($order->getAllItems() as $item)
173
- {
174
-
175
- $product = Mage::getModel('catalog/product')->load($item->getProductId());
176
- $product_type = $product->getTypeId();
177
-
178
- if ($product_type === Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE)
179
- $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $item->getSku());
180
-
181
- if ($product_type === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) continue;
182
-
183
- if (empty($products[$item->getSku()])) {
184
- $products[$item->getSku()] = $helper->CreateProductArray($product->getId(), $item->getQtyOrdered(), true);
185
- }elseif((int)$item->getPrice()) {
186
- $products[$item->getSku()]['quantity'] += (int)$item->getQtyOrdered();
187
- }
188
-
189
- }
190
 
191
- foreach ($products as $product)
 
 
 
 
 
 
 
 
 
 
 
 
192
  {
193
- $data['transactionProducts'][] = $product;
194
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  }
196
  } catch (exception $e) {
197
  Mage::logException($e);
198
- }
199
-
200
  return $data;
201
 
202
  }
@@ -207,11 +234,11 @@ class Panalysis_TagManager_Block_Tagmanager extends Mage_Core_Block_Template
207
  }
208
 
209
  public function buildRemoveFromCartData($prods){
210
- $data = array(
211
  'event' => 'removeFromCart',
212
  'ecommerce' => array(
213
  'remove' => array(
214
- 'products' => $prods
215
  )
216
  )
217
  );
@@ -257,17 +284,17 @@ class Panalysis_TagManager_Block_Tagmanager extends Mage_Core_Block_Template
257
  }
258
 
259
  public function getCheckoutState(){
260
- $tm = Mage::getSingleton('panalysis_tagmanager/tagmanager');
261
- return $tm->getCheckoutState();
262
  }
263
 
264
  public function getCategoryProducts(){
265
- $tm = Mage::getSingleton('panalysis_tagmanager/tagmanager');
266
- return $tm->getCategoryProducts();
267
  }
268
 
269
  public function getVisitorData(){
270
- $tm = Mage::getModel('panalysis_tagmanager/tagmanager');
271
- return $tm->getVisitorData();
272
  }
273
  }
6
  {
7
 
8
  $helper = Mage::helper('panalysis_tagmanager');
9
+ $session = Mage::getSingleton('core/session');
10
+ $trackProductLists = $helper->getTrackProductList();
 
 
 
 
 
 
11
 
12
+ // to store the main data layer values
13
+ $dataLayer = array();
14
+ // to store other secondary events that can occur once the page has loaded such as add to cart, remove from cart
15
+ $additionalEventsAdd = array();
16
+ $additionalEventsRemove = array();
 
 
 
 
 
 
 
 
17
 
18
+ $visitorState = $this->getVisitorData();
19
+ $dataLayer += $visitorState;
20
+ $dataLayer['pageType'] = $this->getRequest()->getModuleName() . "-" . $this->getRequest()->getControllerName();
21
+ if($this->getPage() == 'Product Category'){
22
+ $cl = Mage::getModel('catalog/layer');
23
+ $level = $cl->getCurrentCategory()->getParentCategory()->getLevel();
24
+ $cat_str = $cl->getCurrentCategory()->getName();
25
+ if($level > 1){
26
+ $cat = $cl->getCurrentCategory()->getParentCategory();
27
+ while($level > 1){
28
+ $cat_str = $cat->getName() . "/" . $cat_str;
29
+ $cat = $cat->getParentCategory();
30
+ $level--;
31
+ }
32
+ }
33
+ $dataLayer['productCategory'] = $cat_str;
34
+ }
35
+
36
+ if ($this->getPage() == 'Product Detail') $dataLayer += $helper->buildProductDetailsData($this->getProductDetails());
37
+ if ($this->getPage() == 'Order Success') $dataLayer += $helper->buildOrderData($this->getOrderData());
38
+ if ($this->getPage() == 'Shopping Cart') $dataLayer += $helper->buildCheckoutData($this->getCartProducts());
39
+ if ($this->getPage() == 'Onepage Checkout') $dataLayer += $helper->buildOnePageCartCheckoutData($this->getCartProducts());
40
+ if ($this->getPage() == '404') $dataLayer['event']='404';
41
+
42
+ $dataLayerJs = "dataLayer.push(" . json_encode($dataLayer,JSON_PRETTY_PRINT) .");\n";
43
 
44
+ // if this is not an order completion page then check for any additional add to cart or remove from cart events.
45
+ if ($this->getPage() != 'Order Success') {
46
+ // Add to Cart Events
47
+ $tmProduct = $session->getTmProduct();
48
+ if($tmProduct) $additionalEventsAdd = $helper->buildAddToCartData($tmProduct); // then there is an add to cart product
49
+ $session->unsTmProduct();
50
+
51
+ // Remove from Cart Events
52
+ $rmProducts = $session->getRmProducts();
53
+ if ($rmProducts) $additionalEventsRemove = $this->buildRemoveFromCartData($rmProducts);
54
+ $session->unsRmProducts();
55
+ if($additionalEventsAdd) $dataLayerJs .= "dataLayer.push(" . json_encode($additionalEventsAdd,JSON_PRETTY_PRINT) .");\n";
56
+ if($additionalEventsRemove) $dataLayerJs .= "dataLayer.push(" . json_encode($additionalEventsRemove,JSON_PRETTY_PRINT) .");\n";
57
+ }
58
+
59
+
60
  return $dataLayerJs;
61
  }
62
 
63
 
64
  public function getTwitterDetails()
65
  {
66
+ $helper = Mage::helper('panalysis_tagmanager');
67
+ $twitterData = [];
68
+ $twitterData['store_username'] = $helper->getTwitterStoreUsername();
69
+ if($helper->getTwitterCreatorUsername() != "")
70
+ {
71
  $twitterData['creator_username'] = $helper->getTwitterCreatorUsername();
72
+ }
73
+ else
74
  {
75
  $twitterData['creator_username'] = $twitterData['store_username'];
76
+ }
77
+
78
+ if($helper->useTwitterLageImage()){
79
+ $twitterData['card_format'] = 'summary_large_image';
80
+ }else{
81
+ $twitterData['card_format'] = 'summary';
82
+ }
83
+
84
+ if($this->getPage() == "Product Detail"){
85
  $twitterData['image'] = Mage::registry('product')->getImageUrl();
86
+ }
87
+ else{
88
  $twitterData['image'] = $helper->getTwitterImage();
89
+ }
90
+
91
+ return $twitterData;
92
  }
93
 
94
  public function getPage()
124
  ) {
125
  $page = 'Product Category';
126
  }
127
+ if (Mage::app()->getRequest()->getActionName() == 'noRoute'){
128
+ $page = '404';
129
+ }
130
 
131
  Mage::log("Panalysis - " . $page, null, 'events.log', true);
132
  return $page;
134
 
135
  public function getProductDetails()
136
  {
137
+ $helper = Mage::helper('panalysis_tagmanager');
138
  $_product = Mage::registry('current_product');
139
  $tm = Mage::getModel('panalysis_tagmanager/tagmanager');
140
  $products = array();
141
+ $productType = $_product->getTypeId();
142
+ if ($productType === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE)
 
 
 
 
 
 
 
 
 
 
143
  {
144
+ $associated_ids = $helper->getBundleProducts($_product->getId());
145
+ foreach($associated_ids as $child)
146
+ {
147
+ $products[] = $helper->CreateProductArray($child);
148
+ }
149
+ } elseif($productType === Mage_Catalog_Model_Product_Type::TYPE_GROUPED) {
150
+ $associatedProducts = $_product->getTypeInstance(true)->getAssociatedProducts($_product);
151
+ $i = 0;
152
+ foreach($associatedProducts as $option)
153
+ {
154
+ $products[$i] = $helper->CreateProductArray($option->getId(), $option->getQty());
155
+ $products[$i]['id'] = $option->getSku();
156
+ $products[$i]['name'] = $option->getName();
157
+ ++$i;
158
+ }
159
 
160
+ } else {
161
+ $products[] = $helper->CreateProductArray($_product->getId());
162
  }
163
 
164
  return $products;
166
 
167
  public function getOrderData()
168
  {
169
+
170
  $tm = Mage::getModel('panalysis_tagmanager/tagmanager');
171
+ $helper = Mage::helper('panalysis_tagmanager');
172
  $order = Mage::getSingleton('sales/order');
173
  $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
174
  $storeName = Mage::app()->getStore()->getName();
177
  try {
178
  if ($order->getId()) {
179
 
180
+ $products = array();
181
+
182
+ // convert the amounts to the correct currency based on the user's selected currency
183
+ $revenue = Mage::helper('core')->currency($order->getBaseGrandTotal(), false, false);
184
+ $tax = Mage::helper('core')->currency($order->getBaseTaxAmount(), false, false);
185
+ $shipping = Mage::helper('core')->currency($order->getBaseShippingAmount(), false, false);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
 
187
+ $data = array(
188
+ 'actionField' => array(
189
+ 'id' => $order->getIncrementId(),
190
+ 'affiliation' => $storeName,
191
+ 'revenue' => (float) $revenue,
192
+ 'tax' => (float) $tax,
193
+ 'shipping' => (float) $shipping,
194
+ 'coupon' => ($order->getCouponCode() ? $order->getCouponCode() : ''),
195
+ ),
196
+ 'products' => array()
197
+ );
198
+
199
+ foreach ($order->getAllItems() as $item)
200
  {
201
+
202
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
203
+ $product_type = $product->getTypeId();
204
+
205
+ if ($product_type === Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE)
206
+ $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $item->getSku());
207
+
208
+ if ($product_type === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) continue;
209
+
210
+ if (empty($products[$item->getSku()])) {
211
+ $products[$item->getSku()] = $helper->CreateProductArray($product->getId(), $item->getQtyOrdered(), true);
212
+ }elseif((int)$item->getPrice()) {
213
+ $products[$item->getSku()]['quantity'] += (int)$item->getQtyOrdered();
214
+ }
215
+
216
+ }
217
+
218
+ foreach ($products as $product)
219
+ {
220
+ $data['transactionProducts'][] = $product;
221
+ }
222
  }
223
  } catch (exception $e) {
224
  Mage::logException($e);
225
+ }
226
+
227
  return $data;
228
 
229
  }
234
  }
235
 
236
  public function buildRemoveFromCartData($prods){
237
+ $data = array(
238
  'event' => 'removeFromCart',
239
  'ecommerce' => array(
240
  'remove' => array(
241
+ 'products' => array_values($prods)
242
  )
243
  )
244
  );
284
  }
285
 
286
  public function getCheckoutState(){
287
+ $tm = Mage::getSingleton('panalysis_tagmanager/tagmanager');
288
+ return $tm->getCheckoutState();
289
  }
290
 
291
  public function getCategoryProducts(){
292
+ $tm = Mage::getSingleton('panalysis_tagmanager/tagmanager');
293
+ return $tm->getCategoryProducts();
294
  }
295
 
296
  public function getVisitorData(){
297
+ $tm = Mage::getModel('panalysis_tagmanager/tagmanager');
298
+ return $tm->getVisitorData();
299
  }
300
  }
app/code/community/Panalysis/TagManager/Helper/Data.php CHANGED
@@ -17,23 +17,23 @@ class Panalysis_TagManager_Helper_Data extends Mage_Core_Helper_Abstract
17
  const GTM_BRAND_CODE = 'panalysis_tagmanager/gtm/brandcode';
18
  const GTM_COLOR_CODE = 'panalysis_tagmanager/gtm/colorcode';
19
  const AJAX_ENABLED = 'panalysis_tagmanager/gtm/enable_ajax';
20
-
21
  private $store_id = 0;
22
-
23
  function __construct() {
24
  $this->store_id = Mage::app()->getStore()->getStoreId();
25
  }
26
-
27
  public function getExtensionVersion()
28
  {
29
- return (string) Mage::getConfig()->getNode()->modules->Panalysis_TagManager->version;
30
  }
31
-
32
  public function getContainerId()
33
  {
34
  return Mage::getStoreConfig(self::GTM_CONTAINER_ID, $this->store_id);
35
  }
36
-
37
  public function getTrackProductList()
38
  {
39
  return Mage::getStoreConfig(self::GTM_TRACK_PRODUCT_LISTS, $this->store_id);
@@ -41,76 +41,76 @@ class Panalysis_TagManager_Helper_Data extends Mage_Core_Helper_Abstract
41
 
42
  public function useOpenGraph()
43
  {
44
- return Mage::getStoreConfig(self::OG_IS_ENABLED, $this->store_id);
45
  }
46
-
47
  public function getFacebookAppId()
48
  {
49
- return Mage::getStoreConfig(self::FB_APP_ID, $this->store_id);
50
  }
51
-
52
  public function getFacebookAdminId()
53
  {
54
- return Mage::getStoreConfig(self::FB_ADMIN_ID, $this->store_id);
55
  }
56
-
57
  public function getPinterestId()
58
  {
59
- return Mage::getStoreConfig(self::PINTEREST_ID, $this->store_id);
60
  }
61
 
62
  public function useTwitterCards()
63
  {
64
- return Mage::getStoreConfig(self::TWITTER_ENABLED, $this->store_id);
65
  }
66
-
67
  public function useTwitterLageImage()
68
  {
69
- return Mage::getStoreConfig(self::TWITTER_USELARGEIMAGE, $this->store_id);
70
  }
71
-
72
  public function getTwitterStoreUsername()
73
  {
74
- return Mage::getStoreConfig(self::TWITTER_STORE_USERNAME, $this->store_id);
75
  }
76
-
77
  public function getTwitterCreatorUsername()
78
  {
79
- return Mage::getStoreConfig(self::TWITTER_CREATOR_USERNAME, $this->store_id);
80
  }
81
-
82
  public function getTwitterImage()
83
  {
84
- return Mage::getStoreConfig(self::TWITTER_IMAGE, $this->store_id);
85
  }
86
-
87
  public function getListMaxProducts()
88
  {
89
- return (int)Mage::getStoreConfig(self::GTM_MAX_PRODUCTS_IN_LISTS, $this->store_id);
90
  }
91
-
92
  public function getBrandCode()
93
  {
94
- return Mage::getStoreConfig(self::GTM_BRAND_CODE, $this->store_id);
95
  }
96
 
97
  public function getColorCode()
98
  {
99
- return Mage::getStoreConfig(self::GTM_COLOR_CODE, $this->store_id);
100
  }
101
-
102
  public function CreateProductArray($product_id, $qty = 1, $full_category = false)
103
  {
104
  $product = Mage::getModel('catalog/product')->load($product_id);
105
- if($product)
106
- {
107
  $tm = Mage::getSingleton('panalysis_tagmanager/tagmanager');
108
  $final_price = $tm->getPrice($product->getId());
109
-
110
  $product_array = array(
111
- 'name' => $product->getName(),
112
- 'id' => $product->getSku(),
113
- 'price' => $final_price,
114
  );
115
 
116
  if($brand = $tm->getBrand($product)) $product_array['brand'] = $brand;
@@ -119,12 +119,12 @@ class Panalysis_TagManager_Helper_Data extends Mage_Core_Helper_Abstract
119
  if($full_category) $product_array['category'] = $tm->getCatArray($product);
120
  elseif($current_category = Mage::registry('current_category')) $product_array['category'] = $current_category->getName();
121
  else $product_array['category'] = $tm->getCategory($product);
122
-
123
  if($qty !== false && (int)$qty) $product_array['quantity'] = (int)$qty;
124
-
125
  return $product_array;
126
-
127
- }else return array();
128
  }
129
 
130
  //get products just once
@@ -153,94 +153,97 @@ class Panalysis_TagManager_Helper_Data extends Mage_Core_Helper_Abstract
153
  }
154
 
155
  public function buildProductDetailsData($products){
156
- $data = array(
157
  'ecommerce' => array(
158
  'currencyCode' => Mage::app()->getStore()->getCurrentCurrencyCode(),
159
- 'detail' => array(
160
- 'products' => $products
161
- )
162
  )
163
- );
164
- return $data;
165
  }
166
 
167
  public function buildOrderData($order){
168
- $data = array(
169
  'ecommerce' => array(
 
170
  'purchase' => array(
171
  'actionField' => $order['actionField'],
172
  'products' => $order['transactionProducts']
173
- )
174
  )
175
- );
176
-
177
- return $data;
 
178
 
179
  }
180
 
181
  public function buildCategoryData($prodlist){
182
- $data = array();
183
- if(count($prodlist)>0){
184
-
185
  $data = array(
 
186
  'ecommerce' => array(
187
  'currencyCode' => Mage::app()->getStore()->getCurrentCurrencyCode(),
188
  'impressions' => $prodlist
189
  )
190
  );
191
- }
192
-
193
- return $data;
194
  }
195
 
196
  public function buildCheckoutData($products){
197
- if(empty($products)) return array();
198
- $data = array(
199
  'event' => 'checkout',
200
  'ecommerce' => array(
201
  'currencyCode' => Mage::app()->getStore()->getCurrentCurrencyCode(),
202
- 'checkout' => array(
203
- 'actionField' => array(
204
- 'step' =>'checkout',
205
- 'option' => 'review cart'
206
- ),
207
- 'products' => $products
208
- )
209
- )
210
- );
211
 
212
- return $data;
213
  }
214
 
215
  public function buildOnePageCartCheckoutData($products){
216
- $data = array(
217
  'event' => 'checkout',
218
  'ecommerce' => array(
219
- 'checkout' => array(
 
220
  'actionField' => array(
221
- 'step' =>'checkout',
222
- 'option' => 'start checkout'
223
  ),
224
  'products' => $products
225
- )
226
  )
227
- );
228
 
229
- return $data;
230
  }
231
 
232
  public function buildAddToCartData($prods)
233
  {
234
- $data = array(
235
  'event' => 'addToCart',
236
  'ecommerce' => array(
237
  'currencyCode' => Mage::app()->getStore()->getCurrentCurrencyCode(),
238
- 'add' => array(
239
- 'products' => $prods
240
- )
241
  )
242
- );
243
-
244
  return $data;
245
  }
246
 
17
  const GTM_BRAND_CODE = 'panalysis_tagmanager/gtm/brandcode';
18
  const GTM_COLOR_CODE = 'panalysis_tagmanager/gtm/colorcode';
19
  const AJAX_ENABLED = 'panalysis_tagmanager/gtm/enable_ajax';
20
+
21
  private $store_id = 0;
22
+
23
  function __construct() {
24
  $this->store_id = Mage::app()->getStore()->getStoreId();
25
  }
26
+
27
  public function getExtensionVersion()
28
  {
29
+ return (string) Mage::getConfig()->getNode()->modules->Panalysis_TagManager->version;
30
  }
31
+
32
  public function getContainerId()
33
  {
34
  return Mage::getStoreConfig(self::GTM_CONTAINER_ID, $this->store_id);
35
  }
36
+
37
  public function getTrackProductList()
38
  {
39
  return Mage::getStoreConfig(self::GTM_TRACK_PRODUCT_LISTS, $this->store_id);
41
 
42
  public function useOpenGraph()
43
  {
44
+ return Mage::getStoreConfig(self::OG_IS_ENABLED, $this->store_id);
45
  }
46
+
47
  public function getFacebookAppId()
48
  {
49
+ return Mage::getStoreConfig(self::FB_APP_ID, $this->store_id);
50
  }
51
+
52
  public function getFacebookAdminId()
53
  {
54
+ return Mage::getStoreConfig(self::FB_ADMIN_ID, $this->store_id);
55
  }
56
+
57
  public function getPinterestId()
58
  {
59
+ return Mage::getStoreConfig(self::PINTEREST_ID, $this->store_id);
60
  }
61
 
62
  public function useTwitterCards()
63
  {
64
+ return Mage::getStoreConfig(self::TWITTER_ENABLED, $this->store_id);
65
  }
66
+
67
  public function useTwitterLageImage()
68
  {
69
+ return Mage::getStoreConfig(self::TWITTER_USELARGEIMAGE, $this->store_id);
70
  }
71
+
72
  public function getTwitterStoreUsername()
73
  {
74
+ return Mage::getStoreConfig(self::TWITTER_STORE_USERNAME, $this->store_id);
75
  }
76
+
77
  public function getTwitterCreatorUsername()
78
  {
79
+ return Mage::getStoreConfig(self::TWITTER_CREATOR_USERNAME, $this->store_id);
80
  }
81
+
82
  public function getTwitterImage()
83
  {
84
+ return Mage::getStoreConfig(self::TWITTER_IMAGE, $this->store_id);
85
  }
86
+
87
  public function getListMaxProducts()
88
  {
89
+ return (int)Mage::getStoreConfig(self::GTM_MAX_PRODUCTS_IN_LISTS, $this->store_id);
90
  }
91
+
92
  public function getBrandCode()
93
  {
94
+ return Mage::getStoreConfig(self::GTM_BRAND_CODE, $this->store_id);
95
  }
96
 
97
  public function getColorCode()
98
  {
99
+ return Mage::getStoreConfig(self::GTM_COLOR_CODE, $this->store_id);
100
  }
101
+
102
  public function CreateProductArray($product_id, $qty = 1, $full_category = false)
103
  {
104
  $product = Mage::getModel('catalog/product')->load($product_id);
105
+ if($product)
106
+ {
107
  $tm = Mage::getSingleton('panalysis_tagmanager/tagmanager');
108
  $final_price = $tm->getPrice($product->getId());
109
+
110
  $product_array = array(
111
+ 'name' => $product->getName(),
112
+ 'id' => $product->getSku(),
113
+ 'price' => $final_price,
114
  );
115
 
116
  if($brand = $tm->getBrand($product)) $product_array['brand'] = $brand;
119
  if($full_category) $product_array['category'] = $tm->getCatArray($product);
120
  elseif($current_category = Mage::registry('current_category')) $product_array['category'] = $current_category->getName();
121
  else $product_array['category'] = $tm->getCategory($product);
122
+
123
  if($qty !== false && (int)$qty) $product_array['quantity'] = (int)$qty;
124
+
125
  return $product_array;
126
+
127
+ } else return array();
128
  }
129
 
130
  //get products just once
153
  }
154
 
155
  public function buildProductDetailsData($products){
156
+ $data = array(
157
  'ecommerce' => array(
158
  'currencyCode' => Mage::app()->getStore()->getCurrentCurrencyCode(),
159
+ 'detail' => array(
160
+ 'products' => $products
161
+ )
162
  )
163
+ );
164
+ return $data;
165
  }
166
 
167
  public function buildOrderData($order){
168
+ $data = array(
169
  'ecommerce' => array(
170
+ 'currencyCode' => Mage::app()->getStore()->getCurrentCurrencyCode(),
171
  'purchase' => array(
172
  'actionField' => $order['actionField'],
173
  'products' => $order['transactionProducts']
 
174
  )
175
+ )
176
+ );
177
+
178
+ return $data;
179
 
180
  }
181
 
182
  public function buildCategoryData($prodlist){
183
+ $data = array();
184
+ if(count($prodlist)>0){
185
+
186
  $data = array(
187
+ 'event' => 'productlist',
188
  'ecommerce' => array(
189
  'currencyCode' => Mage::app()->getStore()->getCurrentCurrencyCode(),
190
  'impressions' => $prodlist
191
  )
192
  );
193
+ }
194
+
195
+ return $data;
196
  }
197
 
198
  public function buildCheckoutData($products){
199
+ if(empty($products)) return array();
200
+ $data = array(
201
  'event' => 'checkout',
202
  'ecommerce' => array(
203
  'currencyCode' => Mage::app()->getStore()->getCurrentCurrencyCode(),
204
+ 'checkout' => array(
205
+ 'actionField' => array(
206
+ 'step' =>'1',
207
+ 'option' => 'review cart'
208
+ ),
209
+ 'products' => $products
210
+ )
211
+ )
212
+ );
213
 
214
+ return $data;
215
  }
216
 
217
  public function buildOnePageCartCheckoutData($products){
218
+ $data = array(
219
  'event' => 'checkout',
220
  'ecommerce' => array(
221
+ 'currencyCode' => Mage::app()->getStore()->getCurrentCurrencyCode(),
222
+ 'checkout' => array(
223
  'actionField' => array(
224
+ 'step' =>'1',
225
+ 'option' => 'start checkout'
226
  ),
227
  'products' => $products
228
+ )
229
  )
230
+ );
231
 
232
+ return $data;
233
  }
234
 
235
  public function buildAddToCartData($prods)
236
  {
237
+ $data = array(
238
  'event' => 'addToCart',
239
  'ecommerce' => array(
240
  'currencyCode' => Mage::app()->getStore()->getCurrentCurrencyCode(),
241
+ 'add' => array(
242
+ 'products' => array_values($prods)
243
+ )
244
  )
245
+ );
246
+
247
  return $data;
248
  }
249
 
app/code/community/Panalysis/TagManager/Model/.DS_Store DELETED
Binary file
app/code/community/Panalysis/TagManager/Model/Config/.DS_Store DELETED
Binary file
app/code/community/Panalysis/TagManager/Model/Observer.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  class Panalysis_TagManager_Model_Observer
4
- {
5
  public function getLayout()
6
  {
7
  return Mage::getSingleton('core/layout');
@@ -9,7 +9,7 @@ class Panalysis_TagManager_Model_Observer
9
 
10
  public function checkoutCartAddProductComplete($observer)
11
  {
12
- $helper = Mage::helper('panalysis_tagmanager');
13
  try {
14
  $product = $observer->getProduct();
15
  $params = $observer->getRequest()->getParams();
@@ -27,28 +27,28 @@ class Panalysis_TagManager_Model_Observer
27
  $type = $product->getTypeID();
28
 
29
  if ($type === Mage_Catalog_Model_Product_Type::TYPE_GROUPED) {
30
- $associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product);
31
- foreach($associatedProducts as $ip)
32
- {
33
  $my_qty = $params['super_group'][$ip->getId()];
34
  if($my_qty > 0){
35
  $tmProduct[] = $helper->CreateProductArray($ip->getId(), $my_qty);
36
  }
37
- }
38
 
39
  } elseif ($type === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
40
- $optionCollection = $product->getTypeInstance()->getOptionsCollection();
41
- $selectionCollection =$product->getTypeInstance()->getSelectionsCollection($product->getTypeInstance()->getOptionsIds());
42
- $options = $optionCollection->appendSelections($selectionCollection);
43
- foreach( $options as $option )
44
- {
45
- $_selections = $option->getSelections();
46
-
47
- foreach( $_selections as $selection )
48
- {
49
- $tmProduct[] = $helper->CreateProductArray($selection->getId(), $qty);
50
- }
51
- }
52
  } elseif($type === Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE){
53
  $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $product->getSku());
54
  $tmProduct[] = $helper->CreateProductArray($product->getId(), $qty);
@@ -88,7 +88,7 @@ class Panalysis_TagManager_Model_Observer
88
  $product = Mage::getModel('catalog/product')->load($item->getProductId());
89
  if($product->getTypeId() === Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE ||
90
  $product->getTypeId() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE)
91
- continue;
92
 
93
  if($item->getParentItemId())
94
  {
@@ -121,8 +121,8 @@ class Panalysis_TagManager_Model_Observer
121
  $addProduct = array();
122
  $tm = Mage::getSingleton('panalysis_tagmanager/tagmanager');
123
  $current_updated = Mage::getSingleton('core/session')->getTmProduct();
124
- if($current_updated) $addProduct[] = $current_updated;
125
- $addProduct[] = $helper->CreateProductArray($product_id, $qty);
126
  $session = Mage::getSingleton('core/session');
127
  $session->setTmProduct($addProduct);
128
  } catch (exception $e) {
@@ -137,8 +137,8 @@ class Panalysis_TagManager_Model_Observer
137
  $rmProduct = array();
138
  $tm = Mage::getSingleton('panalysis_tagmanager/tagmanager');
139
  $current_updated = Mage::getSingleton('core/session')->getRmProducts();
140
- if($current_updated) $rmProduct[] = $current_updated;
141
- $rmProduct[] = $helper->CreateProductArray($product_id, $qty);
142
  $session = Mage::getSingleton('core/session');
143
  $session->setRmProducts($rmProduct);
144
  } catch (exception $e) {
@@ -155,7 +155,8 @@ class Panalysis_TagManager_Model_Observer
155
  {
156
  $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $item->getSku());
157
  return $this->removeItemFromCart($product->getId(), $item->getQty());
158
- }elseif($product->getTypeId() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE)
 
159
  {
160
  $qty = $item->getQty();
161
  $quote_id = $observer->getQuoteItem()->getData('quote_id');
@@ -174,12 +175,13 @@ class Panalysis_TagManager_Model_Observer
174
  }
175
 
176
  return true;
177
- }else return $this->removeItemFromCart($product->getId(), $item->getQty());
 
178
  }
179
 
180
  public function checkoutCartEmpty()
181
  {
182
- $helper = Mage::helper('panalysis_tagmanager');
183
  $post = Mage::app()->getRequest()->getPost('update_cart_action');
184
  if ($post == 'empty_cart') {
185
  $rmProducts = array();
@@ -203,28 +205,64 @@ class Panalysis_TagManager_Model_Observer
203
  }
204
 
205
  public function categoryView(Varien_Event_Observer $observer)
206
- {
207
  $helper = Mage::helper('panalysis_tagmanager');
 
 
 
 
 
208
  $catProducts = array();
209
- $_products = $observer->getEvent()->getCollection()->load();
210
-
 
 
 
 
 
 
 
 
 
 
 
 
211
  $limit = $helper->getListMaxProducts();
212
 
213
- if(Mage::app()->getRequest()->getModuleName() == 'catalogsearch') $view = 'Search Results';
214
- else $view = 'category';
 
 
 
 
215
 
216
  $i = 0;
217
  foreach ($_products as $_product)
218
- {
219
  if($i >= $limit) break;
220
-
221
- $prod = $helper->CreateProductArray($_product->getId());
 
 
 
 
 
222
  $prod['list'] = $view;
223
  $prod['position'] = ++$i;
 
 
 
 
 
 
 
 
 
 
224
  $catProducts[] = $prod;
225
  }
226
-
227
- $dataLayer = $helper->buildCategoryData($catProducts);
228
  $dataLayerJs = "<script type='text/javascript'>var dataLayer = dataLayer || []; dataLayer.push(" . json_encode($dataLayer,JSON_PRETTY_PRINT) .");</script>";
229
 
230
  echo $dataLayerJs;
@@ -236,6 +274,6 @@ class Panalysis_TagManager_Model_Observer
236
  $myDataLayer = Mage::app()->getLayout()->createBlock('panalysis_tagmanager/tagmanager');
237
  $tm = Mage::getSingleton('panalysis_tagmanager/tagmanager');
238
  $tm->setCheckoutState("start");
239
- Mage::dispatchEvent('panalysis_start_checkout');
240
  }
241
  }
1
  <?php
2
 
3
  class Panalysis_TagManager_Model_Observer
4
+ {
5
  public function getLayout()
6
  {
7
  return Mage::getSingleton('core/layout');
9
 
10
  public function checkoutCartAddProductComplete($observer)
11
  {
12
+ $helper = Mage::helper('panalysis_tagmanager');
13
  try {
14
  $product = $observer->getProduct();
15
  $params = $observer->getRequest()->getParams();
27
  $type = $product->getTypeID();
28
 
29
  if ($type === Mage_Catalog_Model_Product_Type::TYPE_GROUPED) {
30
+ $associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product);
31
+ foreach($associatedProducts as $ip)
32
+ {
33
  $my_qty = $params['super_group'][$ip->getId()];
34
  if($my_qty > 0){
35
  $tmProduct[] = $helper->CreateProductArray($ip->getId(), $my_qty);
36
  }
37
+ }
38
 
39
  } elseif ($type === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
40
+ $optionCollection = $product->getTypeInstance()->getOptionsCollection();
41
+ $selectionCollection =$product->getTypeInstance()->getSelectionsCollection($product->getTypeInstance()->getOptionsIds());
42
+ $options = $optionCollection->appendSelections($selectionCollection);
43
+ foreach( $options as $option )
44
+ {
45
+ $_selections = $option->getSelections();
46
+
47
+ foreach( $_selections as $selection )
48
+ {
49
+ $tmProduct[] = $helper->CreateProductArray($selection->getId(), $qty);
50
+ }
51
+ }
52
  } elseif($type === Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE){
53
  $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $product->getSku());
54
  $tmProduct[] = $helper->CreateProductArray($product->getId(), $qty);
88
  $product = Mage::getModel('catalog/product')->load($item->getProductId());
89
  if($product->getTypeId() === Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE ||
90
  $product->getTypeId() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE)
91
+ continue;
92
 
93
  if($item->getParentItemId())
94
  {
121
  $addProduct = array();
122
  $tm = Mage::getSingleton('panalysis_tagmanager/tagmanager');
123
  $current_updated = Mage::getSingleton('core/session')->getTmProduct();
124
+ if($current_updated) $addProduct = $current_updated;
125
+ $addProduct[$product_id] = $helper->CreateProductArray($product_id, $qty);
126
  $session = Mage::getSingleton('core/session');
127
  $session->setTmProduct($addProduct);
128
  } catch (exception $e) {
137
  $rmProduct = array();
138
  $tm = Mage::getSingleton('panalysis_tagmanager/tagmanager');
139
  $current_updated = Mage::getSingleton('core/session')->getRmProducts();
140
+ if($current_updated) $rmProduct = $current_updated;
141
+ $rmProduct[$product_id] = $helper->CreateProductArray($product_id, $qty);;
142
  $session = Mage::getSingleton('core/session');
143
  $session->setRmProducts($rmProduct);
144
  } catch (exception $e) {
155
  {
156
  $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $item->getSku());
157
  return $this->removeItemFromCart($product->getId(), $item->getQty());
158
+ }
159
+ elseif($product->getTypeId() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE)
160
  {
161
  $qty = $item->getQty();
162
  $quote_id = $observer->getQuoteItem()->getData('quote_id');
175
  }
176
 
177
  return true;
178
+ }
179
+ else return $this->removeItemFromCart($product->getId(), $item->getQty());
180
  }
181
 
182
  public function checkoutCartEmpty()
183
  {
184
+ $helper = Mage::helper('panalysis_tagmanager');
185
  $post = Mage::app()->getRequest()->getPost('update_cart_action');
186
  if ($post == 'empty_cart') {
187
  $rmProducts = array();
205
  }
206
 
207
  public function categoryView(Varien_Event_Observer $observer)
208
+ {
209
  $helper = Mage::helper('panalysis_tagmanager');
210
+ if(! $helper->getTrackProductList())
211
+ return;
212
+
213
+ $tm = Mage::getSingleton('panalysis_tagmanager/tagmanager');
214
+
215
  $catProducts = array();
216
+ $catName = Mage::getSingleton('catalog/layer')->getCurrentCategory()->getName();
217
+
218
+ $_collection = $observer->getEvent()->getCollection();
219
+
220
+ $colorAttr = 'color';
221
+ $brandAttr = 'manufacturer';
222
+
223
+ if($helper->getBrandCode() != "")
224
+ $brandAttr = $helper->getBrandCode();
225
+ if($helper->getColorCode() != "")
226
+ $colorAttr = $helper->getColorCode();
227
+
228
+ $_collection->addAttributeToSelect($colorAttr)->addAttributeToSelect($brandAttr);
229
+ $_products = $_collection->load();
230
  $limit = $helper->getListMaxProducts();
231
 
232
+ if(Mage::app()->getRequest()->getModuleName() == 'catalogsearch'){
233
+ $view = 'Search Results';
234
+ $catName = "Search Results";
235
+ }
236
+ elseif($catName != "") $view = $catName . " Category Listing";
237
+ else $view = 'Category Listing';
238
 
239
  $i = 0;
240
  foreach ($_products as $_product)
241
+ {
242
  if($i >= $limit) break;
243
+
244
+ $brand = $tm->getBrand($_product);
245
+ $variant = $tm->getVariant($_product);
246
+
247
+ $prod = [];
248
+ $prod['name'] = $_product->getName();
249
+ $prod['id'] = $_product->getSku();
250
  $prod['list'] = $view;
251
  $prod['position'] = ++$i;
252
+ $prod['category'] = $catName;
253
+
254
+ if($_product->getPrice() > 0 )
255
+ $prod['price'] = Mage::helper('core')->currency($_product->getPrice(), false, false);
256
+ elseif($_product->getMinPrice() > 0)
257
+ $prod['price'] = Mage::helper('core')->currency($_product->getMinPrice(), false, false);
258
+
259
+ if($variant) $prod['variant'] = $variant;
260
+ if($brand) $prod['brand'] = $brand;
261
+
262
  $catProducts[] = $prod;
263
  }
264
+
265
+ $dataLayer = $helper->buildCategoryData($catProducts);
266
  $dataLayerJs = "<script type='text/javascript'>var dataLayer = dataLayer || []; dataLayer.push(" . json_encode($dataLayer,JSON_PRETTY_PRINT) .");</script>";
267
 
268
  echo $dataLayerJs;
274
  $myDataLayer = Mage::app()->getLayout()->createBlock('panalysis_tagmanager/tagmanager');
275
  $tm = Mage::getSingleton('panalysis_tagmanager/tagmanager');
276
  $tm->setCheckoutState("start");
277
+ Mage::dispatchEvent('panalysis_start_checkout');
278
  }
279
  }
app/code/community/Panalysis/TagManager/Model/Tagmanager.php CHANGED
@@ -48,8 +48,9 @@ class Panalysis_TagManager_Model_Tagmanager extends Mage_Core_Model_Abstract
48
 
49
  public function getBrand($product)
50
  {
 
51
  $brand = '';
52
- $product = Mage::getModel('catalog/product')->load($product->getID());
53
  $brandAttr = Mage::helper('panalysis_tagmanager')->getBrandCode();
54
  $attributes = $this->getAttributes($product);
55
 
@@ -66,12 +67,12 @@ class Panalysis_TagManager_Model_Tagmanager extends Mage_Core_Model_Abstract
66
  public function getVariant($product)
67
  {
68
  $color = '';
69
- $product = Mage::getModel('catalog/product')->load($product->getID());
70
  $colorAttr = Mage::helper('panalysis_tagmanager')->getColorCode();
71
  $attributes = $this->getAttributes($product);
72
-
73
  if (in_array($colorAttr, $attributes)) {
74
- $color = @$product->getAttributeText($colorAttr);
75
  } else {
76
  if (in_array('color', $attributes)) {
77
  $color = @$product->getAttributeText('color');
@@ -97,53 +98,40 @@ class Panalysis_TagManager_Model_Tagmanager extends Mage_Core_Model_Abstract
97
 
98
  public function getCatArray($product)
99
  {
100
- $cateNames = array();
101
- $product = Mage::getModel('catalog/product')->load($product->getId());
102
- $categoryCollection = $product->getCategoryCollection()->addAttributeToSelect('name');
103
-
104
- foreach($categoryCollection as $category)
105
- {
106
  $cateNames[] = $category->getName();
107
  }
108
-
109
- return $cateNames;
110
  }
111
 
112
  public function setCheckoutState($state){
113
- $this->state = $state;
114
  }
115
-
116
  public function getCheckoutState(){
117
- return $this->state;
118
  }
119
-
120
  public function setCategoryProducts($list){
121
- $this->categoryProducts = $list;
122
  }
123
-
124
  public function getCategoryProducts() {
125
- return $this->categoryProducts;
126
  }
127
-
128
  // the following function is modified from https://github.com/CVM/Magento_GoogleTagManager
129
 
130
  public function getVisitorData()
131
  {
132
- $data = array();
133
- $customer = Mage::getSingleton('customer/session');
134
-
135
- // visitorId
136
- if ($customer->getCustomerId()) $data['visitorId'] = (string)$customer->getCustomerId();
137
-
138
- // visitorLoginState
139
- $data['visitorLoginState'] = ($customer->isLoggedIn()) ? 'Logged in' : 'Logged out';
140
-
141
- // visitorType
142
- $data['visitorType'] = (string)Mage::getModel('customer/group')->load($customer->getCustomerGroupId())->getCode();
143
-
144
- $data = $this->getVisitorOrderData($customer);
145
-
146
- return $data;
147
  }
148
 
149
  //check if user placed orders before and get total
@@ -153,10 +141,13 @@ class Panalysis_TagManager_Model_Tagmanager extends Mage_Core_Model_Abstract
153
  $orders = false;
154
 
155
  if(!$customer) $customer = Mage::getSingleton('customer/session');
 
 
156
 
157
  if(Mage::getSingleton('customer/session')->isLoggedIn())
158
  {
159
- $orders = Mage::getResourceModel('sales/order_collection')->addFieldToSelect('grand_total')->addFieldToFilter('customer_id',$customer->getId());
 
160
  $data['visitorExistingCustomer'] = 'Yes';
161
  }else{
162
 
@@ -176,16 +167,23 @@ class Panalysis_TagManager_Model_Tagmanager extends Mage_Core_Model_Abstract
176
  }
177
 
178
  $ordersTotal = 0;
 
 
179
  if($orders)
180
  {
181
  foreach ($orders as $order)
182
  {
183
- $ordersTotal += $order->getGrandTotal();
 
184
  }
185
  }
186
 
187
- $data['visitorLifetimeValue'] = $this->convertCurrency($ordersTotal);
188
-
 
 
 
 
189
  return $data;
190
  }
191
 
48
 
49
  public function getBrand($product)
50
  {
51
+
52
  $brand = '';
53
+ //$product = Mage::getModel('catalog/product')->load($product->getID());
54
  $brandAttr = Mage::helper('panalysis_tagmanager')->getBrandCode();
55
  $attributes = $this->getAttributes($product);
56
 
67
  public function getVariant($product)
68
  {
69
  $color = '';
70
+ //$product = Mage::getModel('catalog/product')->load($product->getID());
71
  $colorAttr = Mage::helper('panalysis_tagmanager')->getColorCode();
72
  $attributes = $this->getAttributes($product);
73
+
74
  if (in_array($colorAttr, $attributes)) {
75
+ $color = @$product->getAttributeText($colorAttr);
76
  } else {
77
  if (in_array('color', $attributes)) {
78
  $color = @$product->getAttributeText('color');
98
 
99
  public function getCatArray($product)
100
  {
101
+ $cateNames = array();
102
+ $product = Mage::getModel('catalog/product')->load($product->getId());
103
+ $categoryCollection = $product->getCategoryCollection()->addAttributeToSelect('name');
104
+
105
+ foreach($categoryCollection as $category)
106
+ {
107
  $cateNames[] = $category->getName();
108
  }
109
+
110
+ return $cateNames;
111
  }
112
 
113
  public function setCheckoutState($state){
114
+ $this->state = $state;
115
  }
116
+
117
  public function getCheckoutState(){
118
+ return $this->state;
119
  }
120
+
121
  public function setCategoryProducts($list){
122
+ $this->categoryProducts = $list;
123
  }
124
+
125
  public function getCategoryProducts() {
126
+ return $this->categoryProducts;
127
  }
128
+
129
  // the following function is modified from https://github.com/CVM/Magento_GoogleTagManager
130
 
131
  public function getVisitorData()
132
  {
133
+ $customer = Mage::getSingleton('customer/session');
134
+ return $this->getVisitorOrderData($customer);
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  }
136
 
137
  //check if user placed orders before and get total
141
  $orders = false;
142
 
143
  if(!$customer) $customer = Mage::getSingleton('customer/session');
144
+ $customerId = $customer->getCustomerId();
145
+ if ($customerId > 0) $data['customerId'] = (string) $customerId;
146
 
147
  if(Mage::getSingleton('customer/session')->isLoggedIn())
148
  {
149
+ $orders = Mage::getResourceModel('sales/order_collection')->addFieldToSelect('grand_total')->addAttributeToSelect('created_at')->addFieldToFilter('customer_id',$customer->getId());
150
+ $data['customerGroup'] = (string)Mage::getModel('customer/group')->load($customer->getCustomerGroupId())->getCode();
151
  $data['visitorExistingCustomer'] = 'Yes';
152
  }else{
153
 
167
  }
168
 
169
  $ordersTotal = 0;
170
+ $numOrders = 0;
171
+
172
  if($orders)
173
  {
174
  foreach ($orders as $order)
175
  {
176
+ $ordersTotal += floatval($order->getGrandTotal());
177
+ $numOrders ++;
178
  }
179
  }
180
 
181
+ if($customerId > 0) {
182
+ $data['visitorLifetimeValue'] = $this->convertCurrency($ordersTotal);
183
+ $data['visitorLifetimeOrders'] = $numOrders;
184
+ }
185
+
186
+
187
  return $data;
188
  }
189
 
app/code/community/Panalysis/TagManager/controllers/.DS_Store DELETED
Binary file
app/code/community/Panalysis/TagManager/controllers/AjaxController.php CHANGED
@@ -4,15 +4,15 @@ class Panalysis_Tagmanager_AjaxController extends Mage_Core_Controller_Front_Act
4
  {
5
  public function indexAction()
6
  {
7
- echo "Hi";
8
-
9
- //$this->loadLayout();
10
- //$this->renderLayout();
11
  }
12
-
13
  public function getCheckoutStateAction()
14
  {
15
- echo "start";
16
  }
17
 
18
  public function checkAjaxAction()
4
  {
5
  public function indexAction()
6
  {
7
+ //echo "Hi";
8
+
9
+ //$this->loadLayout();
10
+ //$this->renderLayout();
11
  }
12
+
13
  public function getCheckoutStateAction()
14
  {
15
+ //echo "start";
16
  }
17
 
18
  public function checkAjaxAction()
app/code/community/Panalysis/TagManager/etc/.DS_Store DELETED
Binary file
app/code/community/Panalysis/TagManager/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Panalysis_TagManager>
5
- <version>0.5.3</version>
6
  </Panalysis_TagManager>
7
  </modules>
8
  <default>
@@ -40,12 +40,12 @@
40
  </checkout_cart_add_product_complete>
41
 
42
  <checkout_cart_update_items_before>
43
- <observers>
44
- <panalysis_tagmanager>
45
- <class>panalysis_tagmanager/observer</class>
46
- <method>hookToUpdateToCart</method>
47
- </panalysis_tagmanager>
48
- </observers>
49
  </checkout_cart_update_items_before>
50
 
51
  <sales_quote_remove_item>
2
  <config>
3
  <modules>
4
  <Panalysis_TagManager>
5
+ <version>0.5.9</version>
6
  </Panalysis_TagManager>
7
  </modules>
8
  <default>
40
  </checkout_cart_add_product_complete>
41
 
42
  <checkout_cart_update_items_before>
43
+ <observers>
44
+ <panalysis_tagmanager>
45
+ <class>panalysis_tagmanager/observer</class>
46
+ <method>hookToUpdateToCart</method>
47
+ </panalysis_tagmanager>
48
+ </observers>
49
  </checkout_cart_update_items_before>
50
 
51
  <sales_quote_remove_item>
app/design/frontend/base/default/template/panalysis/.DS_Store DELETED
Binary file
app/design/frontend/base/default/template/panalysis/tagmanager/.DS_Store DELETED
Binary file
app/design/frontend/base/default/template/panalysis/tagmanager/datalayer.phtml CHANGED
@@ -5,6 +5,7 @@ $contId = $helper->getContainerId();
5
  $checkoutState = $this->getCheckoutState();
6
  if(isset($contId)):
7
  ?>
 
8
  <script type="text/javascript">
9
  var dataLayer = dataLayer || [];
10
  <?php echo $this->buildDataLayer();?>
@@ -31,5 +32,6 @@ if(isset($contId)):
31
  });
32
  <?php endif ?>
33
  </script>
 
34
  <?php endif; ?>
35
 
5
  $checkoutState = $this->getCheckoutState();
6
  if(isset($contId)):
7
  ?>
8
+
9
  <script type="text/javascript">
10
  var dataLayer = dataLayer || [];
11
  <?php echo $this->buildDataLayer();?>
32
  });
33
  <?php endif ?>
34
  </script>
35
+
36
  <?php endif; ?>
37
 
app/design/frontend/base/default/template/panalysis/tagmanager/opengraph.phtml CHANGED
@@ -1,84 +1,78 @@
1
  <?php
2
- $helper = Mage::helper('panalysis_tagmanager');
3
- $tm = Mage::getSingleton('panalysis_tagmanager/tagmanager');
4
-
 
5
  $storeId = Mage::app()->getStore()->getStoreId();
6
-
 
7
  $pgtm_og = [];
8
-
9
  $pgtm_og['page_type'] = $this->getPage();
10
-
11
  $pgtm_og['title'] = htmlspecialchars($this->getLayout()->getBlock('head')->getTitle(),ENT_QUOTES, null, false);
12
-
13
- $pgtm_og['fbappid'] = $helper->getFacebookAppId();
14
- $pgtm_og['fbadminid'] = $helper->getFacebookAdminId();
15
- $pgtm_og['pinterestid'] = $helper->getPinterestId();
16
-
17
- $pgtm_twitter = $this->getTwitterDetails();
18
-
19
- if($helper->useOpenGraph()):
20
- ?>
21
 
22
- <?php if( $pgtm_og['fbappid'] != ""): ?>
23
- <meta property="fb:app_id" content="<?php echo $pgtm_og['fbappid']; ?>" />
24
- <?php endif;?>
25
- <?php if( $pgtm_og['fbadminid'] != ""): ?>
26
- <meta property="fb:admins" content="<?php echo $pgtm_og['fbadminid']; ?>" />
27
- <?php endif;?>
28
- <?php if( $pgtm_og['pinterestid'] != ""): ?>
29
- <meta name="p:domain_verify" content="<?php echo $pgtm_og['pinterestid']; ?>"/>
30
- <?php endif;?>
31
 
 
 
32
 
33
- <?php if( $helper->useTwitterCards()): ?>
 
 
 
34
 
35
- <meta property="twitter:card" content="<?php echo $pgtm_twitter['card_format']; ?>" />
36
- <meta property="twitter:site" content="<?php echo $pgtm_twitter['store_username']; ?>" />
37
- <meta property="twitter:creator" content="<?php echo $pgtm_twitter['creator_username']; ?>" />
38
- <meta property="twitter:image" content="<?php echo $pgtm_twitter['image']; ?>" />
39
 
40
- <?php endif;?>
 
 
 
41
 
42
- <meta property="og:title" content="<?php echo $pgtm_og['title']; ?>" />
43
- <meta property="og:type" content="product" />
44
- <?php
45
- if($pgtm_og['page_type']=="Product Detail"):
46
- if(Mage::registry('current_product')):
47
- $pan_product_id = Mage::registry('current_product')->getId();
48
- $pan_product= Mage::getModel('catalog/product')->setStoreId($storeId)->load($pan_product_id);
49
- ?>
50
- <meta property="og:url" content="<?php echo $pan_product->getUrlInStore(array('_ignore_category' => true)); ?>"/>
51
- <meta property="og:description" content="<?php echo Mage::helper('core')->quoteEscape($pan_product->getDescription()) ?>"/>
52
- <?php
53
- if($pan_product->getTypeId() === Mage_Catalog_Model_Product_Type::TYPE_GROUPED)
54
  {
55
- foreach ($pan_product->getTypeInstance(true)->getAssociatedProducts($pan_product) as $assoProd)
56
- {
57
- echo('<meta property="product:price:amount" content="'.$tm->getPrice($assoProd->getId()).'"/>'."\n");
58
- }
59
- echo('<meta property="product:price:currency" content="' . Mage::app()->getStore()->getCurrentCurrencyCode() . '"/>'."\n");
60
- }elseif($pan_product->getTypeId() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE)
 
 
61
  {
62
- $associated_ids = $helper->getBundleProducts($pan_product_id);
63
- foreach($associated_ids as $child)
64
- {
65
- echo('<meta property="product:price:amount" content="'.$tm->getPrice($child).'"/>'."\n");
66
- }
67
- echo('<meta property="product:price:currency" content="' . Mage::app()->getStore()->getCurrentCurrencyCode() . '"/>'."\n");
68
- }else{
69
- echo('<meta property="product:price:amount" content="'.$tm->getPrice($pan_product_id).'"/>'."\n");
70
- echo('<meta property="product:price:currency" content="' . Mage::app()->getStore()->getCurrentCurrencyCode() . '"/>'."\n");
71
- }
72
- endif;
73
- endif;
74
-
75
- if($pgtm_og['page_type']=="Product Category"):
76
- ?>
77
- <meta property="og:type" content="product.group" />
78
- <meta property="og:url" content="<?php echo Mage::helper('core/url')->getCurrentUrl() ?>"/>
79
- <?php
80
- endif;
81
- endif
 
 
 
 
 
 
 
 
 
 
 
82
  ?>
83
 
84
 
1
  <?php
2
+ $helper = Mage::helper('panalysis_tagmanager');
3
+
4
+ if($helper->useOpenGraph()){
5
+ $tm = Mage::getSingleton('panalysis_tagmanager/tagmanager');
6
  $storeId = Mage::app()->getStore()->getStoreId();
7
+ $pgtm_twitter = $this->getTwitterDetails();
8
+
9
  $pgtm_og = [];
10
+
11
  $pgtm_og['page_type'] = $this->getPage();
 
12
  $pgtm_og['title'] = htmlspecialchars($this->getLayout()->getBlock('head')->getTitle(),ENT_QUOTES, null, false);
 
 
 
 
 
 
 
 
 
13
 
14
+ $pgtm_og['fb:appid'] = $helper->getFacebookAppId();
15
+ $pgtm_og['fb:adminid'] = $helper->getFacebookAdminId();
16
+ $pgtm_og['p:domain_verify'] = $helper->getPinterestId();
17
+
18
+ $pgtm_og['og:url'] = Mage::helper('core/url')->getCurrentUrl();
 
 
 
 
19
 
20
+ if($pgtm_og['page_type']=="Product Detail"){
21
+ $pgtm_og['og:type'] = "product";
22
 
23
+ if(Mage::registry('current_product')){
24
+ $pan_product_id = Mage::registry('current_product')->getId();
25
+ $pan_product= Mage::getModel('catalog/product')->setStoreId($storeId)->load($pan_product_id);
26
+ }
27
 
 
 
 
 
28
 
29
+ if($pan_product->getTypeId() === Mage_Catalog_Model_Product_Type::TYPE_GROUPED)
30
+ {
31
+ $pgtm_og['product:price:amount'] = [];
32
+ $pgtm_og['product:price:currency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
33
 
34
+ foreach ($pan_product->getTypeInstance(true)->getAssociatedProducts($pan_product) as $assoProd)
 
 
 
 
 
 
 
 
 
 
 
35
  {
36
+ $pgtm_og['product:price:amount'][] = $tm->getPrice($assoProd->getId());
37
+ }
38
+
39
+ }elseif($pan_product->getTypeId() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE)
40
+ {
41
+ $associated_ids = $helper->getBundleProducts($pan_product_id);
42
+ $pgtm_og['product:price:amount'] = [];
43
+ foreach($associated_ids as $child)
44
  {
45
+ $pgtm_og['product:price:amount'][] = $tm->getPrice($child);
46
+ }
47
+ }else{
48
+ $pgtm_og['product:price:amount'] = $tm->getPrice($pan_product_id);
49
+ }
50
+ }
51
+
52
+ if($pgtm_og['page_type']=="Product Category"){
53
+ $pgtm_og['og:type'] = "product.group";
54
+ }
55
+
56
+ if( $helper->useTwitterCards()){
57
+ $pgtm_og['twitter:card'] = $pgtm_twitter['card_format'];
58
+ $pgtm_og['twitter:site'] = $pgtm_twitter['store_username'];
59
+ $pgtm_og['twitter:creator'] = $pgtm_twitter['creator_username'];
60
+ $pgtm_og['twitter:image'] = $pgtm_twitter['image'];
61
+ }
62
+
63
+ foreach ($pgtm_og as $k => $v){
64
+ if(is_array($v)){
65
+ foreach ($v as $ik => $iv){
66
+ echo('<meta property="' . $k . '" content="' . $iv . '" />'."\n");
67
+ }
68
+ } else {
69
+ echo('<meta property="' . $k . '" content="' . $v . '" />'."\n");
70
+ }
71
+
72
+ }
73
+
74
+
75
+ }
76
  ?>
77
 
78
 
app/design/frontend/base/default/template/panalysis/tagmanager/tagmanager.phtml CHANGED
@@ -1,12 +1,9 @@
1
  <?php
2
  $helper = Mage::helper('panalysis_tagmanager');
3
  $contId = $helper->getContainerId();
4
- ?>
5
- <!-- Start Google Tag Manager -->
6
- <?php if(isset($contId)): ?>
7
 
8
-
9
- <!-- Google Tag Manager -->
10
  <noscript><iframe src="//www.googletagmanager.com/ns.html?id=<?php echo $contId; ?>"
11
  height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
12
  <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
1
  <?php
2
  $helper = Mage::helper('panalysis_tagmanager');
3
  $contId = $helper->getContainerId();
 
 
 
4
 
5
+ if(isset($contId)): ?>
6
+ <!-- Start Google Tag Manager Plus by Panalysis. Version: <?php echo $helper->getExtensionVersion(); ?>. See http://www.panalysis.com/gtmplus for details and support -->
7
  <noscript><iframe src="//www.googletagmanager.com/ns.html?id=<?php echo $contId; ?>"
8
  height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
9
  <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Panalysis_TagManager</name>
4
- <version>0.5.3.1</version>
5
  <stability>beta</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl-3.0.en.html">GPL Version 3</license>
7
  <channel>community</channel>
@@ -10,11 +10,23 @@
10
  <description>This extension provides a seamless way of connecting to the Google Tag Manager service by adding both the code snippet and the data layer with enhanced ecommerce references.&#xD;
11
  &#xD;
12
  In addition to this it also provides support for the Open Graph tags used by Facebook and Pinterest as well as the Twitter Card extensions</description>
13
- <notes>Late beta release. This has been tested on 1.8 and 1.9 editions plus 1.4.1.1</notes>
 
 
 
 
 
 
 
 
 
 
 
 
14
  <authors><author><name>Rod Jacka</name><user>panalysis</user><email>rod@panalysis.com</email></author><author><name>Ariel Tarnowski</name><user>polcode</user><email>ariel.tarnowski@polcode.net</email></author></authors>
15
- <date>2016-03-08</date>
16
- <time>09:53:21</time>
17
- <contents><target name="magecommunity"><dir name="Panalysis"><dir name="TagManager"><dir><dir name="Block"><dir name="Adminhtml"><file name="Version.php" hash="0edf6f9f427413344f8b2688211be290"/></dir><file name="Tagmanager.php" hash="d2207e03645af566c7fd23fb41e30d3e"/><file name=".DS_Store" hash="8cf7b4da68442a0a64d1e153adcd8c82"/></dir><dir name="Helper"><file name="Data.php" hash="2da425e8dd49f3c438d3a28d18b79f3f"/></dir><dir name="Model"><dir name="Config"><dir name="Data"><file name="NotEmpty.php" hash="a38fa920e7f7c0505c7d17ed381f0e13"/></dir><file name=".DS_Store" hash="93d280ed78b5bd9a3aab8e30c0f2e810"/></dir><file name="Observer.php" hash="1627ce3abc61982b5fb353035ef51915"/><file name="Tagmanager.php" hash="b48095724c27b870ef9875ceb33ebe24"/><file name=".DS_Store" hash="60d450ab59b771a3c283579b2d35d28e"/></dir><dir name="controllers"><file name="AjaxController.php" hash="8b6a10a6796078adb0a3490cc4c07d51"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="etc"><file name="config.xml" hash="06d0c7de0bdfd44260d68b6469c830c5"/><file name="system.xml" hash="29d391af2cf654dfb55dbb5932fcb646"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></dir><file name=".DS_Store" hash="530c1efb8a38b42a2917def94d37be1d"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Panalysis_TagManager.xml" hash="04297a3ffe4f6462aa77006fc8076538"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="panalysis"><file name="tagmanager.xml" hash="84d5ada43613ce1dd51bc183fd7c5dbe"/></dir></dir><dir name="template"><dir name="panalysis"><dir name="tagmanager"><file name="datalayer.phtml" hash="ea18b8a3fc88218277baea41fc982da9"/><file name="opengraph.phtml" hash="9007cb51318e4455fc39cf4427e7b5e9"/><file name="tagmanager.phtml" hash="c15ee13fed00384e39e6b964e7924dd3"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="c1f8878dd12fabc25a31887912a97869"/></dir></dir></dir></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.4.38</min><max>7.0.0</max></php></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Panalysis_TagManager</name>
4
+ <version>0.5.10</version>
5
  <stability>beta</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl-3.0.en.html">GPL Version 3</license>
7
  <channel>community</channel>
10
  <description>This extension provides a seamless way of connecting to the Google Tag Manager service by adding both the code snippet and the data layer with enhanced ecommerce references.&#xD;
11
  &#xD;
12
  In addition to this it also provides support for the Open Graph tags used by Facebook and Pinterest as well as the Twitter Card extensions</description>
13
+ <notes>Late beta release. This has been tested on 1.8 and 1.9 editions plus 1.4.1.1&#xD;
14
+ &#xD;
15
+ Bug fixes include:&#xD;
16
+ - corrections to multiple currency support to ensure correct order and shipping totals&#xD;
17
+ - performance improvements in product listings&#xD;
18
+ - Prevent add to cart and remove from cart dataLayer calls being fired at the same time as order transaction details&#xD;
19
+ &#xD;
20
+ Additional features:&#xD;
21
+ - Add Magento page type to data layer&#xD;
22
+ - Added Customer Group attribute to data layer&#xD;
23
+ - Added number of previous orders to data layer&#xD;
24
+ &#xD;
25
+ Various other minor updates.</notes>
26
  <authors><author><name>Rod Jacka</name><user>panalysis</user><email>rod@panalysis.com</email></author><author><name>Ariel Tarnowski</name><user>polcode</user><email>ariel.tarnowski@polcode.net</email></author></authors>
27
+ <date>2016-05-07</date>
28
+ <time>06:51:18</time>
29
+ <contents><target name="magecommunity"><dir name="Panalysis"><dir name="TagManager"><dir><dir name="Block"><dir name="Adminhtml"><file name="Version.php" hash="0edf6f9f427413344f8b2688211be290"/></dir><file name="Tagmanager.php" hash="c724e822f0442be31f6f3d570a274beb"/></dir><dir name="Helper"><file name="Data.php" hash="73a15a153568aae11404f0d5fe023874"/></dir><dir name="Model"><dir name="Config"><dir name="Data"><file name="NotEmpty.php" hash="a38fa920e7f7c0505c7d17ed381f0e13"/></dir></dir><file name="Observer.php" hash="a3c664eaad090af0d5311c19ac8da1cf"/><file name="Tagmanager.php" hash="94b347738b7fd920356d0f5b0100ad1e"/></dir><dir name="controllers"><file name="AjaxController.php" hash="6ac5c018f10a7469bda41b7ba6c58b36"/></dir><dir name="etc"><file name="config.xml" hash="b8e672273af6ee9d29fd5d304a4d8d3e"/><file name="system.xml" hash="29d391af2cf654dfb55dbb5932fcb646"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Panalysis_TagManager.xml" hash="04297a3ffe4f6462aa77006fc8076538"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="panalysis"><file name="tagmanager.xml" hash="84d5ada43613ce1dd51bc183fd7c5dbe"/></dir></dir><dir name="template"><dir name="panalysis"><dir name="tagmanager"><file name="datalayer.phtml" hash="4bd65906c366247c4214d19adbe3949e"/><file name="opengraph.phtml" hash="b39ef6e8a4ef67b88fc2f41fde6c2885"/><file name="tagmanager.phtml" hash="da20b6d708e726f9154dae67504129d7"/></dir></dir></dir></dir></dir></dir></target></contents>
30
  <compatible/>
31
  <dependencies><required><php><min>5.4.38</min><max>7.0.0</max></php></required></dependencies>
32
  </package>