Version Notes
Updated
Download this release
Release Info
Developer | eGlobe IT Solutions |
Extension | Google_Tag_Manager |
Version | 0.1.1 |
Comparing to | |
See all releases |
Version 0.1.1
- LICENSE.txt +90 -0
- app/code/community/Egits/GoogleTagManager/Block/Remarketing.php +151 -0
- app/code/community/Egits/GoogleTagManager/Block/Tag.php +70 -0
- app/code/community/Egits/GoogleTagManager/Block/Transactions.php +121 -0
- app/code/community/Egits/GoogleTagManager/Helper/Data.php +113 -0
- app/code/community/Egits/GoogleTagManager/etc/adminhtml.xml +70 -0
- app/code/community/Egits/GoogleTagManager/etc/config.xml +76 -0
- app/code/community/Egits/GoogleTagManager/etc/system.xml +147 -0
- app/design/frontend/base/default/layout/egits_googletagmanager.xml +86 -0
- app/design/frontend/base/default/template/egits/googletagmanager/container.phtml +49 -0
- app/design/frontend/base/default/template/egits/googletagmanager/remarketing-data.phtml +45 -0
- app/design/frontend/base/default/template/egits/googletagmanager/tranaction-data.phtml +41 -0
- app/etc/modules/Egits_GoogleTagManager.xml +41 -0
- package.xml +18 -0
LICENSE.txt
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
eGlobe IT Solutions End-User License Agreement
|
2 |
+
www.eglobeits.com
|
3 |
+
|
4 |
+
THIS LICENSE AGREEMENT (HEREINAFTER AGREEMENT) IS AN AGREEMENT BETWEEN THE LICENSEE
|
5 |
+
(THE PERSON OR COMPANY WHO IS BEING LICENSED TO USE THE SOFTWARE OR DOCUMENTATION)
|
6 |
+
AND EGLOBE IT SOLUTIONS (P)LTD. THE AGREEMENT APPLIES TO ALL PRODUCTS/SOFTWARE/
|
7 |
+
SCRIPTS/SERVICES YOU OBTAIN FROM US.
|
8 |
+
|
9 |
+
1. By using the Software you acknowledge that you have read this Agreement,
|
10 |
+
and that you agree to the content of the Agreement and its terms, and agree
|
11 |
+
to use the Software in compliance with this Agreement.
|
12 |
+
|
13 |
+
2. The Agreement comes into legal force at the moment when you order our
|
14 |
+
Software from our site or receive it through email or on data medium at
|
15 |
+
our discretion.
|
16 |
+
|
17 |
+
3. We are the copyright holder of the Software. The Software or a portion of it
|
18 |
+
is a copyrightable matter and is liable to protection by the law. Any
|
19 |
+
activity that infringes terms of this Agreement violates copyright law and
|
20 |
+
will be prosecuted according to the current law. We reserve the right to
|
21 |
+
revoke the license of any user who is holding an invalid license.
|
22 |
+
|
23 |
+
4. This Agreement gives you the right to use only one copy of the Software on
|
24 |
+
one Magento installation solely for your own personal or business use,
|
25 |
+
subject to all other terms of this Agreement. A separate License should be
|
26 |
+
purchased for each new Software installation. Any distribution of the Software
|
27 |
+
without our consent, including noncommercial distribution is regarded as
|
28 |
+
violation of this Agreement and entails liability, according to the current law.
|
29 |
+
|
30 |
+
5. You may not use any part of the code in whole or part in any other software
|
31 |
+
or product or website. Company reserves the right to audit Licensee�s use of
|
32 |
+
the Software during normal business hours and with reasonable notice and to
|
33 |
+
include means within the Software to limit Licensee�s use of the Software
|
34 |
+
to the licensed number of Servers.
|
35 |
+
|
36 |
+
6. You may not give, sell, distribute, sub-license, rent, lease or lend any
|
37 |
+
portion of the Software or Documentation to anyone. You may not place the
|
38 |
+
Software on a server so that it is accessible via a public network such as
|
39 |
+
the Internet for distribution purposes.
|
40 |
+
|
41 |
+
7. You are bound to preserve the copyright information intact in the source files.
|
42 |
+
|
43 |
+
8. We reserve the right to publish a selected list of users of our Software.
|
44 |
+
|
45 |
+
9. We will not be liable to you for any damages (including any loss of
|
46 |
+
profits/saving, or incidental or consequential) caused to you, your
|
47 |
+
information and your business arising out of the use or inability to use
|
48 |
+
this Software.
|
49 |
+
|
50 |
+
10. We are not liable for prosecution arising from use of the Software against
|
51 |
+
law or for any illegal use.
|
52 |
+
|
53 |
+
11. If you fail to use the Software in accordance with the terms and conditions
|
54 |
+
of this License Agreement, it constitutes a breach of the agreement, and
|
55 |
+
your license to use the program is revoked.
|
56 |
+
|
57 |
+
12. eGlobe reserves the right to change this license agreement at any
|
58 |
+
time and impose its clauses at any given time.
|
59 |
+
|
60 |
+
13. License agreement remains effective until terminated. We retain the right to
|
61 |
+
terminate your license to use the Software at any time, if in its sole
|
62 |
+
discretion, you are not abiding by the terms of the Agreement, including,
|
63 |
+
but not limited to, obscuring or removing any link or copyright notice as
|
64 |
+
specified in this agreement. You may terminate it at any time by destroying
|
65 |
+
all copies of the Software. Termination of this Agreement does not bind us
|
66 |
+
to return you the amount spent for purchase of the Software.
|
67 |
+
|
68 |
+
14. If you continue to use the Software after eGlobe gives you notice
|
69 |
+
of termination of your license, you hereby agree to accept an injunction to
|
70 |
+
enjoin you from its further use and to pay all costs (including but not
|
71 |
+
limited to reasonable attorney fees) to enforce our revocation of your
|
72 |
+
license and any damages suffered by us because of your misuse of
|
73 |
+
the Software.
|
74 |
+
|
75 |
+
15. This software is designed to work with a specific Magento edition and
|
76 |
+
its use on an edition other than specified is prohibited. eGlobe does not
|
77 |
+
provide extension support in case of incorrect edition use.
|
78 |
+
|
79 |
+
16. Technical support and product updates are time-limited according to the
|
80 |
+
purchased support periods for the product. Licensee hereby grants Company
|
81 |
+
the right to display Licensee�s logos as part of Company's customer lists
|
82 |
+
and other related marketing materials. The parties shall cooperate to
|
83 |
+
undertake mutually-agreed joint marketing activities.
|
84 |
+
|
85 |
+
17. Company will provide Support Services and any Updates to Licensee during the
|
86 |
+
periods identified in the Order Form, subject to Licensee�s payment of the
|
87 |
+
applicable fees.
|
88 |
+
|
89 |
+
18. Company shall not be liable for any failure or delay in performance under
|
90 |
+
these Support Terms due to causes beyond its reasonable control.
|
app/code/community/Egits/GoogleTagManager/Block/Remarketing.php
ADDED
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* eGlobe IT Solutions (P)Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://ecommerce.eglobeits.com/license.txt
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to hello@eglobeits.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* =================================================================
|
17 |
+
* MAGENTO USAGE NOTICE
|
18 |
+
* =================================================================
|
19 |
+
* This package designed & developed for Magento COMMUNITY edition
|
20 |
+
* eGits does not guarantee correct work of this extension
|
21 |
+
* on any other Magento edition except Magento COMMUNITY edition.
|
22 |
+
* eGits does not provide extension support in case of
|
23 |
+
* incorrect edition usage.
|
24 |
+
* =================================================================
|
25 |
+
*
|
26 |
+
* @category Egits
|
27 |
+
* @package Egits_GoogleTagManager
|
28 |
+
* @version 0.1.0
|
29 |
+
* @copyright Copyright (c) 2015-2016 eGlobe IT Solutions (P)Ltd. (http://www.eglobeits.com/)
|
30 |
+
* @author eGits Team <hello@eglobeits.com>
|
31 |
+
* @license http://ecommerce.eglobeits.com/license.txt
|
32 |
+
*/
|
33 |
+
|
34 |
+
class Egits_GoogleTagManager_Block_Remarketing extends Egits_GoogleTagManager_Block_Tag
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Checking GTM and Remarketting data enabled
|
38 |
+
*
|
39 |
+
* @return boolean
|
40 |
+
*/
|
41 |
+
public function isRemarketingEnabled()
|
42 |
+
{
|
43 |
+
if($this->isActive() &&
|
44 |
+
$this->helper('egits_gtm')->isActiveRemarketing()) {
|
45 |
+
return true;
|
46 |
+
}
|
47 |
+
|
48 |
+
return false;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Preaparing remarketing data
|
53 |
+
*
|
54 |
+
* @return string json string
|
55 |
+
*/
|
56 |
+
public function getRemarketingData()
|
57 |
+
{
|
58 |
+
$result = array(
|
59 |
+
'event' => 'fireRemarketingTag',
|
60 |
+
'google_tag_params' => array()
|
61 |
+
);
|
62 |
+
|
63 |
+
$pageType = $this->getPageType();
|
64 |
+
|
65 |
+
switch ($pageType) {
|
66 |
+
case 'home':
|
67 |
+
$result['google_tag_params'] = array(
|
68 |
+
'ecomm_pagetype' => $pageType
|
69 |
+
);
|
70 |
+
break;
|
71 |
+
case 'searchresults':
|
72 |
+
case 'category':
|
73 |
+
$products = Mage::getBlockSingleton('catalog/product_list')->getLoadedProductCollection();
|
74 |
+
$ids = '';
|
75 |
+
foreach ($products as $item) {
|
76 |
+
if ($ids !== '') {
|
77 |
+
$ids .= ', ';
|
78 |
+
}
|
79 |
+
$ids .= "'" . $item->getSku() . "'";
|
80 |
+
}
|
81 |
+
$result['google_tag_params'] = array(
|
82 |
+
'ecomm_prodid' => '[' . $ids . ']',
|
83 |
+
'ecomm_pagetype' => $pageType
|
84 |
+
);
|
85 |
+
break;
|
86 |
+
case 'product':
|
87 |
+
$product = Mage::registry('current_product');
|
88 |
+
$price = $product->getPrice();
|
89 |
+
if ($product->getTypeId() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
|
90 |
+
$price = Mage::getModel('bundle/product_price')->getTotalPrices($product, 'min', 1);
|
91 |
+
}
|
92 |
+
$result['google_tag_params'] = array(
|
93 |
+
'ecomm_prodid' => $product->getSku(),
|
94 |
+
'ecomm_pagetype' => $pageType,
|
95 |
+
'ecomm_totalvalue' => round($price, 2),
|
96 |
+
);
|
97 |
+
break;
|
98 |
+
case 'cart':
|
99 |
+
$quote = Mage::getSingleton('checkout/cart')->getQuote();
|
100 |
+
$grandTotal = $quote->getGrandTotal();
|
101 |
+
$products = $quote->getAllItems();
|
102 |
+
$ids = '';
|
103 |
+
foreach ($products as $item) {
|
104 |
+
if ($ids !== '') {
|
105 |
+
$ids .= ', ';
|
106 |
+
}
|
107 |
+
$ids .= "'" . $item->getSku() . "'";
|
108 |
+
}
|
109 |
+
$result['google_tag_params'] = array(
|
110 |
+
'ecomm_prodid' => '[' . $ids . ']',
|
111 |
+
'ecomm_pagetype' => $pageType,
|
112 |
+
'ecomm_totalvalue' => round($grandTotal, 2),
|
113 |
+
);
|
114 |
+
break;
|
115 |
+
case 'purchase':
|
116 |
+
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
117 |
+
if ($orderId) {
|
118 |
+
$order = Mage::getModel('sales/order')->loadByAttribute('increment_id', $orderId);
|
119 |
+
$items = $order->getAllItems();
|
120 |
+
$ids = array();
|
121 |
+
foreach ($items as $item) {
|
122 |
+
$ids[] = $item->getProductId();
|
123 |
+
}
|
124 |
+
$products = Mage::getModel('catalog/product')
|
125 |
+
->getCollection()
|
126 |
+
->addAttributeToSelect('sku')
|
127 |
+
->addIdFilter($ids);
|
128 |
+
$ids = '';
|
129 |
+
foreach ($products as $item) {
|
130 |
+
if ($ids !== '') {
|
131 |
+
$ids .= ', ';
|
132 |
+
}
|
133 |
+
$ids .= "'" . $item->getSku() . "'";
|
134 |
+
}
|
135 |
+
$result['google_tag_params'] = array(
|
136 |
+
'ecomm_prodid' => '[' . $ids . ']',
|
137 |
+
'ecomm_pagetype' => $pageType,
|
138 |
+
'ecomm_totalvalue' => round($order->getGrandTotal(), 2),
|
139 |
+
);
|
140 |
+
}
|
141 |
+
break;
|
142 |
+
default:
|
143 |
+
$result['google_tag_params'] = array(
|
144 |
+
'ecomm_pagetype' => 'siteview'
|
145 |
+
);
|
146 |
+
break;
|
147 |
+
}
|
148 |
+
|
149 |
+
return json_encode($result);
|
150 |
+
}
|
151 |
+
}
|
app/code/community/Egits/GoogleTagManager/Block/Tag.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* eGlobe IT Solutions (P)Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://ecommerce.eglobeits.com/license.txt
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to hello@eglobeits.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* =================================================================
|
17 |
+
* MAGENTO USAGE NOTICE
|
18 |
+
* =================================================================
|
19 |
+
* This package designed & developed for Magento COMMUNITY edition
|
20 |
+
* eGits does not guarantee correct work of this extension
|
21 |
+
* on any other Magento edition except Magento COMMUNITY edition.
|
22 |
+
* eGits does not provide extension support in case of
|
23 |
+
* incorrect edition usage.
|
24 |
+
* =================================================================
|
25 |
+
*
|
26 |
+
* @category Egits
|
27 |
+
* @package Egits_GoogleTagManager
|
28 |
+
* @version 0.1.0
|
29 |
+
* @copyright Copyright (c) 2015-2016 eGlobe IT Solutions (P)Ltd. (http://www.eglobeits.com/)
|
30 |
+
* @author eGits Team <hello@eglobeits.com>
|
31 |
+
* @license http://ecommerce.eglobeits.com/license.txt
|
32 |
+
*/
|
33 |
+
|
34 |
+
class Egits_GoogleTagManager_Block_Tag extends Mage_Core_Block_Template
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Return module status
|
38 |
+
*
|
39 |
+
* @return boolean
|
40 |
+
*/
|
41 |
+
public function isActive()
|
42 |
+
{
|
43 |
+
return $this->helper('egits_gtm')->isActive();
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Return container id
|
48 |
+
*
|
49 |
+
* @return mixed
|
50 |
+
*/
|
51 |
+
public function getContainerId()
|
52 |
+
{
|
53 |
+
if (!$this->helper('egits_gtm')->isContainerEnabled() &&
|
54 |
+
$this->helper('egits_gtm')->getContainerId()) {
|
55 |
+
return $this->helper('egits_gtm')->getContainerId();
|
56 |
+
}
|
57 |
+
|
58 |
+
return false;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Return container script
|
63 |
+
*
|
64 |
+
* @return string
|
65 |
+
*/
|
66 |
+
public function getContainer()
|
67 |
+
{
|
68 |
+
return $this->helper('egits_gtm')->getContainer();
|
69 |
+
}
|
70 |
+
}
|
app/code/community/Egits/GoogleTagManager/Block/Transactions.php
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* eGlobe IT Solutions (P)Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://ecommerce.eglobeits.com/license.txt
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to hello@eglobeits.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* =================================================================
|
17 |
+
* MAGENTO USAGE NOTICE
|
18 |
+
* =================================================================
|
19 |
+
* This package designed & developed for Magento COMMUNITY edition
|
20 |
+
* eGits does not guarantee correct work of this extension
|
21 |
+
* on any other Magento edition except Magento COMMUNITY edition.
|
22 |
+
* eGits does not provide extension support in case of
|
23 |
+
* incorrect edition usage.
|
24 |
+
* =================================================================
|
25 |
+
*
|
26 |
+
* @category Egits
|
27 |
+
* @package Egits_GoogleTagManager
|
28 |
+
* @version 0.1.0
|
29 |
+
* @copyright Copyright (c) 2015-2016 eGlobe IT Solutions (P)Ltd. (http://www.eglobeits.com/)
|
30 |
+
* @author eGits Team <hello@eglobeits.com>
|
31 |
+
* @license http://ecommerce.eglobeits.com/license.txt
|
32 |
+
*/
|
33 |
+
|
34 |
+
class Egits_GoogleTagManager_Block_Transactions extends Egits_GoogleTagManager_Block_Tag
|
35 |
+
{
|
36 |
+
protected $_orderId = 0;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Constructor
|
40 |
+
*/
|
41 |
+
function __construct()
|
42 |
+
{
|
43 |
+
$this->_orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Checking GTM and Transaction enabled
|
48 |
+
*
|
49 |
+
* @return boolean
|
50 |
+
*/
|
51 |
+
public function isTranactionsEnabled()
|
52 |
+
{
|
53 |
+
if($this->isActive() &&
|
54 |
+
$this->helper('egits_gtm')->isActiveTransaction()) {
|
55 |
+
return true;
|
56 |
+
}
|
57 |
+
|
58 |
+
return false;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Preparing transaction data
|
63 |
+
*
|
64 |
+
* @return string json transaction data
|
65 |
+
*/
|
66 |
+
public function getTransactionsData()
|
67 |
+
{
|
68 |
+
$helper = $this->helper('egits_gtm');
|
69 |
+
$data = array();
|
70 |
+
|
71 |
+
if ($this->_orderId) {
|
72 |
+
$order = Mage::getModel('sales/order')->loadByAttribute('increment_id', $this->_orderId);
|
73 |
+
$items = $order->getAllVisibleItems();
|
74 |
+
$products = $this->_getProducts($items);
|
75 |
+
$priceAll = 0;
|
76 |
+
foreach ($products as $item) {
|
77 |
+
$priceAll += $item['price'] * $item['quantity'];
|
78 |
+
}
|
79 |
+
|
80 |
+
$data = array(
|
81 |
+
'transactionId' => $order->getIncrementId(),
|
82 |
+
'transactionAffiliation' => $helper->getTransactionAffiliation(),
|
83 |
+
'transactionTotal' => $priceAll,
|
84 |
+
'transactionTax' => '',
|
85 |
+
'transactionShipping' => round($order->getShippingAmount(), 2),
|
86 |
+
'transactionProducts' => $products
|
87 |
+
);
|
88 |
+
}
|
89 |
+
|
90 |
+
return json_encode($data);
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Preaparing order data from cart or order items
|
95 |
+
*
|
96 |
+
* @param object cart or order items in magento
|
97 |
+
* @return array Mage_Catalog_Product objests
|
98 |
+
*/
|
99 |
+
protected function _getProducts($items)
|
100 |
+
{
|
101 |
+
$products = array();
|
102 |
+
foreach ($items as $orderItem) {
|
103 |
+
if (intval($orderItem->getPrice()) === 0) {
|
104 |
+
continue;
|
105 |
+
}
|
106 |
+
$price = $orderItem->getPrice();
|
107 |
+
$product = Mage::getModel('catalog/product')->load($orderItem->getProductId());
|
108 |
+
$categoryIds = $product->getCategoryIds();
|
109 |
+
$category = Mage::getModel('catalog/category')->load($categoryIds[0]);
|
110 |
+
$products[] = array(
|
111 |
+
'sku' => $orderItem->getSku(),
|
112 |
+
'name' => $orderItem->getName(),
|
113 |
+
'category' => $category->getName(),
|
114 |
+
'price' => round($price, 2),
|
115 |
+
'quantity' => (int)$orderItem->getQty_ordered()
|
116 |
+
);
|
117 |
+
}
|
118 |
+
|
119 |
+
return $products;
|
120 |
+
}
|
121 |
+
}
|
app/code/community/Egits/GoogleTagManager/Helper/Data.php
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* eGlobe IT Solutions (P)Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://ecommerce.eglobeits.com/license.txt
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to hello@eglobeits.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* =================================================================
|
17 |
+
* MAGENTO USAGE NOTICE
|
18 |
+
* =================================================================
|
19 |
+
* This package designed & developed for Magento COMMUNITY edition
|
20 |
+
* eGits does not guarantee correct work of this extension
|
21 |
+
* on any other Magento edition except Magento COMMUNITY edition.
|
22 |
+
* eGits does not provide extension support in case of
|
23 |
+
* incorrect edition usage.
|
24 |
+
* =================================================================
|
25 |
+
*
|
26 |
+
* @category Egits
|
27 |
+
* @package Egits_GoogleTagManager
|
28 |
+
* @version 0.1.0
|
29 |
+
* @copyright Copyright (c) 2015-2016 eGlobe IT Solutions (P)Ltd. (http://www.eglobeits.com/)
|
30 |
+
* @author eGits Team <hello@eglobeits.com>
|
31 |
+
* @license http://ecommerce.eglobeits.com/license.txt
|
32 |
+
*/
|
33 |
+
|
34 |
+
class Egits_GoogleTagManager_Helper_Data extends Mage_Core_Helper_Abstract
|
35 |
+
{
|
36 |
+
const XML_PATH_ENABLED = 'egits_gtm/general/active';
|
37 |
+
const XML_PATH_ENABLE_CONTAINER = 'egits_gtm/general/container_enabled';
|
38 |
+
const XML_PATH_CONTAINER = 'egits_gtm/general/container';
|
39 |
+
const XML_PATH_CONTAINER_ID = 'egits_gtm/general/container_id';
|
40 |
+
const XML_PATH_ENABLE_REMARKETING = 'egits_gtm/remarketing/active';
|
41 |
+
const XML_PATH_ENABLE_TRANSACTION = 'egits_gtm/transaction/active';
|
42 |
+
const XML_PATH_TRANSACTION_AFFILIATION = 'egits_gtm/transaction/affiliation';
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Return module status
|
46 |
+
*
|
47 |
+
* @return mixed
|
48 |
+
*/
|
49 |
+
public function isActive()
|
50 |
+
{
|
51 |
+
return Mage::getStoreConfig(self::XML_PATH_ENABLED);
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Return container id
|
56 |
+
*
|
57 |
+
* @return mixed
|
58 |
+
*/
|
59 |
+
public function getContainerId()
|
60 |
+
{
|
61 |
+
return Mage::getStoreConfig(self::XML_PATH_CONTAINER_ID);
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Return container enabled
|
66 |
+
*
|
67 |
+
* @return mixed
|
68 |
+
*/
|
69 |
+
public function isContainerEnabled()
|
70 |
+
{
|
71 |
+
return Mage::getStoreConfig(self::XML_PATH_ENABLE_CONTAINER);
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Return container id
|
76 |
+
*
|
77 |
+
* @return mixed
|
78 |
+
*/
|
79 |
+
public function getContainer()
|
80 |
+
{
|
81 |
+
return Mage::getStoreConfig(self::XML_PATH_CONTAINER);
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Return remarketing status
|
86 |
+
*
|
87 |
+
* @return mixed
|
88 |
+
*/
|
89 |
+
public function isActiveRemarketing()
|
90 |
+
{
|
91 |
+
return Mage::getStoreConfig(self::XML_PATH_ENABLE_REMARKETING);
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Return transaction status
|
96 |
+
*
|
97 |
+
* @return mixed
|
98 |
+
*/
|
99 |
+
public function isActiveTransaction()
|
100 |
+
{
|
101 |
+
return Mage::getStoreConfig(self::XML_PATH_ENABLE_TRANSACTION);
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Return transaction affiliation
|
106 |
+
*
|
107 |
+
* @return string
|
108 |
+
*/
|
109 |
+
public function getTransactionAffiliation()
|
110 |
+
{
|
111 |
+
return Mage::getStoreConfig(self::XML_PATH_TRANSACTION_AFFILIATION);
|
112 |
+
}
|
113 |
+
}
|
app/code/community/Egits/GoogleTagManager/etc/adminhtml.xml
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* eGlobe IT Solutions (P)Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://ecommerce.eglobeits.com/license.txt
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to hello@eglobeits.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* =================================================================
|
17 |
+
* MAGENTO USAGE NOTICE
|
18 |
+
* =================================================================
|
19 |
+
* This package designed & developed for Magento COMMUNITY edition
|
20 |
+
* eGits does not guarantee correct work of this extension
|
21 |
+
* on any other Magento edition except Magento COMMUNITY edition.
|
22 |
+
* eGits does not provide extension support in case of
|
23 |
+
* incorrect edition usage.
|
24 |
+
* =================================================================
|
25 |
+
*
|
26 |
+
* @category Egits
|
27 |
+
* @package Egits_GoogleTagManager
|
28 |
+
* @version 0.1.0
|
29 |
+
* @copyright Copyright (c) 2015-2016 eGlobe IT Solutions (P)Ltd. (http://www.eglobeits.com/)
|
30 |
+
* @author eGits Team <hello@eglobeits.com>
|
31 |
+
* @license http://ecommerce.eglobeits.com/license.txt
|
32 |
+
*/
|
33 |
+
-->
|
34 |
+
<config>
|
35 |
+
<menu>
|
36 |
+
<egits translate="title" module="core">
|
37 |
+
<title>eGits</title>
|
38 |
+
<sort_order>80</sort_order>
|
39 |
+
<children>
|
40 |
+
<googletagmanager translate="title" module="core">
|
41 |
+
<title>Google Tag Manager</title>
|
42 |
+
<action>adminhtml/system_config/edit/section/egits_gtm</action>
|
43 |
+
<sort_order>700</sort_order>
|
44 |
+
</googletagmanager>
|
45 |
+
</children>
|
46 |
+
</egits>
|
47 |
+
</menu>
|
48 |
+
<acl>
|
49 |
+
<resources>
|
50 |
+
<all>
|
51 |
+
<title>Allow Everything</title>
|
52 |
+
</all>
|
53 |
+
<admin>
|
54 |
+
<children>
|
55 |
+
<system>
|
56 |
+
<children>
|
57 |
+
<config>
|
58 |
+
<children>
|
59 |
+
<egits_gtm>
|
60 |
+
<title>Google Tag Manager</title>
|
61 |
+
</egits_gtm>
|
62 |
+
</children>
|
63 |
+
</config>
|
64 |
+
</children>
|
65 |
+
</system>
|
66 |
+
</children>
|
67 |
+
</admin>
|
68 |
+
</resources>
|
69 |
+
</acl>
|
70 |
+
</config>
|
app/code/community/Egits/GoogleTagManager/etc/config.xml
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* eGlobe IT Solutions (P)Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://ecommerce.eglobeits.com/license.txt
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to hello@eglobeits.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* =================================================================
|
17 |
+
* MAGENTO USAGE NOTICE
|
18 |
+
* =================================================================
|
19 |
+
* This package designed & developed for Magento COMMUNITY edition
|
20 |
+
* eGits does not guarantee correct work of this extension
|
21 |
+
* on any other Magento edition except Magento COMMUNITY edition.
|
22 |
+
* eGits does not provide extension support in case of
|
23 |
+
* incorrect edition usage.
|
24 |
+
* =================================================================
|
25 |
+
*
|
26 |
+
* @category Egits
|
27 |
+
* @package Egits_GoogleTagManager
|
28 |
+
* @version 0.1.0
|
29 |
+
* @copyright Copyright (c) 2015-2016 eGlobe IT Solutions (P)Ltd. (http://www.eglobeits.com/)
|
30 |
+
* @author eGits Team <hello@eglobeits.com>
|
31 |
+
* @license http://ecommerce.eglobeits.com/license.txt
|
32 |
+
*/
|
33 |
+
-->
|
34 |
+
<config>
|
35 |
+
<modules>
|
36 |
+
<Egits_GoogleTagManager>
|
37 |
+
<version>0.1.0</version>
|
38 |
+
</Egits_GoogleTagManager>
|
39 |
+
</modules>
|
40 |
+
<frontend>
|
41 |
+
<layout>
|
42 |
+
<updates>
|
43 |
+
<egits_gtm>
|
44 |
+
<file>egits_googletagmanager.xml</file>
|
45 |
+
</egits_gtm>
|
46 |
+
</updates>
|
47 |
+
</layout>
|
48 |
+
</frontend>
|
49 |
+
<global>
|
50 |
+
<helpers>
|
51 |
+
<egits_gtm>
|
52 |
+
<class>Egits_GoogleTagManager_Helper</class>
|
53 |
+
</egits_gtm>
|
54 |
+
</helpers>
|
55 |
+
<blocks>
|
56 |
+
<egits_gtm>
|
57 |
+
<class>Egits_GoogleTagManager_Block</class>
|
58 |
+
</egits_gtm>
|
59 |
+
</blocks>
|
60 |
+
</global>
|
61 |
+
<default>
|
62 |
+
<egits_gtm>
|
63 |
+
<general>
|
64 |
+
<active>1</active>
|
65 |
+
<container_enabled>0</container_enabled>
|
66 |
+
</general>
|
67 |
+
<transaction>
|
68 |
+
<active>0</active>
|
69 |
+
<affiliation>My Store</affiliation>
|
70 |
+
</transaction>
|
71 |
+
<remarketing>
|
72 |
+
<active>0</active>
|
73 |
+
</remarketing>
|
74 |
+
</egits_gtm>
|
75 |
+
</default>
|
76 |
+
</config>
|
app/code/community/Egits/GoogleTagManager/etc/system.xml
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* eGlobe IT Solutions (P)Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://ecommerce.eglobeits.com/license.txt
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to hello@eglobeits.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* =================================================================
|
17 |
+
* MAGENTO USAGE NOTICE
|
18 |
+
* =================================================================
|
19 |
+
* This package designed & developed for Magento COMMUNITY edition
|
20 |
+
* eGits does not guarantee correct work of this extension
|
21 |
+
* on any other Magento edition except Magento COMMUNITY edition.
|
22 |
+
* eGits does not provide extension support in case of
|
23 |
+
* incorrect edition usage.
|
24 |
+
* =================================================================
|
25 |
+
*
|
26 |
+
* @category Egits
|
27 |
+
* @package Egits_GoogleTagManager
|
28 |
+
* @version 0.1.0
|
29 |
+
* @copyright Copyright (c) 2015-2016 eGlobe IT Solutions (P)Ltd. (http://www.eglobeits.com/)
|
30 |
+
* @author eGits Team <hello@eglobeits.com>
|
31 |
+
* @license http://ecommerce.eglobeits.com/license.txt
|
32 |
+
*/
|
33 |
+
-->
|
34 |
+
<config>
|
35 |
+
<tabs>
|
36 |
+
<egits translate="label" module="core">
|
37 |
+
<label>Egits Extensions</label>
|
38 |
+
<sort_order>101</sort_order>
|
39 |
+
</egits>
|
40 |
+
</tabs>
|
41 |
+
<sections>
|
42 |
+
<egits_gtm translate="label" module="core">
|
43 |
+
<label>Google Tag Manager</label>
|
44 |
+
<tab>egits</tab>
|
45 |
+
<sort_order>1000</sort_order>
|
46 |
+
<show_in_default>1</show_in_default>
|
47 |
+
<show_in_website>1</show_in_website>
|
48 |
+
<show_in_store>1</show_in_store>
|
49 |
+
<groups>
|
50 |
+
<general translate="label" module="core">
|
51 |
+
<label>General</label>
|
52 |
+
<frontend_type>text</frontend_type>
|
53 |
+
<sort_order>0</sort_order>
|
54 |
+
<show_in_default>1</show_in_default>
|
55 |
+
<show_in_website>1</show_in_website>
|
56 |
+
<show_in_store>1</show_in_store>
|
57 |
+
<fields>
|
58 |
+
<active translate="label">
|
59 |
+
<label>Enabled</label>
|
60 |
+
<frontend_type>select</frontend_type>
|
61 |
+
<sort_order>0</sort_order>
|
62 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
63 |
+
<show_in_default>1</show_in_default>
|
64 |
+
<show_in_website>1</show_in_website>
|
65 |
+
<show_in_store>1</show_in_store>
|
66 |
+
</active>
|
67 |
+
<container_enabled translate="label">
|
68 |
+
<label>Enabled Container</label>
|
69 |
+
<frontend_type>select</frontend_type>
|
70 |
+
<sort_order>10</sort_order>
|
71 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>1</show_in_website>
|
74 |
+
<show_in_store>1</show_in_store>
|
75 |
+
<depends><active>1</active></depends>
|
76 |
+
</container_enabled>
|
77 |
+
<container translate="label">
|
78 |
+
<label>Container Snippet</label>
|
79 |
+
<frontend_type>textarea</frontend_type>
|
80 |
+
<sort_order>20</sort_order>
|
81 |
+
<show_in_default>1</show_in_default>
|
82 |
+
<show_in_website>1</show_in_website>
|
83 |
+
<show_in_store>1</show_in_store>
|
84 |
+
<depends><active>1</active><container_enabled>1</container_enabled></depends>
|
85 |
+
<comment>Save contanier snippet here</comment>
|
86 |
+
</container>
|
87 |
+
<container_id translate="label">
|
88 |
+
<label>Container ID</label>
|
89 |
+
<frontend_type>text</frontend_type>
|
90 |
+
<sort_order>20</sort_order>
|
91 |
+
<show_in_default>1</show_in_default>
|
92 |
+
<show_in_website>1</show_in_website>
|
93 |
+
<show_in_store>1</show_in_store>
|
94 |
+
<depends><active>1</active><container_enabled>0</container_enabled></depends>
|
95 |
+
</container_id>
|
96 |
+
</fields>
|
97 |
+
</general>
|
98 |
+
<transaction>
|
99 |
+
<label>Transaction</label>
|
100 |
+
<frontend_type>text</frontend_type>
|
101 |
+
<sort_order>10</sort_order>
|
102 |
+
<show_in_default>1</show_in_default>
|
103 |
+
<show_in_website>1</show_in_website>
|
104 |
+
<show_in_store>1</show_in_store>
|
105 |
+
<fields>
|
106 |
+
<active translate="label">
|
107 |
+
<label>Enabled</label>
|
108 |
+
<frontend_type>select</frontend_type>
|
109 |
+
<sort_order>0</sort_order>
|
110 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
111 |
+
<show_in_default>1</show_in_default>
|
112 |
+
<show_in_website>1</show_in_website>
|
113 |
+
<show_in_store>1</show_in_store>
|
114 |
+
</active>
|
115 |
+
<affiliation translate="label">
|
116 |
+
<label>Transaction Affiliation</label>
|
117 |
+
<frontend_type>text</frontend_type>
|
118 |
+
<sort_order>1</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 |
+
<depends><active>1</active></depends>
|
123 |
+
</affiliation>
|
124 |
+
</fields>
|
125 |
+
</transaction>
|
126 |
+
<remarketing translate="label">
|
127 |
+
<label>Remarketing</label>
|
128 |
+
<sort_order>20</sort_order>
|
129 |
+
<show_in_default>1</show_in_default>
|
130 |
+
<show_in_website>1</show_in_website>
|
131 |
+
<show_in_store>1</show_in_store>
|
132 |
+
<fields>
|
133 |
+
<active translate="label">
|
134 |
+
<label>Enabled</label>
|
135 |
+
<frontend_type>select</frontend_type>
|
136 |
+
<sort_order>0</sort_order>
|
137 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
138 |
+
<show_in_default>1</show_in_default>
|
139 |
+
<show_in_website>1</show_in_website>
|
140 |
+
<show_in_store>1</show_in_store>
|
141 |
+
</active>
|
142 |
+
</fields>
|
143 |
+
</remarketing>
|
144 |
+
</groups>
|
145 |
+
</egits_gtm>
|
146 |
+
</sections>
|
147 |
+
</config>
|
app/design/frontend/base/default/layout/egits_googletagmanager.xml
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* eGlobe IT Solutions (P)Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://ecommerce.eglobeits.com/license.txt
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to hello@eglobeits.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* =================================================================
|
17 |
+
* MAGENTO USAGE NOTICE
|
18 |
+
* =================================================================
|
19 |
+
* This package designed & developed for Magento COMMUNITY edition
|
20 |
+
* eGits does not guarantee correct work of this extension
|
21 |
+
* on any other Magento edition except Magento COMMUNITY edition.
|
22 |
+
* eGits does not provide extension support in case of
|
23 |
+
* incorrect edition usage.
|
24 |
+
* =================================================================
|
25 |
+
*
|
26 |
+
* @category Egits
|
27 |
+
* @package Egits_GoogleTagManager
|
28 |
+
* @version 0.1.0
|
29 |
+
* @copyright Copyright (c) 2015-2016 eGlobe IT Solutions (P)Ltd. (http://www.eglobeits.com/)
|
30 |
+
* @author eGits Team <hello@eglobeits.com>
|
31 |
+
* @license http://ecommerce.eglobeits.com/license.txt
|
32 |
+
*/
|
33 |
+
-->
|
34 |
+
|
35 |
+
<layout>
|
36 |
+
<default>
|
37 |
+
<reference name="after_body_start">
|
38 |
+
<block type="egits_gtm/tag" name="egits.gtm.code" template="egits/googletagmanager/container.phtml">
|
39 |
+
<block type="core/text_list" name="egits.gtm.data" as="dataLayer" translate="label">
|
40 |
+
<label>Data Layer</label>
|
41 |
+
</block>
|
42 |
+
</block>
|
43 |
+
</reference>
|
44 |
+
<reference name="egits.gtm.data">
|
45 |
+
<block type="egits_gtm/remarketing" name="egits.gtm.remarketing" template="egits/googletagmanager/remarketing-data.phtml"/>
|
46 |
+
</reference>
|
47 |
+
</default>
|
48 |
+
<checkout_onepage_success>
|
49 |
+
<reference name="egits.gtm.data">
|
50 |
+
<block type="egits_gtm/transactions" name="egits.gtm.transactions" before="egits.gtm.remarketing" template="egits/googletagmanager/tranaction-data.phtml"/>
|
51 |
+
</reference>
|
52 |
+
<reference name="egits.gtm.remarketing">
|
53 |
+
<action method="setPageType"><type>purchase</type></action>
|
54 |
+
</reference>
|
55 |
+
</checkout_onepage_success>
|
56 |
+
<checkout_cart_index>
|
57 |
+
<reference name="egits.gtm.remarketing">
|
58 |
+
<action method="setPageType"><type>cart</type></action>
|
59 |
+
</reference>
|
60 |
+
</checkout_cart_index>
|
61 |
+
<cms_index_index>
|
62 |
+
<reference name="egits.gtm.remarketing">
|
63 |
+
<action method="setPageType"><type>home</type></action>
|
64 |
+
</reference>
|
65 |
+
</cms_index_index>
|
66 |
+
<catalog_category_view>
|
67 |
+
<reference name="egits.gtm.remarketing">
|
68 |
+
<action method="setPageType"><type>category</type></action>
|
69 |
+
</reference>
|
70 |
+
</catalog_category_view>
|
71 |
+
<catalog_product_view>
|
72 |
+
<reference name="egits.gtm.remarketing">
|
73 |
+
<action method="setPageType"><type>product</type></action>
|
74 |
+
</reference>
|
75 |
+
</catalog_product_view>
|
76 |
+
<catalogsearch_result_index>
|
77 |
+
<reference name="egits.gtm.remarketing">
|
78 |
+
<action method="setPageType"><type>searchresults</type></action>
|
79 |
+
</reference>
|
80 |
+
</catalogsearch_result_index>
|
81 |
+
<catalogsearch_advanced_result>
|
82 |
+
<reference name="egits.gtm.remarketing">
|
83 |
+
<action method="setPageType"><type>searchresults</type></action>
|
84 |
+
</reference>
|
85 |
+
</catalogsearch_advanced_result>
|
86 |
+
</layout>
|
app/design/frontend/base/default/template/egits/googletagmanager/container.phtml
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* eGlobe IT Solutions (P)Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://ecommerce.eglobeits.com/license.txt
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to hello@eglobeits.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* =================================================================
|
17 |
+
* MAGENTO USAGE NOTICE
|
18 |
+
* =================================================================
|
19 |
+
* This package designed & developed for Magento COMMUNITY edition
|
20 |
+
* eGits does not guarantee correct work of this extension
|
21 |
+
* on any other Magento edition except Magento COMMUNITY edition.
|
22 |
+
* eGits does not provide extension support in case of
|
23 |
+
* incorrect edition usage.
|
24 |
+
* =================================================================
|
25 |
+
*
|
26 |
+
* @category Egits
|
27 |
+
* @package Egits_GoogleTagManager
|
28 |
+
* @version 0.1.0
|
29 |
+
* @copyright Copyright (c) 2015-2016 eGlobe IT Solutions (P)Ltd. (http://www.eglobeits.com/)
|
30 |
+
* @author eGits Team <hello@eglobeits.com>
|
31 |
+
* @license http://ecommerce.eglobeits.com/license.txt
|
32 |
+
*/
|
33 |
+
?>
|
34 |
+
<?php if($this->isActive()): ?>
|
35 |
+
<?php echo $this->getChildHtml('dataLayer'); ?>
|
36 |
+
<?php if($this->getContainerId()): ?>
|
37 |
+
<!-- Google Tag Manager -->
|
38 |
+
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=<?php echo $this->getContainerId(); ?>"
|
39 |
+
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
40 |
+
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
41 |
+
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
42 |
+
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
43 |
+
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
44 |
+
})(window,document,'script','dataLayer','<?php echo $this->getContainerId(); ?>');</script>
|
45 |
+
<!-- End Google Tag Manager -->
|
46 |
+
<?php else: ?>
|
47 |
+
<?php echo $this->getContainer(); ?>
|
48 |
+
<?php endif; ?>
|
49 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/egits/googletagmanager/remarketing-data.phtml
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* eGlobe IT Solutions (P)Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://ecommerce.eglobeits.com/license.txt
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to hello@eglobeits.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* =================================================================
|
17 |
+
* MAGENTO USAGE NOTICE
|
18 |
+
* =================================================================
|
19 |
+
* This package designed & developed for Magento COMMUNITY edition
|
20 |
+
* eGits does not guarantee correct work of this extension
|
21 |
+
* on any other Magento edition except Magento COMMUNITY edition.
|
22 |
+
* eGits does not provide extension support in case of
|
23 |
+
* incorrect edition usage.
|
24 |
+
* =================================================================
|
25 |
+
*
|
26 |
+
* @category Egits
|
27 |
+
* @package Egits_GoogleTagManager
|
28 |
+
* @version 0.1.0
|
29 |
+
* @copyright Copyright (c) 2015-2016 eGlobe IT Solutions (P)Ltd. (http://www.eglobeits.com/)
|
30 |
+
* @author eGits Team <hello@eglobeits.com>
|
31 |
+
* @license http://ecommerce.eglobeits.com/license.txt
|
32 |
+
*/
|
33 |
+
?>
|
34 |
+
<?php if ($this->isRemarketingEnabled()): ?>
|
35 |
+
<!-- Google Remarketing Data -->
|
36 |
+
<script type="text/javascript">
|
37 |
+
if (typeof dataLayer === 'undefined') {
|
38 |
+
dataLayer= [];
|
39 |
+
}
|
40 |
+
dataLayer.push(<?php echo $this->getRemarketingData(); ?>);
|
41 |
+
</script>
|
42 |
+
<!-- Google Remarketing Data -->
|
43 |
+
<?php endif; ?>
|
44 |
+
|
45 |
+
|
app/design/frontend/base/default/template/egits/googletagmanager/tranaction-data.phtml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* eGlobe IT Solutions (P)Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://ecommerce.eglobeits.com/license.txt
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to hello@eglobeits.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* =================================================================
|
17 |
+
* MAGENTO USAGE NOTICE
|
18 |
+
* =================================================================
|
19 |
+
* This package designed & developed for Magento COMMUNITY edition
|
20 |
+
* eGits does not guarantee correct work of this extension
|
21 |
+
* on any other Magento edition except Magento COMMUNITY edition.
|
22 |
+
* eGits does not provide extension support in case of
|
23 |
+
* incorrect edition usage.
|
24 |
+
* =================================================================
|
25 |
+
*
|
26 |
+
* @category Egits
|
27 |
+
* @package Egits_GoogleTagManager
|
28 |
+
* @version 0.1.0
|
29 |
+
* @copyright Copyright (c) 2015-2016 eGlobe IT Solutions (P)Ltd. (http://www.eglobeits.com/)
|
30 |
+
* @author eGits Team <hello@eglobeits.com>
|
31 |
+
* @license http://ecommerce.eglobeits.com/license.txt
|
32 |
+
*/
|
33 |
+
?>
|
34 |
+
<?php if ($this->isTranactionsEnabled()): ?>
|
35 |
+
<!-- Google Transaction Data -->
|
36 |
+
<script type="text/javascript">
|
37 |
+
dataLayer = [ <?php echo $this->getTransactionsData() ?> ];
|
38 |
+
</script>
|
39 |
+
<!-- Google Transaction Data -->
|
40 |
+
<?php endif; ?>
|
41 |
+
|
app/etc/modules/Egits_GoogleTagManager.xml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* eGlobe IT Solutions (P)Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://ecommerce.eglobeits.com/license.txt
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to hello@eglobeits.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* =================================================================
|
17 |
+
* MAGENTO USAGE NOTICE
|
18 |
+
* =================================================================
|
19 |
+
* This package designed & developed for Magento COMMUNITY edition
|
20 |
+
* eGits does not guarantee correct work of this extension
|
21 |
+
* on any other Magento edition except Magento COMMUNITY edition.
|
22 |
+
* eGits does not provide extension support in case of
|
23 |
+
* incorrect edition usage.
|
24 |
+
* =================================================================
|
25 |
+
*
|
26 |
+
* @category Egits
|
27 |
+
* @package Egits_GoogleTagManager
|
28 |
+
* @version 0.1.0
|
29 |
+
* @copyright Copyright (c) 2015-2016 eGlobe IT Solutions (P)Ltd. (http://www.eglobeits.com/)
|
30 |
+
* @author eGits Team <hello@eglobeits.com>
|
31 |
+
* @license http://ecommerce.eglobeits.com/license.txt
|
32 |
+
*/
|
33 |
+
-->
|
34 |
+
<config>
|
35 |
+
<modules>
|
36 |
+
<Egits_GoogleTagManager>
|
37 |
+
<active>true</active>
|
38 |
+
<codePool>community</codePool>
|
39 |
+
</Egits_GoogleTagManager>
|
40 |
+
</modules>
|
41 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Google_Tag_Manager</name>
|
4 |
+
<version>0.1.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://ecommerce.eglobeits.com/license.txt">EULA</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>A simple extension that will allow you to add Google Tag Manager script.</summary>
|
10 |
+
<description>The Google Tag Manager extension from eGlobe IT Solutions is the perfect tool for those looking to install Google’s free tag management solution on their Magento site, regardless of which version or edition of Magento they currently use. With a few simple clicks and configurations, this extension creates a site-wide implementation of Google Tag Manager and a fully-functioning data layer on any and all versions of the Magento platform.</description>
|
11 |
+
<notes>Updated </notes>
|
12 |
+
<authors><author><name>eGlobe IT Solutions</name><user>egits</user><email>hello@eglobeits.com</email></author></authors>
|
13 |
+
<date>2015-03-13</date>
|
14 |
+
<time>11:45:56</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Egits"><dir name="GoogleTagManager"><dir name="Block"><file name="Remarketing.php" hash="9d13022b9c97821b7502f29e4410baa4"/><file name="Tag.php" hash="85e774cd1a769430eccb7d2840d5d789"/><file name="Transactions.php" hash="b9e36d89028866b52d1f9779d04b7919"/></dir><dir name="Helper"><file name="Data.php" hash="a89acf85f0f2374ddda1c0bffe432959"/></dir><dir name="etc"><file name="adminhtml.xml" hash="27a090b5950082163de029d90ae8b58d"/><file name="config.xml" hash="3969bcf45ec8362f84ac33c39c3f21b3"/><file name="system.xml" hash="646713564fac097ca45b49d5f5035edb"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="egits_googletagmanager.xml" hash="a9f171ffcc49fd7d1f6c518f39ebf9fc"/></dir><dir name="template"><dir name="egits"><dir name="googletagmanager"><file name="container.phtml" hash="53411284d4ed4510ce351451b2fabe3b"/><file name="remarketing-data.phtml" hash="1335791b9dd2eb372c745d0d037d4d16"/><file name="tranaction-data.phtml" hash="d5141a99505d15ea978b5b8cd7931b51"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Egits_GoogleTagManager.xml" hash="b38fbf1f5fcf06bf1de3dc64b581b56e"/></dir></target><target name="mageweb"><dir name="."><file name="LICENSE.txt" hash="a0ee912fd64f8ac619025272a61bf520"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>1.5.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|