Version Notes
No notes
Download this release
Release Info
Developer | Yireo |
Extension | yireo_googletagmanager |
Version | 1.2.5 |
Comparing to | |
See all releases |
Code changes from version 1.2.1 to 1.2.5
- app/code/community/Yireo/GoogleTagManager/Block/Category.php +1 -1
- app/code/community/Yireo/GoogleTagManager/Block/Custom.php +1 -1
- app/code/community/Yireo/GoogleTagManager/Block/Default.php +3 -3
- app/code/community/Yireo/GoogleTagManager/Block/Order.php +7 -7
- app/code/community/Yireo/GoogleTagManager/Block/Product.php +1 -1
- app/code/community/Yireo/GoogleTagManager/Block/Quote.php +1 -1
- app/code/community/Yireo/GoogleTagManager/Block/Script.php +1 -1
- app/code/community/Yireo/GoogleTagManager/Helper/Data.php +1 -1
- app/code/community/Yireo/GoogleTagManager/Model/Container.php +1 -1
- app/code/community/Yireo/GoogleTagManager/Model/Observer.php +1 -1
- app/code/community/Yireo/GoogleTagManager/etc/config.xml +2 -2
- app/code/community/Yireo/GoogleTagManager/etc/system.xml +1 -1
- app/design/frontend/base/default/layout/googletagmanager.xml +1 -1
- app/design/frontend/base/default/template/googletagmanager/category.phtml +2 -2
- app/design/frontend/base/default/template/googletagmanager/default.phtml +9 -1
- app/design/frontend/base/default/template/googletagmanager/order.phtml +6 -6
- app/design/frontend/base/default/template/googletagmanager/product.phtml +3 -3
- app/design/frontend/base/default/template/googletagmanager/quote.phtml +5 -5
- app/etc/modules/Yireo_GoogleTagManager.xml +1 -1
- package.xml +1 -1
app/code/community/Yireo/GoogleTagManager/Block/Category.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
-
* @copyright Copyright
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
+
* @copyright Copyright 2015 Yireo (http://www.yireo.com/)
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
app/code/community/Yireo/GoogleTagManager/Block/Custom.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
-
* @copyright Copyright
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
+
* @copyright Copyright 2015 Yireo (http://www.yireo.com/)
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
app/code/community/Yireo/GoogleTagManager/Block/Default.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
-
* @copyright Copyright
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
@@ -40,9 +40,9 @@ class Yireo_GoogleTagManager_Block_Default extends Mage_Core_Block_Template
|
|
40 |
return json_encode($attributes);
|
41 |
}
|
42 |
|
43 |
-
public function
|
44 |
{
|
45 |
-
Mage::getSingleton('googletagmanager/container')->setData($name, $value);
|
46 |
}
|
47 |
|
48 |
public function getAttributes()
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
+
* @copyright Copyright 2015 Yireo (http://www.yireo.com/)
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
40 |
return json_encode($attributes);
|
41 |
}
|
42 |
|
43 |
+
public function addAttribute($name, $value)
|
44 |
{
|
45 |
+
return Mage::getSingleton('googletagmanager/container')->setData($name, $value);
|
46 |
}
|
47 |
|
48 |
public function getAttributes()
|
app/code/community/Yireo/GoogleTagManager/Block/Order.php
CHANGED
@@ -1,24 +1,24 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* GoogleTagManager plugin for Magento
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
-
* @copyright Copyright
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
11 |
class Yireo_GoogleTagManager_Block_Order extends Yireo_GoogleTagManager_Block_Default
|
12 |
{
|
13 |
public function getItemsAsJson()
|
14 |
-
{
|
15 |
$data = array();
|
16 |
foreach($this->getOrder()->getAllItems() as $item) {
|
17 |
$data[] = array(
|
18 |
-
'sku' => $item->
|
19 |
-
'name' => $item->
|
20 |
-
'price' => $item->
|
21 |
-
'quantity' => $item->
|
22 |
);
|
23 |
}
|
24 |
return json_encode($data);
|
1 |
<?php
|
2 |
/**
|
3 |
+
* GoogleTagManager plugin for Magento
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
+
* @copyright Copyright 2015 Yireo (http://www.yireo.com/)
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
11 |
class Yireo_GoogleTagManager_Block_Order extends Yireo_GoogleTagManager_Block_Default
|
12 |
{
|
13 |
public function getItemsAsJson()
|
14 |
+
{
|
15 |
$data = array();
|
16 |
foreach($this->getOrder()->getAllItems() as $item) {
|
17 |
$data[] = array(
|
18 |
+
'sku' => $item->getSku(),
|
19 |
+
'name' => $item->getName(),
|
20 |
+
'price' => $item->getPrice(),
|
21 |
+
'quantity' => $item->getQtyOrdered(),
|
22 |
);
|
23 |
}
|
24 |
return json_encode($data);
|
app/code/community/Yireo/GoogleTagManager/Block/Product.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
-
* @copyright Copyright
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
+
* @copyright Copyright 2015 Yireo (http://www.yireo.com/)
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
app/code/community/Yireo/GoogleTagManager/Block/Quote.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
-
* @copyright Copyright
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
+
* @copyright Copyright 2015 Yireo (http://www.yireo.com/)
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
app/code/community/Yireo/GoogleTagManager/Block/Script.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
-
* @copyright Copyright
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
+
* @copyright Copyright 2015 Yireo (http://www.yireo.com/)
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
app/code/community/Yireo/GoogleTagManager/Helper/Data.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
-
* @copyright Copyright
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
+
* @copyright Copyright 2015 Yireo (http://www.yireo.com/)
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
app/code/community/Yireo/GoogleTagManager/Model/Container.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
-
* @copyright Copyright
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
+
* @copyright Copyright 2015 Yireo (http://www.yireo.com/)
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
app/code/community/Yireo/GoogleTagManager/Model/Observer.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
-
* @copyright Copyright
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
+
* @copyright Copyright 2015 Yireo (http://www.yireo.com/)
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
app/code/community/Yireo/GoogleTagManager/etc/config.xml
CHANGED
@@ -5,14 +5,14 @@
|
|
5 |
*
|
6 |
* @package Yireo_GoogleTagManager
|
7 |
* @author Yireo
|
8 |
-
* @copyright Copyright
|
9 |
* @license Open Source License (OSL v3)
|
10 |
*/
|
11 |
-->
|
12 |
<config>
|
13 |
<modules>
|
14 |
<Yireo_GoogleTagManager>
|
15 |
-
<version>1.2.
|
16 |
</Yireo_GoogleTagManager>
|
17 |
</modules>
|
18 |
|
5 |
*
|
6 |
* @package Yireo_GoogleTagManager
|
7 |
* @author Yireo
|
8 |
+
* @copyright Copyright 2015 Yireo (http://www.yireo.com/)
|
9 |
* @license Open Source License (OSL v3)
|
10 |
*/
|
11 |
-->
|
12 |
<config>
|
13 |
<modules>
|
14 |
<Yireo_GoogleTagManager>
|
15 |
+
<version>1.2.5</version>
|
16 |
</Yireo_GoogleTagManager>
|
17 |
</modules>
|
18 |
|
app/code/community/Yireo/GoogleTagManager/etc/system.xml
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @category design_default
|
7 |
* @package Yireo_GoogleTagManager
|
8 |
* @author Yireo
|
9 |
-
* @copyright Copyright
|
10 |
* @license Open Source License (OSL v3)
|
11 |
*/
|
12 |
-->
|
6 |
* @category design_default
|
7 |
* @package Yireo_GoogleTagManager
|
8 |
* @author Yireo
|
9 |
+
* @copyright Copyright 2015 Yireo (http://www.yireo.com/)
|
10 |
* @license Open Source License (OSL v3)
|
11 |
*/
|
12 |
-->
|
app/design/frontend/base/default/layout/googletagmanager.xml
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
*
|
6 |
* @package Yireo_GoogleTagManager
|
7 |
* @author Yireo (http://www.yireo.com/)
|
8 |
-
* @copyright Copyright
|
9 |
* @license Open Source License (OSL)
|
10 |
*/
|
11 |
-->
|
5 |
*
|
6 |
* @package Yireo_GoogleTagManager
|
7 |
* @author Yireo (http://www.yireo.com/)
|
8 |
+
* @copyright Copyright 2015 Yireo (http://www.yireo.com/)
|
9 |
* @license Open Source License (OSL)
|
10 |
*/
|
11 |
-->
|
app/design/frontend/base/default/template/googletagmanager/category.phtml
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
<?php if($this->isEnabled()) : ?>
|
12 |
<?php $category = $this->getCategory(); ?>
|
13 |
<?php if(!empty($category) && $category->getId() > 0) : ?>
|
14 |
-
<?php $this->
|
15 |
-
<?php $this->
|
16 |
<?php endif; ?>
|
17 |
<?php endif; ?>
|
11 |
<?php if($this->isEnabled()) : ?>
|
12 |
<?php $category = $this->getCategory(); ?>
|
13 |
<?php if(!empty($category) && $category->getId() > 0) : ?>
|
14 |
+
<?php $this->addAttribute('categoryId', $category->getId()); ?>
|
15 |
+
<?php $this->addAttribute('categoryName', $category->getName()); ?>
|
16 |
<?php endif; ?>
|
17 |
<?php endif; ?>
|
app/design/frontend/base/default/template/googletagmanager/default.phtml
CHANGED
@@ -9,6 +9,9 @@
|
|
9 |
*/
|
10 |
?>
|
11 |
<?php if($this->isEnabled()) : ?>
|
|
|
|
|
|
|
12 |
<?php $childScript = $this->getChildScript(); ?>
|
13 |
<?php if(!empty($childScript)) : ?>
|
14 |
<script>
|
@@ -18,5 +21,10 @@ dataLayer = [<?php echo $this->getAttributesAsJson(); ?>];
|
|
18 |
<?php echo $childScript; ?>
|
19 |
</script>
|
20 |
<?php endif; ?>
|
21 |
-
<
|
|
|
|
|
|
|
|
|
|
|
22 |
<?php endif; ?>
|
9 |
*/
|
10 |
?>
|
11 |
<?php if($this->isEnabled()) : ?>
|
12 |
+
|
13 |
+
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=<?php echo $this->getId(); ?>"
|
14 |
+
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
15 |
<?php $childScript = $this->getChildScript(); ?>
|
16 |
<?php if(!empty($childScript)) : ?>
|
17 |
<script>
|
21 |
<?php echo $childScript; ?>
|
22 |
</script>
|
23 |
<?php endif; ?>
|
24 |
+
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push(
|
25 |
+
{'gtm.start': new Date().getTime(),event:'gtm.js'}
|
26 |
+
);var f=d.getElementsByTagName(s)[0],
|
27 |
+
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
28 |
+
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
29 |
+
})(window,document,'script','dataLayer','<?php echo $this->getId(); ?>');</script>
|
30 |
<?php endif; ?>
|
app/design/frontend/base/default/template/googletagmanager/order.phtml
CHANGED
@@ -11,11 +11,11 @@
|
|
11 |
<?php if($this->isEnabled()) : ?>
|
12 |
<?php $order = $this->getOrder(); ?>
|
13 |
<?php if(!empty($order) && $order->getId() > 0) : ?>
|
14 |
-
<?php $this->
|
15 |
-
<?php $this->
|
16 |
-
<?php $this->
|
17 |
-
<?php $this->
|
18 |
-
<?php $this->
|
19 |
-
<?php $this->
|
20 |
<?php endif; ?>
|
21 |
<?php endif; ?>
|
11 |
<?php if($this->isEnabled()) : ?>
|
12 |
<?php $order = $this->getOrder(); ?>
|
13 |
<?php if(!empty($order) && $order->getId() > 0) : ?>
|
14 |
+
<?php $this->addAttribute('transactionId', $order->getIncrementId()); ?>
|
15 |
+
<?php $this->addAttribute('transactionAffiliation', Mage::app()->getWebsite()->getName()); ?>
|
16 |
+
<?php $this->addAttribute('transactionTotal', (float)$order->getGrandTotal()); ?>
|
17 |
+
<?php $this->addAttribute('transactionTax', $order->getGrandTotal() - $order->getSubtotal()); ?>
|
18 |
+
<?php $this->addAttribute('transactionShipping', (float)$order->getShippingAmount()); ?>
|
19 |
+
<?php $this->addAttribute('transactionProducts', $this->getItemsAsJson()); ?>
|
20 |
<?php endif; ?>
|
21 |
<?php endif; ?>
|
app/design/frontend/base/default/template/googletagmanager/product.phtml
CHANGED
@@ -11,8 +11,8 @@
|
|
11 |
<?php if($this->isEnabled()) : ?>
|
12 |
<?php $product = $this->getProduct(); ?>
|
13 |
<?php if(!empty($product) && $product->getId() > 0) : ?>
|
14 |
-
<?php $this->
|
15 |
-
<?php $this->
|
16 |
-
<?php $this->
|
17 |
<?php endif; ?>
|
18 |
<?php endif; ?>
|
11 |
<?php if($this->isEnabled()) : ?>
|
12 |
<?php $product = $this->getProduct(); ?>
|
13 |
<?php if(!empty($product) && $product->getId() > 0) : ?>
|
14 |
+
<?php $this->addAttribute('productId', $product->getId()); ?>
|
15 |
+
<?php $this->addAttribute('productName', $product->getName()); ?>
|
16 |
+
<?php $this->addAttribute('productSku', $product->getSku()); ?>
|
17 |
<?php endif; ?>
|
18 |
<?php endif; ?>
|
app/design/frontend/base/default/template/googletagmanager/quote.phtml
CHANGED
@@ -11,10 +11,10 @@
|
|
11 |
<?php if($this->isEnabled()) : ?>
|
12 |
<?php $quote = $this->getQuote(); ?>
|
13 |
<?php if(!empty($quote) && $quote->getId() > 0) : ?>
|
14 |
-
<?php $this->
|
15 |
-
<?php $this->
|
16 |
-
<?php $this->
|
17 |
-
<?php $this->
|
18 |
-
<?php $this->
|
19 |
<?php endif; ?>
|
20 |
<?php endif; ?>
|
11 |
<?php if($this->isEnabled()) : ?>
|
12 |
<?php $quote = $this->getQuote(); ?>
|
13 |
<?php if(!empty($quote) && $quote->getId() > 0) : ?>
|
14 |
+
<?php $this->addAttribute('transactionId', $quote->getId()); ?>
|
15 |
+
<?php $this->addAttribute('transactionAffiliation', Mage::app()->getWebsite()->getName()); ?>
|
16 |
+
<?php $this->addAttribute('transactionTotal', (float)$quote->getGrandTotal()); ?>
|
17 |
+
<?php $this->addAttribute('transactionTax', $quote->getGrandTotal() - $quote->getSubtotal()); ?>
|
18 |
+
<?php $this->addAttribute('transactionProducts', $this->getItemsAsJson()); ?>
|
19 |
<?php endif; ?>
|
20 |
<?php endif; ?>
|
app/etc/modules/Yireo_GoogleTagManager.xml
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
*
|
6 |
* @package Yireo_GoogleTagManager
|
7 |
* @author Yireo (http://www.yireo.com/)
|
8 |
-
* @copyright Copyright
|
9 |
* @license Open Software License
|
10 |
*/
|
11 |
-->
|
5 |
*
|
6 |
* @package Yireo_GoogleTagManager
|
7 |
* @author Yireo (http://www.yireo.com/)
|
8 |
+
* @copyright Copyright 2015 Yireo (http://www.yireo.com/)
|
9 |
* @license Open Software License
|
10 |
*/
|
11 |
-->
|
package.xml
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<package><name>yireo_googletagmanager</name><version>1.2.
|
1 |
<?xml version="1.0"?>
|
2 |
+
<package><name>yireo_googletagmanager</name><version>1.2.5</version><stability>stable</stability><license>Open Source License</license><channel>community</channel><extends></extends><summary>No summary</summary><description>No description</description><notes>No notes</notes><authors><author><name>Yireo</name><user>yireo</user><email>info@yireo.com</email></author></authors><date>2015-05-04</date><time>8:34:28</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Yireo_GoogleTagManager.xml" hash="420bde8207c2ed151e50ef4b7df1c28f"/></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="googletagmanager"><file name="category.phtml" hash="640b6681d85960ba3b0aa3354ebc830f"/><file name="custom.phtml" hash="2b4ae99a074d314241a1ba7127661c04"/><file name="default.phtml" hash="dc617a278f916daa29a9ae23af042508"/><file name="order.phtml" hash="2146e83baf2aa83ddcf440765a3a682c"/><file name="product.phtml" hash="4ad52681c6a38c7dd171473cdd251e15"/><file name="quote.phtml" hash="86b6436d7608b65d5e61b4141a2f16a1"/></dir></dir><dir name="layout"><file name="googletagmanager.xml" hash="c8e0c3e0aebe3e4c758e461bfd2d34d7"/></dir></dir></dir></dir></dir><dir name="code"><dir name="community"><dir name="Yireo"><dir name="GoogleTagManager"><dir name="etc"><file name="config.xml" hash="3f825d0935d1f1b742317c6d4cab704c"/><file name="system.xml" hash="2677a582d2b4ac0abd9e0962145bcb43"/></dir><dir name="Model"><file name="Container.php" hash="782c5f85ca92dc39dff034768d9d7177"/><file name="Observer.php" hash="c610c89d15839df042a8b899074a8663"/></dir><dir name="Helper"><file name="Data.php" hash="9abe7d5e3bb79d8daee86cb24de56a0c"/></dir><dir name="Block"><file name="Category.php" hash="b3b6869a041c9eed07a15a509980ddf0"/><file name="Custom.php" hash="fd1c528409d0186f9ec7de8391d2509c"/><file name="Default.php" hash="61e1ea7f68095102cac400897d6b069c"/><file name="Order.php" hash="7decad3d14d211ee79809981738149f5"/><file name="Product.php" hash="02f816ccdb1a0b7a74f001dee0d0018d"/><file name="Quote.php" hash="17580bf20487ceb803421c0ca0575741"/><file name="Script.php" hash="32d42b4ddd53f3e7f14fed040042f938"/></dir></dir></dir></dir></dir></dir></target></contents></package>
|