Version Notes
2.0.1 - Fix for extended UDO rendering blank page
2.0.0 - Added external script support and refactored
1.2.0 - Added UI admin toggle for onePage Checkout
1.1.1 - Fixed pages not rendering
1.1.0 - Added support for alternate checkout pages
1.0.2 - Added html/text help to admin config
1.0.1 - Fixed arrays that were rendering as strings
1.0.0 - refactored based on Tealium class
* added support for external UDO definition
* added support for diagnostic pixel
0.4.4d - added output of diagnostic pixel
0.4.4 - strip commas from all dollar values
0.4.3 - fix for bad array on order page
0.4.2 - added simple discount array
0.4.0 - fix for individual discounts and number formats
0.3.1 - fix for configurable product arrays
0.3.0 - fix for missing support message
0.2.0 - fix for product page tag syntax
0.1.0 - initial release
Release Info
| Developer | Tealium Inc. |
| Extension | Tealium_Tags |
| Version | 2.0.1 |
| Comparing to | |
| See all releases | |
Code changes from version 1.1.0 to 2.0.1
- app/code/local/Tealium/Tags/Helper/Data.php +97 -57
- app/code/local/Tealium/Tags/Helper/Observer.php +22 -0
- app/code/local/Tealium/Tags/etc/adminhtml.xml +0 -0
- app/code/local/Tealium/Tags/etc/config.xml +34 -21
- app/code/local/Tealium/Tags/etc/system.xml +163 -37
- app/design/frontend/base/default/layout/tealium_tags.xml +0 -0
- app/design/frontend/base/default/template/tealium_tags/.checkout_success.phtml.swp +0 -0
- app/design/frontend/base/default/template/tealium_tags/base.phtml +5 -2
- app/design/frontend/base/default/template/tealium_tags/catalog_product_compare_index.phtml +23 -11
- app/design/frontend/base/default/template/tealium_tags/catalogsearch_advanced_result_index.phtml +23 -11
- app/design/frontend/base/default/template/tealium_tags/catalogsearch_result_index.phtml +16 -3
- app/design/frontend/base/default/template/tealium_tags/catalogsearch_term_popular.phtml +21 -6
- app/design/frontend/base/default/template/tealium_tags/category.phtml +16 -3
- app/design/frontend/base/default/template/tealium_tags/checkout_cart_index.phtml +16 -3
- app/design/frontend/base/default/template/tealium_tags/checkout_onepage.phtml +48 -13
- app/design/frontend/base/default/template/tealium_tags/checkout_success.phtml +11 -3
- app/design/frontend/base/default/template/tealium_tags/cms.phtml +16 -3
- app/design/frontend/base/default/template/tealium_tags/customer.phtml +15 -3
- app/design/frontend/base/default/template/tealium_tags/generic.phtml +23 -4
- app/design/frontend/base/default/template/tealium_tags/guest_sales.phtml +19 -4
- app/design/frontend/base/default/template/tealium_tags/product.phtml +14 -5
- app/design/frontend/base/default/template/tealium_tags/product_send.phtml +26 -16
- app/design/frontend/base/default/template/tealium_tags/seo.phtml +16 -3
- app/design/frontend/base/default/template/tealium_tags/tag_list_index.phtml +22 -6
- app/design/frontend/base/default/template/tealium_tags/tag_product_list.phtml +21 -5
- app/etc/modules/Tealium_Tags.xml +0 -0
- lib/Tealium/.Tealium.php.swp +0 -0
- lib/Tealium/Errors.log.txt +0 -0
- lib/Tealium/Tealium.php +185 -225
- lib/Tealium/TealiumAPI.php +0 -70
- lib/Tealium/TealiumCustomData.php +127 -0
- lib/Tealium/TealiumInit.php +286 -226
- package.xml +10 -7
|
@@ -1,74 +1,114 @@
|
|
| 1 |
<?php
|
|
|
|
| 2 |
|
| 3 |
class Tealium_Tags_Helper_Data extends Mage_Core_Helper_Abstract {
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
public function init(
|
| 8 |
-
|
| 9 |
-
$account = $this->getAccount($store);
|
| 10 |
-
|
| 11 |
-
|
| 12 |
|
| 13 |
-
$data = array(
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
}
|
| 23 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
}
|
| 25 |
-
$this->tealium->pageType("Home");
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
public function isEnabled($store) {
|
| 30 |
-
return Mage::getStoreConfig('tealium_tags/general/enable', $store);
|
| 31 |
-
}
|
| 32 |
|
| 33 |
-
public function
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
$profile = $this->getProfile($store);
|
| 40 |
-
$env = $this->getEnv($store);
|
| 41 |
-
return "//tags.tiqcdn.com/utag/$account/$profile/$env/utag.js";
|
| 42 |
-
}
|
| 43 |
-
|
| 44 |
-
function getTealiumObject($store, $page = array()){
|
| 45 |
-
$this->init($store, $page);
|
| 46 |
-
return $this->tealium;
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
public function getAccount($store) {
|
| 50 |
-
return Mage::getStoreConfig('tealium_tags/general/account', $store);
|
| 51 |
-
}
|
| 52 |
-
|
| 53 |
-
public function getProfile($store) {
|
| 54 |
-
return Mage::getStoreConfig('tealium_tags/general/profile', $store);
|
| 55 |
-
}
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
|
|
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
public function getUDOPath($store) {
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
public function getDiagnosticTag($store) {
|
| 66 |
-
if (Mage::getStoreConfig('tealium_tags/general/diagnostic_enable', $store)){
|
| 67 |
-
$utag_data= urlencode($this->tealium->render("json"));
|
| 68 |
-
$url = Mage::getStoreConfig('tealium_tags/general/diagnostic_tag', $store) . '?origin=server&user_agent='
|
| 69 |
return '<img src="' . $url . '" style="display:none"/>';
|
| 70 |
}
|
| 71 |
return "";
|
| 72 |
-
|
| 73 |
}
|
| 74 |
-
|
| 1 |
<?php
|
| 2 |
+
require_once (Mage::getBaseDir ( 'lib' ) . '/Tealium/Tealium.php');
|
| 3 |
|
| 4 |
class Tealium_Tags_Helper_Data extends Mage_Core_Helper_Abstract {
|
| 5 |
+
protected $tealium;
|
| 6 |
+
protected $store;
|
| 7 |
+
protected $page;
|
| 8 |
+
public function init(&$store, &$page = array(), $pageType) {
|
| 9 |
+
|
| 10 |
+
$account = $this->getAccount ( $store );
|
| 11 |
+
$profile = $this->getProfile ( $store );
|
| 12 |
+
$env = $this->getEnv ( $store );
|
| 13 |
|
| 14 |
+
$data = array (
|
| 15 |
+
"store" => $store,
|
| 16 |
+
"page" => $page
|
| 17 |
+
);
|
| 18 |
+
$this->store = $store;
|
| 19 |
+
$this->page = $page;
|
| 20 |
+
$this->tealium = new Tealium( $account, $profile, $env, $pageType, $data );
|
| 21 |
+
|
| 22 |
+
return $this;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
public function addCustomDataFromSetup(&$store, $pageType){
|
| 26 |
+
$data = array (
|
| 27 |
+
"store" => $this->store,
|
| 28 |
+
"page" => $this->page
|
| 29 |
+
);
|
| 30 |
+
if (Mage::getStoreConfig ( 'tealium_tags/general/udo_enable', $store )) {
|
| 31 |
+
include_once (Mage::getStoreConfig ( 'tealium_tags/general/udo', $store ));
|
| 32 |
+
|
| 33 |
+
if ( method_exists($this, "getCustomUdo") ){
|
| 34 |
+
$customUdoElements = getCustomUdo();
|
| 35 |
+
if ( is_array($customUdoElements) && self::isAssocArray($customUdoElements) ){
|
| 36 |
+
$udoElements = $customUdoElements;
|
| 37 |
}
|
| 38 |
}
|
| 39 |
+
elseif (!isset($udoElements) || ( isset($udoElements) && !self::isAssocArray($udoElements) )){
|
| 40 |
+
$udoElements = array();
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
if ( isset($udoElements[$pageType]) ){
|
| 44 |
+
$this->tealium->setCustomUdo($udoElements[$pageType]);
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
}
|
|
|
|
| 48 |
|
| 49 |
+
return $this;
|
| 50 |
+
}
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
+
public function addCustomDataFromObject($udoObject){
|
| 53 |
+
if ( is_array($udoObject) && self::isAssocArray($udoObject) ){
|
| 54 |
+
$this->tealium->updateUdo($udoObject);
|
| 55 |
+
}
|
| 56 |
+
return $this;
|
| 57 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
+
protected static function isAssocArray( $array) {
|
| 60 |
+
$keys = array_keys($array);
|
| 61 |
+
return array_keys($keys) !== $keys;
|
| 62 |
+
}
|
| 63 |
|
| 64 |
+
public function isEnabled($store) {
|
| 65 |
+
return Mage::getStoreConfig ( 'tealium_tags/general/enable', $store );
|
| 66 |
+
}
|
| 67 |
+
public function enableOnePageCheckout($store) {
|
| 68 |
+
return Mage::getStoreConfig ( 'tealium_tags/general/onepage', $store );
|
| 69 |
+
}
|
| 70 |
+
public function externalUdoEnabled($store) {
|
| 71 |
+
return Mage::getStoreConfig ( 'tealium_tags/general/udo_enable', $store );
|
| 72 |
+
}
|
| 73 |
+
public function getTealiumBaseUrl($store) {
|
| 74 |
+
$account = $this->getAccount ( $store );
|
| 75 |
+
$profile = $this->getProfile ( $store );
|
| 76 |
+
$env = $this->getEnv ( $store );
|
| 77 |
+
return "//tags.tiqcdn.com/utag/$account/$profile/$env/utag.js";
|
| 78 |
+
}
|
| 79 |
+
public function getTealiumObject() {
|
| 80 |
+
return $this->tealium;
|
| 81 |
+
}
|
| 82 |
+
public function getAccount($store) {
|
| 83 |
+
return Mage::getStoreConfig ( 'tealium_tags/general/account', $store );
|
| 84 |
+
}
|
| 85 |
+
public function getProfile($store) {
|
| 86 |
+
return Mage::getStoreConfig ( 'tealium_tags/general/profile', $store );
|
| 87 |
+
}
|
| 88 |
+
public function getEnv($store) {
|
| 89 |
+
return Mage::getStoreConfig ( 'tealium_tags/general/env', $store );
|
| 90 |
+
}
|
| 91 |
public function getUDOPath($store) {
|
| 92 |
+
return Mage::getStoreConfig ( 'tealium_tags/general/udo', $store );
|
| 93 |
+
}
|
| 94 |
+
public function getAPIEnabled($store) {
|
| 95 |
+
return Mage::getStoreConfig ( 'tealium_tags/general/api_enable', $store );
|
| 96 |
+
}
|
| 97 |
+
public function getIsExternalScript($store) {
|
| 98 |
+
return Mage::getStoreConfig ( 'tealium_tags/general/external_script', $store );
|
| 99 |
+
}
|
| 100 |
+
public function getExternalScriptType($store) {
|
| 101 |
+
$async = Mage::getStoreConfig ( 'tealium_tags/general/external_script_type', $store );
|
| 102 |
+
$scriptType = $async ? "async" : "sync";
|
| 103 |
+
return $scriptType;
|
| 104 |
+
}
|
| 105 |
public function getDiagnosticTag($store) {
|
| 106 |
+
if (Mage::getStoreConfig ( 'tealium_tags/general/diagnostic_enable', $store )) {
|
| 107 |
+
$utag_data = urlencode ( $this->tealium->render ( "json" ) );
|
| 108 |
+
$url = Mage::getStoreConfig ( 'tealium_tags/general/diagnostic_tag', $store ) . '?origin=server&user_agent=' . $_SERVER ['HTTP_USER_AGENT'] . '&data=' . $utag_data;
|
| 109 |
return '<img src="' . $url . '" style="display:none"/>';
|
| 110 |
}
|
| 111 |
return "";
|
| 112 |
+
}
|
| 113 |
}
|
| 114 |
+
|
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Tealium_Tags_Helper_Observer extends Mage_Core_Helper_Abstract
|
| 3 |
+
{
|
| 4 |
+
public function __construct()
|
| 5 |
+
{
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
public function apiHandler($observer)
|
| 9 |
+
{
|
| 10 |
+
if (isset($_REQUEST["tealium_api"]) && $_REQUEST["tealium_api"] == "true"){
|
| 11 |
+
$response = $observer->getEvent()->getFront()->getResponse();
|
| 12 |
+
$html = $response->getBody();
|
| 13 |
+
preg_match('/\/\/TEALIUM_START(.*)\/\/TEALIUM_END/is', $html, $matches);
|
| 14 |
+
$javaScript = "// Tealium Magento Callback API";
|
| 15 |
+
$javaScript .= $matches[1];
|
| 16 |
+
$response->setBody($javaScript);
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
return $this;
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
?>
|
|
File without changes
|
|
@@ -1,24 +1,37 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<config>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
</config>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Tealium_Tags>
|
| 5 |
+
<version>0.3.0</version>
|
| 6 |
+
</Tealium_Tags>
|
| 7 |
+
</modules>
|
| 8 |
+
<global>
|
| 9 |
+
<helpers>
|
| 10 |
+
<tealium_tags>
|
| 11 |
+
<class>Tealium_Tags_Helper</class>
|
| 12 |
+
</tealium_tags>
|
| 13 |
+
</helpers>
|
| 14 |
+
<events>
|
| 15 |
+
<controller_front_send_response_before>
|
| 16 |
+
<observers>
|
| 17 |
+
<tealium_tags>
|
| 18 |
+
<type>singleton</type>
|
| 19 |
+
<class>
|
| 20 |
+
Tealium_Tags_Helper_Observer
|
| 21 |
+
</class>
|
| 22 |
+
<method>apiHandler</method>
|
| 23 |
+
</tealium_tags>
|
| 24 |
+
</observers>
|
| 25 |
+
</controller_front_send_response_before>
|
| 26 |
+
</events>
|
| 27 |
+
</global>
|
| 28 |
+
<frontend>
|
| 29 |
+
<layout>
|
| 30 |
+
<updates>
|
| 31 |
+
<tealium_tags>
|
| 32 |
+
<file>tealium_tags.xml</file>
|
| 33 |
+
</tealium_tags>
|
| 34 |
+
</updates>
|
| 35 |
+
</layout>
|
| 36 |
+
</frontend>
|
| 37 |
</config>
|
|
@@ -40,6 +40,18 @@
|
|
| 40 |
<show_in_website>1</show_in_website>
|
| 41 |
<show_in_store>1</show_in_store>
|
| 42 |
</enable>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
<account translate="label">
|
| 44 |
<label>Account</label>
|
| 45 |
<comment>
|
|
@@ -100,33 +112,131 @@
|
|
| 100 |
<div style="display:none; background-color:#000; color:#0F0" id="code_example">
|
| 101 |
<pre>
|
| 102 |
<?php
|
| 103 |
-
//
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
|
| 109 |
$udoElements = array(
|
| 110 |
-
Home =>
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
Category =>
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
);
|
| 129 |
|
|
|
|
| 130 |
?>
|
| 131 |
</pre>
|
| 132 |
<br /><a href="javascript:false;" onclick="javascript: document.getElementById('code_example').style.display='none'">Hide</a>
|
|
@@ -140,38 +250,54 @@ $udoElements = array(
|
|
| 140 |
<show_in_website>1</show_in_website>
|
| 141 |
<show_in_store>1</show_in_store>
|
| 142 |
</udo>
|
| 143 |
-
|
| 144 |
-
<label>Enable
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
<frontend_type>select</frontend_type>
|
| 146 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 147 |
<sort_order>17</sort_order>
|
| 148 |
<show_in_default>1</show_in_default>
|
| 149 |
<show_in_website>1</show_in_website>
|
| 150 |
<show_in_store>1</show_in_store>
|
| 151 |
-
</
|
| 152 |
-
|
| 153 |
-
<label>
|
| 154 |
<comment>
|
| 155 |
-
<![CDATA[<span class="notice">
|
|
|
|
|
|
|
| 156 |
</comment>
|
| 157 |
-
<frontend_type>
|
|
|
|
| 158 |
<sort_order>18</sort_order>
|
| 159 |
<show_in_default>1</show_in_default>
|
| 160 |
<show_in_website>1</show_in_website>
|
| 161 |
<show_in_store>1</show_in_store>
|
| 162 |
-
</
|
| 163 |
-
|
| 164 |
-
<label>Enable
|
| 165 |
-
<comment>
|
| 166 |
-
<![CDATA[<span class="notice">Please contact your Account Manager for information about this feature</span>]]>
|
| 167 |
-
</comment>
|
| 168 |
<frontend_type>select</frontend_type>
|
| 169 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 170 |
<sort_order>19</sort_order>
|
| 171 |
<show_in_default>1</show_in_default>
|
| 172 |
<show_in_website>1</show_in_website>
|
| 173 |
<show_in_store>1</show_in_store>
|
| 174 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
<help translate="label">
|
| 176 |
<label>Help Section</label>
|
| 177 |
<comment>
|
|
@@ -670,7 +796,7 @@ Copyright © 2014 Tealium, Inc. All rights reserved.</p></article>
|
|
| 670 |
]]>
|
| 671 |
</comment>
|
| 672 |
<frontend_type>label</frontend_type>
|
| 673 |
-
<sort_order>
|
| 674 |
<show_in_default>1</show_in_default>
|
| 675 |
<show_in_website>1</show_in_website>
|
| 676 |
<show_in_store>1</show_in_store>
|
| 40 |
<show_in_website>1</show_in_website>
|
| 41 |
<show_in_store>1</show_in_store>
|
| 42 |
</enable>
|
| 43 |
+
<onepage translate="label">
|
| 44 |
+
<label>Enable OnePage Checkout</label>
|
| 45 |
+
<comment>
|
| 46 |
+
<![CDATA[<span class="notice">Enable/Disable OnePage Checkout Support</span>]]>
|
| 47 |
+
</comment>
|
| 48 |
+
<frontend_type>select</frontend_type>
|
| 49 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 50 |
+
<sort_order>2</sort_order>
|
| 51 |
+
<show_in_default>1</show_in_default>
|
| 52 |
+
<show_in_website>1</show_in_website>
|
| 53 |
+
<show_in_store>1</show_in_store>
|
| 54 |
+
</onepage>
|
| 55 |
<account translate="label">
|
| 56 |
<label>Account</label>
|
| 57 |
<comment>
|
| 112 |
<div style="display:none; background-color:#000; color:#0F0" id="code_example">
|
| 113 |
<pre>
|
| 114 |
<?php
|
| 115 |
+
// TealiumExtendData use this to override or extend default values proivided by the Tealium module
|
| 116 |
+
|
| 117 |
+
class TealiumExtendData {
|
| 118 |
+
private static $store;
|
| 119 |
+
private static $page;
|
| 120 |
+
|
| 121 |
+
public static function setStore($store){
|
| 122 |
+
TealiumExtendData::$store = $store;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
public static function setPage($page){
|
| 126 |
+
TealiumExtendData::$page = $page;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
public function getHome(){
|
| 130 |
+
$store = TealiumExtendData::$store;
|
| 131 |
+
$page = TealiumExtendData::$page;
|
| 132 |
+
|
| 133 |
+
$outputArray = array();
|
| 134 |
+
//$outputArray["custom_key"] = "value";
|
| 135 |
+
|
| 136 |
+
return $outputArray;
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
public function getSearch(){
|
| 140 |
+
$store = TealiumExtendData::$store;
|
| 141 |
+
$page = TealiumExtendData::$page;
|
| 142 |
+
|
| 143 |
+
$outputArray = array();
|
| 144 |
+
//$outputArray["custom_key"] = "value";
|
| 145 |
+
|
| 146 |
+
return $outputArray;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
public function getCategory(){
|
| 150 |
+
$store = TealiumExtendData::$store;
|
| 151 |
+
$page = TealiumExtendData::$page;
|
| 152 |
+
|
| 153 |
+
$outputArray = array();
|
| 154 |
+
//$outputArray["custom_key"] = "value";
|
| 155 |
+
|
| 156 |
+
return $outputArray;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
public function getProductPage(){
|
| 160 |
+
$store = TealiumExtendData::$store;
|
| 161 |
+
$page = TealiumExtendData::$page;
|
| 162 |
+
|
| 163 |
+
$outputArray = array();
|
| 164 |
+
//$outputArray["custom_key"] = "value";
|
| 165 |
+
// make sure any product values are in an array
|
| 166 |
+
|
| 167 |
+
return $outputArray;
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
public function getCartPage() {
|
| 171 |
+
$store = TealiumExtendData::$store;
|
| 172 |
+
$page = TealiumExtendData::$page;
|
| 173 |
+
|
| 174 |
+
$outputArray = array();
|
| 175 |
+
//$outputArray["custom_key"] = "value";
|
| 176 |
+
// make sure any product values are in an array
|
| 177 |
+
|
| 178 |
+
return $outputArray;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
public function getOrderConfirmation(){
|
| 182 |
+
$store = TealiumExtendData::$store;
|
| 183 |
+
$page = TealiumExtendData::$page;
|
| 184 |
+
|
| 185 |
+
$outputArray = array();
|
| 186 |
+
//$outputArray["custom_key"] = "value";
|
| 187 |
+
// make sure any product values are in an array
|
| 188 |
+
|
| 189 |
+
return $outputArray;
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
public function getCustomerData(){
|
| 193 |
+
$store = TealiumExtendData::$store;
|
| 194 |
+
$page = TealiumExtendData::$page;
|
| 195 |
+
|
| 196 |
+
$outputArray = array();
|
| 197 |
+
//$outputArray["custom_key"] = "value";
|
| 198 |
+
|
| 199 |
+
return $outputArray;
|
| 200 |
+
}
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
TealiumExtendData::setStore($data["store"]);
|
| 205 |
+
TealiumExtendData::setPage($data["page"]);
|
| 206 |
|
| 207 |
|
| 208 |
$udoElements = array(
|
| 209 |
+
"Home" => function(){
|
| 210 |
+
$tealiumData = new TealiumExtendData();
|
| 211 |
+
return $tealiumData->getHome();
|
| 212 |
+
},
|
| 213 |
+
"Search" => function(){
|
| 214 |
+
$tealiumData = new TealiumExtendData();
|
| 215 |
+
return $tealiumData->getSearch();
|
| 216 |
+
},
|
| 217 |
+
"Category" => function(){
|
| 218 |
+
$tealiumData = new TealiumExtendData();
|
| 219 |
+
return $tealiumData->getCategory();
|
| 220 |
+
},
|
| 221 |
+
"ProductPage" => function(){
|
| 222 |
+
$tealiumData = new TealiumExtendData();
|
| 223 |
+
return $tealiumData->getProductPage();
|
| 224 |
+
},
|
| 225 |
+
"Cart" => function(){
|
| 226 |
+
$tealiumData = new TealiumExtendData();
|
| 227 |
+
return $tealiumData->getCartPage();
|
| 228 |
+
},
|
| 229 |
+
"Confirmation" => function(){
|
| 230 |
+
$tealiumData = new TealiumExtendData();
|
| 231 |
+
return $tealiumData->getOrderConfirmation();
|
| 232 |
+
},
|
| 233 |
+
"Customer" => function(){
|
| 234 |
+
$tealiumData = new TealiumExtendData();
|
| 235 |
+
return $tealiumData->getCustomerData();
|
| 236 |
+
}
|
| 237 |
);
|
| 238 |
|
| 239 |
+
|
| 240 |
?>
|
| 241 |
</pre>
|
| 242 |
<br /><a href="javascript:false;" onclick="javascript: document.getElementById('code_example').style.display='none'">Hide</a>
|
| 250 |
<show_in_website>1</show_in_website>
|
| 251 |
<show_in_store>1</show_in_store>
|
| 252 |
</udo>
|
| 253 |
+
<external_script translate="label">
|
| 254 |
+
<label>Enable External Script Support</label>
|
| 255 |
+
<comment>
|
| 256 |
+
<![CDATA[<span class="notice">Place Tealium code in external javaScript file<br/>
|
| 257 |
+
*NOTE Order confirmation page will always load script on page
|
| 258 |
+
</span>]]>
|
| 259 |
+
</comment>
|
| 260 |
<frontend_type>select</frontend_type>
|
| 261 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 262 |
<sort_order>17</sort_order>
|
| 263 |
<show_in_default>1</show_in_default>
|
| 264 |
<show_in_website>1</show_in_website>
|
| 265 |
<show_in_store>1</show_in_store>
|
| 266 |
+
</external_script>
|
| 267 |
+
<external_script_type translate="label">
|
| 268 |
+
<label>External Script Async</label>
|
| 269 |
<comment>
|
| 270 |
+
<![CDATA[<span class="notice">Enable async loading of the external script<br />
|
| 271 |
+
!WARNING! By enabling, we can't gaurantee all of your tags will fire before the user navigates away
|
| 272 |
+
</span>]]>
|
| 273 |
</comment>
|
| 274 |
+
<frontend_type>select</frontend_type>
|
| 275 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 276 |
<sort_order>18</sort_order>
|
| 277 |
<show_in_default>1</show_in_default>
|
| 278 |
<show_in_website>1</show_in_website>
|
| 279 |
<show_in_store>1</show_in_store>
|
| 280 |
+
</external_script_type>
|
| 281 |
+
<diagnostic_enable translate="label">
|
| 282 |
+
<label>Enable Diagnostic Tag</label>
|
|
|
|
|
|
|
|
|
|
| 283 |
<frontend_type>select</frontend_type>
|
| 284 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 285 |
<sort_order>19</sort_order>
|
| 286 |
<show_in_default>1</show_in_default>
|
| 287 |
<show_in_website>1</show_in_website>
|
| 288 |
<show_in_store>1</show_in_store>
|
| 289 |
+
</diagnostic_enable>
|
| 290 |
+
<diagnostic_tag translate="label">
|
| 291 |
+
<label>Custom diagnostic tag URI path</label>
|
| 292 |
+
<comment>
|
| 293 |
+
<![CDATA[<span class="notice">Please contact your Account Manager for information about this feature</span>]]>
|
| 294 |
+
</comment>
|
| 295 |
+
<frontend_type>text</frontend_type>
|
| 296 |
+
<sort_order>20</sort_order>
|
| 297 |
+
<show_in_default>1</show_in_default>
|
| 298 |
+
<show_in_website>1</show_in_website>
|
| 299 |
+
<show_in_store>1</show_in_store>
|
| 300 |
+
</diagnostic_tag>
|
| 301 |
<help translate="label">
|
| 302 |
<label>Help Section</label>
|
| 303 |
<comment>
|
| 796 |
]]>
|
| 797 |
</comment>
|
| 798 |
<frontend_type>label</frontend_type>
|
| 799 |
+
<sort_order>30</sort_order>
|
| 800 |
<show_in_default>1</show_in_default>
|
| 801 |
<show_in_website>1</show_in_website>
|
| 802 |
<show_in_store>1</show_in_store>
|
|
File without changes
|
|
Binary file
|
|
@@ -6,6 +6,9 @@ $store = Mage::app()->getStore();
|
|
| 6 |
if (!$helper->isEnabled($store)) {
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
| 11 |
?>
|
| 6 |
if (!$helper->isEnabled($store)) {
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
+
if (!$helper->getIsExternalScript($store)){
|
| 10 |
+
$tealium = $helper->getTealiumObject($store, $this);
|
| 11 |
+
echo $tealium->render("tag");
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
?>
|
|
@@ -16,18 +16,30 @@ foreach($this->getItems() as $item) {
|
|
| 16 |
$skus[] = $item->getSku();
|
| 17 |
$names[] = $item->getName();
|
| 18 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
$udo = array(
|
| 21 |
-
page_type => "product compare",
|
| 22 |
-
product_id => implode('","', $ids),
|
| 23 |
-
product_sku => implode('","', $skus),
|
| 24 |
-
product_name => implode('","', $names)
|
| 25 |
-
);
|
| 26 |
|
| 27 |
-
|
| 28 |
-
$tealium = $helper->getTealiumObject($store, $this);
|
| 29 |
-
$tealium->pageType("Home");
|
| 30 |
-
$tealium->updateUdo($udo);
|
| 31 |
-
echo $tealium->render("udo");
|
| 32 |
echo $helper->getDiagnosticTag($store);
|
| 33 |
?>
|
| 16 |
$skus[] = $item->getSku();
|
| 17 |
$names[] = $item->getName();
|
| 18 |
}
|
| 19 |
+
|
| 20 |
+
$customData = array();
|
| 21 |
+
$customData["page_type"] = "product compare";
|
| 22 |
+
$customData["product_id"] = implode('","', $ids);
|
| 23 |
+
$customData["product_sku"] = implode('","', $skus);
|
| 24 |
+
$customData["product_name"] = implode('","', $names);
|
| 25 |
+
|
| 26 |
+
$tealium = $helper->init($store, $this, "Home")->
|
| 27 |
+
addCustomDataFromSetup($store, "Home")->
|
| 28 |
+
addCustomDataFromObject($customData)->
|
| 29 |
+
getTealiumObject();
|
| 30 |
+
|
| 31 |
+
if ($helper->getIsExternalScript($store)){
|
| 32 |
+
$syncType = "sync";
|
| 33 |
+
$externalScriptType = $helper->getExternalScriptType($store);
|
| 34 |
+
if ($externalScriptType == "sync" || $externalScriptType == "async"){
|
| 35 |
+
$syncType = $externalScriptType;
|
| 36 |
+
}
|
| 37 |
+
echo $tealium->render("full", true, $syncType);
|
| 38 |
+
}
|
| 39 |
+
else {
|
| 40 |
+
echo $tealium->render("udo");
|
| 41 |
+
}
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
echo $helper->getDiagnosticTag($store);
|
| 45 |
?>
|
|
@@ -23,16 +23,28 @@ if (empty($terms)) {
|
|
| 23 |
$terms[] = "no-criteria";
|
| 24 |
}
|
| 25 |
|
| 26 |
-
$
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
$
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
echo $helper->getDiagnosticTag($store);
|
| 38 |
?>
|
| 23 |
$terms[] = "no-criteria";
|
| 24 |
}
|
| 25 |
|
| 26 |
+
$customData = array();
|
| 27 |
+
$customData["page_type"] = "advanced search results";
|
| 28 |
+
$customData["page_type"] = "advanced search";
|
| 29 |
+
$customData["search_results"] = $this->getResultCount();
|
| 30 |
+
$customData["search_keyword"] = implode('","', $terms);
|
| 31 |
+
|
| 32 |
+
$tealium = $helper->init($store, $this, "Search")->
|
| 33 |
+
addCustomDataFromSetup($store, "Search")->
|
| 34 |
+
addCustomDataFromObject($customData)->
|
| 35 |
+
getTealiumObject();
|
| 36 |
+
|
| 37 |
+
if ($helper->getIsExternalScript($store)){
|
| 38 |
+
$syncType = "sync";
|
| 39 |
+
$externalScriptType = $helper->getExternalScriptType($store);
|
| 40 |
+
if ($externalScriptType == "sync" || $externalScriptType == "async"){
|
| 41 |
+
$syncType = $externalScriptType;
|
| 42 |
+
}
|
| 43 |
+
echo $tealium->render("full", true, $syncType);
|
| 44 |
+
}
|
| 45 |
+
else {
|
| 46 |
+
echo $tealium->render("udo");
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
echo $helper->getDiagnosticTag($store);
|
| 50 |
?>
|
|
@@ -7,8 +7,21 @@ if (!$helper->isEnabled($store)) {
|
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
-
$tealium = $helper->
|
| 11 |
-
$
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
echo $helper->getDiagnosticTag($store);
|
| 14 |
?>
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
+
$tealium = $helper->init($store, $this, "Search")->
|
| 11 |
+
addCustomDataFromSetup($store, "Search")->
|
| 12 |
+
getTealiumObject();
|
| 13 |
+
|
| 14 |
+
if ($helper->getIsExternalScript($store)){
|
| 15 |
+
$syncType = "sync";
|
| 16 |
+
$externalScriptType = $helper->getExternalScriptType($store);
|
| 17 |
+
if ($externalScriptType == "sync" || $externalScriptType == "async"){
|
| 18 |
+
$syncType = $externalScriptType;
|
| 19 |
+
}
|
| 20 |
+
echo $tealium->render("full", true, $syncType);
|
| 21 |
+
}
|
| 22 |
+
else {
|
| 23 |
+
echo $tealium->render("udo");
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
echo $helper->getDiagnosticTag($store);
|
| 27 |
?>
|
|
@@ -17,12 +17,27 @@ if( sizeof($this->getTerms()) > 0 ) {
|
|
| 17 |
$terms[] = "no-terms";
|
| 18 |
}
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
-
$tealium = $helper->getTealiumObject($store, $this);
|
| 22 |
-
$tealium->pageType("Search");
|
| 23 |
-
$tealium->updateUdo("page_type", "popular search terms");
|
| 24 |
-
$tealium->updateUdo("page_name", $this->getLayout()->getBlock('head')->getTitle());
|
| 25 |
-
$tealium->updateUdo("search_keyword", $implode('","', $terms));
|
| 26 |
-
echo $tealium->render("udo");
|
| 27 |
echo $helper->getDiagnosticTag($store);
|
| 28 |
?>
|
| 17 |
$terms[] = "no-terms";
|
| 18 |
}
|
| 19 |
|
| 20 |
+
$customData = array();
|
| 21 |
+
$customData["page_type"] = "popular search terms";
|
| 22 |
+
$customData["page_name"] = $this->getLayout()->getBlock('head')->getTitle();
|
| 23 |
+
$customData["search_keyword"] = implode('","', $terms);
|
| 24 |
+
|
| 25 |
+
$tealium = $helper->init($store, $this, "Search")->
|
| 26 |
+
addCustomDataFromSetup($store, "Search")->
|
| 27 |
+
addCustomDataFromObject($customData)->
|
| 28 |
+
getTealiumObject();
|
| 29 |
+
|
| 30 |
+
if ($helper->getIsExternalScript($store)){
|
| 31 |
+
$syncType = "sync";
|
| 32 |
+
$externalScriptType = $helper->getExternalScriptType($store);
|
| 33 |
+
if ($externalScriptType == "sync" || $externalScriptType == "async"){
|
| 34 |
+
$syncType = $externalScriptType;
|
| 35 |
+
}
|
| 36 |
+
echo $tealium->render("full", true, $syncType);
|
| 37 |
+
}
|
| 38 |
+
else {
|
| 39 |
+
echo $tealium->render("udo");
|
| 40 |
+
}
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
echo $helper->getDiagnosticTag($store);
|
| 43 |
?>
|
|
@@ -7,8 +7,21 @@ if (!$helper->isEnabled($store)) {
|
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
-
$tealium = $helper->
|
| 11 |
-
$
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
echo $helper->getDiagnosticTag($store);
|
| 14 |
?>
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
+
$tealium = $helper->init($store, $this, "Category")->
|
| 11 |
+
addCustomDataFromSetup($store, "Category")->
|
| 12 |
+
getTealiumObject();
|
| 13 |
+
|
| 14 |
+
if ($helper->getIsExternalScript($store)){
|
| 15 |
+
$syncType = "sync";
|
| 16 |
+
$externalScriptType = $helper->getExternalScriptType($store);
|
| 17 |
+
if ($externalScriptType == "sync" || $externalScriptType == "async"){
|
| 18 |
+
$syncType = $externalScriptType;
|
| 19 |
+
}
|
| 20 |
+
echo $tealium->render("full", true, $syncType);
|
| 21 |
+
}
|
| 22 |
+
else {
|
| 23 |
+
echo $tealium->render("udo");
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
echo $helper->getDiagnosticTag($store);
|
| 27 |
?>
|
|
@@ -7,8 +7,21 @@ if (!$helper->isEnabled($store)) {
|
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
-
$tealium = $helper->
|
| 11 |
-
$
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
echo $helper->getDiagnosticTag($store);
|
| 14 |
?>
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
+
$tealium = $helper->init($store, $this, "Cart")->
|
| 11 |
+
addCustomDataFromSetup($store, "Cart")->
|
| 12 |
+
getTealiumObject();
|
| 13 |
+
|
| 14 |
+
if ($helper->getIsExternalScript($store)){
|
| 15 |
+
$syncType = "sync";
|
| 16 |
+
$externalScriptType = $helper->getExternalScriptType($store);
|
| 17 |
+
if ($externalScriptType == "sync" || $externalScriptType == "async"){
|
| 18 |
+
$syncType = $externalScriptType;
|
| 19 |
+
}
|
| 20 |
+
echo $tealium->render("full", true, $syncType);
|
| 21 |
+
}
|
| 22 |
+
else {
|
| 23 |
+
echo $tealium->render("udo");
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
echo $helper->getDiagnosticTag($store);
|
| 27 |
?>
|
|
@@ -7,31 +7,66 @@ if (!$helper->isEnabled($store)) {
|
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
-
$tealium = $helper->
|
| 11 |
-
$
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
echo $helper->getDiagnosticTag($store);
|
| 14 |
$jsonUDO = $tealium->render("json");
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
echo <<<EOD
|
| 17 |
<script type="text/javascript">
|
| 18 |
document.addEventListener('DOMContentLoaded',function(){
|
| 19 |
-
Checkout
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
| 26 |
}
|
|
|
|
| 27 |
});
|
| 28 |
</script>
|
| 29 |
|
| 30 |
EOD
|
| 31 |
-
?>
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
<script type="text/javascript">
|
| 34 |
document.addEventListener('DOMContentLoaded',function(){
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
});
|
| 37 |
-
</script>
|
|
|
|
|
|
|
|
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
+
$tealium = $helper->init($store, $this, "Cart")->
|
| 11 |
+
addCustomDataFromSetup($store, "Cart")->
|
| 12 |
+
getTealiumObject();
|
| 13 |
+
|
| 14 |
+
if ($helper->getIsExternalScript($store)){
|
| 15 |
+
$syncType = "sync";
|
| 16 |
+
$externalScriptType = $helper->getExternalScriptType($store);
|
| 17 |
+
if ($externalScriptType == "sync" || $externalScriptType == "async"){
|
| 18 |
+
$syncType = $externalScriptType;
|
| 19 |
+
}
|
| 20 |
+
echo $tealium->render("full", true, $syncType);
|
| 21 |
+
}
|
| 22 |
+
else {
|
| 23 |
+
echo $tealium->render("udo");
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
echo $helper->getDiagnosticTag($store);
|
| 27 |
$jsonUDO = $tealium->render("json");
|
| 28 |
|
| 29 |
+
if (!$helper->enableOnePageCheckout($store)) {
|
| 30 |
+
return; // not enabled, no javascript inserted
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
echo <<<EOD
|
| 34 |
<script type="text/javascript">
|
| 35 |
document.addEventListener('DOMContentLoaded',function(){
|
| 36 |
+
if(!!window.Checkout){
|
| 37 |
+
Checkout.prototype.gotoSection = function(section) {
|
| 38 |
+
utag.data=$jsonUDO;
|
| 39 |
+
utag.data["page_name"] = section;
|
| 40 |
+
utag.view(utag.data);
|
| 41 |
+
section = $('opc-'+section);
|
| 42 |
+
section.addClassName('allow');
|
| 43 |
+
this.accordion.openSection(section)
|
| 44 |
+
}
|
| 45 |
}
|
| 46 |
+
|
| 47 |
});
|
| 48 |
</script>
|
| 49 |
|
| 50 |
EOD
|
|
|
|
| 51 |
|
| 52 |
+
|
| 53 |
+
?>
|
| 54 |
+
<?php
|
| 55 |
+
echo <<<EOD
|
| 56 |
<script type="text/javascript">
|
| 57 |
document.addEventListener('DOMContentLoaded',function(){
|
| 58 |
+
if (!!window.Review){
|
| 59 |
+
EOD
|
| 60 |
+
?>
|
| 61 |
+
<?php
|
| 62 |
+
echo "review = new Review('".$this->getUrl('checkout/onepage/saveOrder', array('form_key' => Mage::getSingleton('core/session')->getFormKey()))."', '".$this->getUrl('checkout/onepage/success')."', $('checkout-agreements'));";
|
| 63 |
+
?>
|
| 64 |
+
|
| 65 |
+
<?php
|
| 66 |
+
echo <<<EOD
|
| 67 |
+
}
|
| 68 |
});
|
| 69 |
+
</script>
|
| 70 |
+
EOD
|
| 71 |
+
?>
|
| 72 |
+
|
|
@@ -7,8 +7,16 @@ if (!$helper->isEnabled($store)) {
|
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
-
$tealium = $helper->
|
| 11 |
-
$
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
echo $helper->getDiagnosticTag($store);
|
| 14 |
?>
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
+
$tealium = $helper->init($store, $this, "Confirmation")->
|
| 11 |
+
addCustomDataFromSetup($store, "Confirmation")->
|
| 12 |
+
getTealiumObject();
|
| 13 |
+
|
| 14 |
+
if ($helper->getIsExternalScript($store)){
|
| 15 |
+
echo $tealium->render("full", false);
|
| 16 |
+
}
|
| 17 |
+
else {
|
| 18 |
+
echo $tealium->render("udo");
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
echo $helper->getDiagnosticTag($store);
|
| 22 |
?>
|
|
@@ -7,8 +7,21 @@ if (!$helper->isEnabled($store)) {
|
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
-
$tealium = $helper->
|
| 11 |
-
$
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
echo $helper->getDiagnosticTag($store);
|
| 14 |
?>
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
+
$tealium = $helper->init($store, $this, "Home")->
|
| 11 |
+
addCustomDataFromSetup($store, "Home")->
|
| 12 |
+
getTealiumObject();
|
| 13 |
+
|
| 14 |
+
if ($helper->getIsExternalScript($store)){
|
| 15 |
+
$syncType = "sync";
|
| 16 |
+
$externalScriptType = $helper->getExternalScriptType($store);
|
| 17 |
+
if ($externalScriptType == "sync" || $externalScriptType == "async"){
|
| 18 |
+
$syncType = $externalScriptType;
|
| 19 |
+
}
|
| 20 |
+
echo $tealium->render("full", true, $syncType);
|
| 21 |
+
}
|
| 22 |
+
else {
|
| 23 |
+
echo $tealium->render("udo");
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
echo $helper->getDiagnosticTag($store);
|
| 27 |
?>
|
|
@@ -7,9 +7,21 @@ if (!$helper->isEnabled($store)) {
|
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
$tealium = $helper->getTealiumObject($store, $this);
|
| 12 |
-
$tealium->pageType("Customer");
|
| 13 |
-
echo $tealium->render("udo");
|
| 14 |
echo $helper->getDiagnosticTag($store);
|
| 15 |
?>
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
+
$tealium = $helper->init($store, $this, "Customer")->
|
| 11 |
+
addCustomDataFromSetup($store, "Customer")->
|
| 12 |
+
getTealiumObject();
|
| 13 |
+
|
| 14 |
+
if ($helper->getIsExternalScript($store)){
|
| 15 |
+
$syncType = "sync";
|
| 16 |
+
$externalScriptType = $helper->getExternalScriptType($store);
|
| 17 |
+
if ($externalScriptType == "sync" || $externalScriptType == "async"){
|
| 18 |
+
$syncType = $externalScriptType;
|
| 19 |
+
}
|
| 20 |
+
echo $tealium->render("full", true, $syncType);
|
| 21 |
+
}
|
| 22 |
+
else {
|
| 23 |
+
echo $tealium->render("udo");
|
| 24 |
+
}
|
| 25 |
|
|
|
|
|
|
|
|
|
|
| 26 |
echo $helper->getDiagnosticTag($store);
|
| 27 |
?>
|
|
@@ -9,12 +9,31 @@ if (!$helper->isEnabled($store)) {
|
|
| 9 |
|
| 10 |
$tealium = $helper->getTealiumObject($store, $this);
|
| 11 |
if(preg_match('/checkout.+success|success.+checkout/i',$_SERVER['PHP_SELF'])){
|
| 12 |
-
$tealium->
|
|
|
|
|
|
|
| 13 |
}
|
| 14 |
else{
|
| 15 |
-
$
|
| 16 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
}
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
echo $helper->getDiagnosticTag($store);
|
| 20 |
?>
|
| 9 |
|
| 10 |
$tealium = $helper->getTealiumObject($store, $this);
|
| 11 |
if(preg_match('/checkout.+success|success.+checkout/i',$_SERVER['PHP_SELF'])){
|
| 12 |
+
$tealium = $helper->init($store, $this, "Confirmation")->
|
| 13 |
+
addCustomDataFromSetup($store, "Confirmation")->
|
| 14 |
+
getTealiumObject();
|
| 15 |
}
|
| 16 |
else{
|
| 17 |
+
$customData = array();
|
| 18 |
+
$customData["page_type"] = "generic";
|
| 19 |
+
$tealium = $helper->init($store, $this, "Home")->
|
| 20 |
+
addCustomDataFromSetup($store, "Home")->
|
| 21 |
+
addCustomDataFromObject($customData)->
|
| 22 |
+
getTealiumObject();
|
| 23 |
+
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
if ($helper->getIsExternalScript($store)){
|
| 27 |
+
$syncType = "sync";
|
| 28 |
+
$externalScriptType = $helper->getExternalScriptType($store);
|
| 29 |
+
if ($externalScriptType == "sync" || $externalScriptType == "async"){
|
| 30 |
+
$syncType = $externalScriptType;
|
| 31 |
+
}
|
| 32 |
+
echo $tealium->render("full", true, $syncType);
|
| 33 |
}
|
| 34 |
+
else {
|
| 35 |
+
echo $tealium->render("udo");
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
echo $helper->getDiagnosticTag($store);
|
| 39 |
?>
|
|
@@ -7,9 +7,24 @@ if (!$helper->isEnabled($store)) {
|
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
-
$
|
| 11 |
-
$
|
| 12 |
-
$tealium->
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
echo $helper->getDiagnosticTag($store);
|
| 15 |
?>
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
+
$customData = array();
|
| 11 |
+
$customData["page_name"] = $this->getTealiumName();
|
| 12 |
+
$tealium = $helper->init($store, $this, "Home")->
|
| 13 |
+
addCustomDataFromSetup($store, "Home")->
|
| 14 |
+
addCustomDataFromObject($customData)->
|
| 15 |
+
getTealiumObject();
|
| 16 |
+
|
| 17 |
+
if ($helper->getIsExternalScript($store)){
|
| 18 |
+
$syncType = "sync";
|
| 19 |
+
$externalScriptType = $helper->getExternalScriptType($store);
|
| 20 |
+
if ($externalScriptType == "sync" || $externalScriptType == "async"){
|
| 21 |
+
$syncType = $externalScriptType;
|
| 22 |
+
}
|
| 23 |
+
echo $tealium->render("full", true, $syncType);
|
| 24 |
+
}
|
| 25 |
+
else {
|
| 26 |
+
echo $tealium->render("udo");
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
echo $helper->getDiagnosticTag($store);
|
| 30 |
?>
|
|
@@ -7,12 +7,21 @@ if (!$helper->isEnabled($store)) {
|
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
-
$
|
| 11 |
-
$
|
|
|
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
$tealium = $helper->getTealiumObject($store, $this);
|
| 15 |
-
$tealium->pageType("ProductPage");
|
| 16 |
-
echo $tealium->render("udo");
|
| 17 |
echo $helper->getDiagnosticTag($store);
|
| 18 |
?>
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
+
$tealium = $helper->init($store, $this, "ProductPage")->
|
| 11 |
+
addCustomDataFromSetup($store, "ProductPage")->
|
| 12 |
+
getTealiumObject();
|
| 13 |
|
| 14 |
+
if ($helper->getIsExternalScript($store)){
|
| 15 |
+
$syncType = "sync";
|
| 16 |
+
$externalScriptType = $helper->getExternalScriptType($store);
|
| 17 |
+
if ($externalScriptType == "sync" || $externalScriptType == "async"){
|
| 18 |
+
$syncType = $externalScriptType;
|
| 19 |
+
}
|
| 20 |
+
echo $tealium->render("full", true, $syncType);
|
| 21 |
+
}
|
| 22 |
+
else {
|
| 23 |
+
echo $tealium->render("udo");
|
| 24 |
+
}
|
| 25 |
|
|
|
|
|
|
|
|
|
|
| 26 |
echo $helper->getDiagnosticTag($store);
|
| 27 |
?>
|
|
@@ -9,26 +9,36 @@ if (!$helper->isEnabled($store)) {
|
|
| 9 |
|
| 10 |
$_product_id = $this->getProductId();
|
| 11 |
$_category_id = $this->getCategoryId();
|
| 12 |
-
|
| 13 |
$_product = Mage::getModel('catalog/product')->load($_product_id);
|
| 14 |
$_category = Mage::getModel('catalog/category')->load($_category_id);
|
| 15 |
|
| 16 |
-
$
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
$tealium = $helper->getTealiumObject($store, $this);
|
| 30 |
-
$tealium->pageType("ProductPage");
|
| 31 |
-
$tealium->updateUdo($udo);
|
| 32 |
-
echo $tealium->render("udo");
|
| 33 |
echo $helper->getDiagnosticTag($store);
|
| 34 |
?>
|
| 9 |
|
| 10 |
$_product_id = $this->getProductId();
|
| 11 |
$_category_id = $this->getCategoryId();
|
|
|
|
| 12 |
$_product = Mage::getModel('catalog/product')->load($_product_id);
|
| 13 |
$_category = Mage::getModel('catalog/category')->load($_category_id);
|
| 14 |
|
| 15 |
+
$customData = array();
|
| 16 |
+
$customData["page_name"] = $_product->getName();
|
| 17 |
+
$customData["page_type"] = "product send";
|
| 18 |
+
$customData["product_id"] = $_product->getId();
|
| 19 |
+
$customData["product_sku"] = $_product->getSku();
|
| 20 |
+
$customData["product_name"] = $_product->getName();
|
| 21 |
+
$customData["product_brand"] = $_product->getBrand();
|
| 22 |
+
$customData["product_category"] = $_category ? $_category->getName() : 'no_category';
|
| 23 |
+
$customData["product_unit_price"] = number_format($_product->getSpecialPrice()?:"",2,"");
|
| 24 |
+
$customData["product_list_price"] = number_format($_product->getPrice()?:"",2,"");
|
| 25 |
+
|
| 26 |
+
$tealium = $helper->init($store, $this, "ProductPage")->
|
| 27 |
+
addCustomDataFromSetup($store, "Home")->
|
| 28 |
+
addCustomDataFromObject($customData)->
|
| 29 |
+
getTealiumObject();
|
| 30 |
|
| 31 |
+
if ($helper->getIsExternalScript($store)){
|
| 32 |
+
$syncType = "sync";
|
| 33 |
+
$externalScriptType = $helper->getExternalScriptType($store);
|
| 34 |
+
if ($externalScriptType == "sync" || $externalScriptType == "async"){
|
| 35 |
+
$syncType = $externalScriptType;
|
| 36 |
+
}
|
| 37 |
+
echo $tealium->render("full", true, $syncType);
|
| 38 |
+
}
|
| 39 |
+
else {
|
| 40 |
+
echo $tealium->render("udo");
|
| 41 |
+
}
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
echo $helper->getDiagnosticTag($store);
|
| 44 |
?>
|
|
@@ -7,8 +7,21 @@ if (!$helper->isEnabled($store)) {
|
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
-
$tealium = $helper->
|
| 11 |
-
$
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
echo $helper->getDiagnosticTag($store);
|
| 14 |
?>
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
+
$tealium = $helper->init($store, $this, "Home")->
|
| 11 |
+
addCustomDataFromSetup($store, "Home")->
|
| 12 |
+
getTealiumObject();
|
| 13 |
+
|
| 14 |
+
if ($helper->getIsExternalScript($store)){
|
| 15 |
+
$syncType = "sync";
|
| 16 |
+
$externalScriptType = $helper->getExternalScriptType($store);
|
| 17 |
+
if ($externalScriptType == "sync" || $externalScriptType == "async"){
|
| 18 |
+
$syncType = $externalScriptType;
|
| 19 |
+
}
|
| 20 |
+
echo $tealium->render("full", true, $syncType);
|
| 21 |
+
}
|
| 22 |
+
else {
|
| 23 |
+
echo $tealium->render("udo");
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
echo $helper->getDiagnosticTag($store);
|
| 27 |
?>
|
|
@@ -17,11 +17,27 @@ if( sizeof($this->getTags()) > 0 ) {
|
|
| 17 |
$tags[] = "no-tags";
|
| 18 |
}
|
| 19 |
|
| 20 |
-
$
|
| 21 |
-
$
|
| 22 |
-
$
|
| 23 |
-
$
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
echo $helper->getDiagnosticTag($store);
|
| 27 |
?>
|
| 17 |
$tags[] = "no-tags";
|
| 18 |
}
|
| 19 |
|
| 20 |
+
$customData = array();
|
| 21 |
+
$customData["page_type"] = "tag list";
|
| 22 |
+
$customData["page_name"] = $this->getLayout()->getBlock('head')->getTitle();
|
| 23 |
+
$customData["search_keyword"] = implode('","', $tags);
|
| 24 |
+
|
| 25 |
+
$tealium = $helper->init($store, $this, "Search")->
|
| 26 |
+
addCustomDataFromSetup($store, "Search")->
|
| 27 |
+
addCustomDataFromObject($customData)->
|
| 28 |
+
getTealiumObject();
|
| 29 |
+
|
| 30 |
+
if ($helper->getIsExternalScript($store)){
|
| 31 |
+
$syncType = "sync";
|
| 32 |
+
$externalScriptType = $helper->getExternalScriptType($store);
|
| 33 |
+
if ($externalScriptType == "sync" || $externalScriptType == "async"){
|
| 34 |
+
$syncType = $externalScriptType;
|
| 35 |
+
}
|
| 36 |
+
echo $tealium->render("full", true, $syncType);
|
| 37 |
+
}
|
| 38 |
+
else {
|
| 39 |
+
echo $tealium->render("udo");
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
echo $helper->getDiagnosticTag($store);
|
| 43 |
?>
|
|
@@ -7,10 +7,26 @@ if (!$helper->isEnabled($store)) {
|
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
-
$
|
| 11 |
-
$
|
| 12 |
-
$
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
echo $helper->getDiagnosticTag($store);
|
| 16 |
?>
|
| 7 |
return; // not enabled, no javascript inserted
|
| 8 |
}
|
| 9 |
|
| 10 |
+
$customData = array();
|
| 11 |
+
$customData["page_type"] = "tag product list";
|
| 12 |
+
$customData["page_name"] = $this->getLayout()->getBlock('head')->getTitle();
|
| 13 |
+
|
| 14 |
+
$tealium = $helper->init($store, $this, "Search")->
|
| 15 |
+
addCustomDataFromSetup($store, "Search")->
|
| 16 |
+
addCustomDataFromObject($customData)->
|
| 17 |
+
getTealiumObject();
|
| 18 |
+
|
| 19 |
+
if ($helper->getIsExternalScript($store)){
|
| 20 |
+
$syncType = "sync";
|
| 21 |
+
$externalScriptType = $helper->getExternalScriptType($store);
|
| 22 |
+
if ($externalScriptType == "sync" || $externalScriptType == "async"){
|
| 23 |
+
$syncType = $externalScriptType;
|
| 24 |
+
}
|
| 25 |
+
echo $tealium->render("full", true, $syncType);
|
| 26 |
+
}
|
| 27 |
+
else {
|
| 28 |
+
echo $tealium->render("udo");
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
echo $helper->getDiagnosticTag($store);
|
| 32 |
?>
|
|
File without changes
|
|
Binary file
|
|
File without changes
|
|
@@ -1,258 +1,218 @@
|
|
| 1 |
-
<?php
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
| 19 |
-
// return UDO and async utag.js call in HTML format
|
| 20 |
-
// print $tealium->render();
|
| 21 |
-
// alernate: print $tealium;
|
| 22 |
-
//
|
| 23 |
-
// to print only tag: print $tealium->render("tag");
|
| 24 |
-
// to print only UDO: print $tealium->render("udo");
|
| 25 |
-
// to print only json object: print $tealium->render("json");
|
| 26 |
-
|
| 27 |
-
}
|
| 28 |
-
class Tealium implements TealiumInterface
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
))
|
| 35 |
-
|
| 36 |
-
'account' => array(
|
| 37 |
-
'type' => "string",
|
| 38 |
-
'read' => true,
|
| 39 |
-
'write' => false
|
| 40 |
-
) ,
|
| 41 |
-
'profile' => array(
|
| 42 |
-
'type' => "string",
|
| 43 |
-
'read' => true,
|
| 44 |
-
'write' => false
|
| 45 |
-
) ,
|
| 46 |
-
'target' => array(
|
| 47 |
-
'type' => "string",
|
| 48 |
-
'read' => true,
|
| 49 |
-
'write' => false
|
| 50 |
-
) ,
|
| 51 |
-
'udo' => array(
|
| 52 |
-
'type' => "array",
|
| 53 |
-
'read' => true,
|
| 54 |
-
'write' => false
|
| 55 |
-
) ,
|
| 56 |
-
'access' => array(
|
| 57 |
-
'type' => "array",
|
| 58 |
-
'read' => false,
|
| 59 |
-
'write' => false
|
| 60 |
-
)
|
| 61 |
-
);
|
| 62 |
-
require 'TealiumInit.php';
|
| 63 |
-
|
| 64 |
-
$this->udoElements = $udoElements;
|
| 65 |
-
$this->account = $accountInit;
|
| 66 |
-
$this->profile = $profileInit;
|
| 67 |
-
$this->target = $targetInit;
|
| 68 |
-
$this->udo = $this->udoElements[$pageType] ? : ($pageType == null ? $pageType : array(
|
| 69 |
-
'page_type' => $pageType
|
| 70 |
-
));
|
| 71 |
-
}
|
| 72 |
-
public function __toString() {
|
| 73 |
-
return $this->render();
|
| 74 |
}
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
}
|
| 87 |
-
return $this->render();
|
| 88 |
-
}
|
| 89 |
-
public function __set($name, $value){
|
| 90 |
-
if(!$this->{$name}){
|
| 91 |
-
$this->{$name} = $value;
|
| 92 |
-
}
|
| 93 |
-
elseif($this->{$name} && $this->access[$name]){
|
| 94 |
-
if($this->access[$name]['write']){
|
| 95 |
-
settype($value, $this->access[$name]['type']);
|
| 96 |
-
$this->{$name} = $value;
|
| 97 |
-
}
|
| 98 |
-
}
|
| 99 |
-
elseif($this->{$name}) {
|
| 100 |
-
$this->{$name} = $value;
|
| 101 |
-
}
|
| 102 |
}
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
}
|
| 111 |
-
}
|
| 112 |
-
elseif($this->{$name}) {
|
| 113 |
-
return $this->{$name};
|
| 114 |
-
}
|
| 115 |
-
elseif(!$this->{$name}) {
|
| 116 |
-
return "no value set for property: $name";
|
| 117 |
-
}
|
| 118 |
}
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
$this->udoElements[$pageType][$key] = $value;
|
| 127 |
-
}
|
| 128 |
-
}
|
| 129 |
-
}
|
| 130 |
-
elseif ($objectOrKey != "") {
|
| 131 |
-
if (!$pageType) {
|
| 132 |
-
$this->udo[$objectOrKey] = $value;
|
| 133 |
-
}
|
| 134 |
-
else {
|
| 135 |
-
$this->udoElements[$pageType][$objectOrKey] = $value;
|
| 136 |
-
}
|
| 137 |
-
}
|
| 138 |
-
return $this->udo;
|
| 139 |
}
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
}
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
<!-- Tealium Universal Data Object / Data Layer -->
|
| 151 |
<script type="text/javascript">
|
| 152 |
-
|
| 153 |
</script>
|
| 154 |
<!-- ****************************************** -->
|
| 155 |
EOD;
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
(function(a,b,c,d){
|
| 161 |
a='//tags.tiqcdn.com/utag/$this->account/$this->profile/$this->target/utag.js';
|
| 162 |
b=document;c='script';d=b.createElement(c);d.src=a;d.type='text/java'+c;d.
|
| 163 |
async=true;
|
| 164 |
a=b.getElementsByTagName(c)[0];a.parentNode.insertBefore(d,a);
|
| 165 |
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
</script>
|
| 167 |
<!-- ************************************* -->
|
| 168 |
EOD;
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
<!-- Tealium Universal Data Object / Data Layer -->
|
| 192 |
<!-- Account, profile, or environment was not declared in
|
| 193 |
object Tealium(\$account, \$profile, \$target, \$pageType) -->
|
| 194 |
EOD;
|
| 195 |
-
|
| 196 |
-
}
|
| 197 |
-
return $renderedCode;
|
| 198 |
}
|
|
|
|
|
|
|
|
|
|
| 199 |
}
|
|
|
|
| 200 |
// Open source alternative for json_encode for PHP < 5.4 ***********************************************
|
| 201 |
-
if (!function_exists('json_encode')) {
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
$
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
|
|
|
|
|
|
| 255 |
}
|
|
|
|
| 256 |
}
|
| 257 |
// ***********************************************************************************************************
|
| 258 |
|
| 1 |
+
<?php
|
| 2 |
|
| 3 |
+
class Tealium {
|
| 4 |
+
|
| 5 |
+
private $account;
|
| 6 |
+
private $profile;
|
| 7 |
+
private $target;
|
| 8 |
+
private $udo;
|
| 9 |
+
private $udoElements;
|
| 10 |
+
private $customUdo;
|
| 11 |
+
|
| 12 |
+
public function __construct( $accountInit = false,
|
| 13 |
+
$profileInit = false,
|
| 14 |
+
$targetInit = false,
|
| 15 |
+
$pageType = "Home",
|
| 16 |
+
&$data = array()) {
|
| 17 |
|
| 18 |
+
require_once 'TealiumInit.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
$this->udoElements = $udoElements;
|
| 21 |
+
$this->account = $accountInit;
|
| 22 |
+
$this->profile = $profileInit;
|
| 23 |
+
$this->target = $targetInit;
|
| 24 |
+
if( !($this->udo = $this->udoElements[$pageType]) && $pageType != null ){
|
| 25 |
+
$this->udo = array( 'page_type' => $pageType );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
}
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
public function updateUdo($objectOrKey = "", $value = "") {
|
| 30 |
+
|
| 31 |
+
$udoObject = $this->udo;
|
| 32 |
+
if ($udoObject instanceof Closure) {
|
| 33 |
+
$udo = $udoObject();
|
| 34 |
+
} elseif (is_array ( $udoObject )) {
|
| 35 |
+
$udo = $udoObject;
|
| 36 |
+
} else {
|
| 37 |
+
$udo = "{}";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
}
|
| 39 |
+
|
| 40 |
+
if ($objectOrKey instanceof Closure) {
|
| 41 |
+
$updatedUdo = $objectOrKey();
|
| 42 |
+
} elseif (is_array ( $objectOrKey )) {
|
| 43 |
+
$updatedUdo = $objectOrKey();
|
| 44 |
+
} else {
|
| 45 |
+
$updatedUdo = "{}";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
}
|
| 47 |
+
|
| 48 |
+
if ( is_array( $updatedUdo ) ) {
|
| 49 |
+
foreach ( $updatedUdo as $objectKey => $objectValue ) {
|
| 50 |
+
$udo[$objectKey] = $objectValue;
|
| 51 |
+
}
|
| 52 |
+
} elseif ($objectOrKey != "") {
|
| 53 |
+
$udo[$objectOrKey] = $value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
}
|
| 55 |
+
|
| 56 |
+
$this->udo = $udo;
|
| 57 |
+
|
| 58 |
+
return $this->udo;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
public function setCustomUdo($udo){
|
| 62 |
+
$this->customUdo = $udo;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
public function pageType($pageType = "Home") {
|
| 66 |
+
if( !($this->udo = $this->udoElements[$pageType]) && $pageType != null ){
|
| 67 |
+
$this->udo = array( 'page_type' => $pageType );
|
| 68 |
}
|
| 69 |
+
}
|
| 70 |
+
public function render($type = null, $external = false, $sync = "sync") {
|
| 71 |
+
|
| 72 |
+
if ( !($_REQUEST ["tealium_api"] && $_REQUEST ["tealium_api"] == "true") && $external) {
|
| 73 |
+
$type = "udo";
|
| 74 |
+
$is_async = ($sync == "sync") ? "" : "async";
|
| 75 |
+
$udo = "<script type=\"text/javascript\" src=\"";
|
| 76 |
+
$udo .= $_SERVER["REQUEST_URI"];
|
| 77 |
+
if ($_SERVER["QUERY_STRING"]){
|
| 78 |
+
$udo .= "&";
|
| 79 |
+
}
|
| 80 |
+
else {
|
| 81 |
+
$udo .= "?";
|
| 82 |
+
}
|
| 83 |
+
$udo .= "tealium_api=true\" $is_async></script>";
|
| 84 |
+
}
|
| 85 |
+
else {
|
| 86 |
+
if (isset($this->customUdo)){
|
| 87 |
+
$this->updateUdo($this->customUdo);
|
| 88 |
+
}
|
| 89 |
+
$udoObject = $this->udo;
|
| 90 |
+
if ($udoObject instanceof Closure) {
|
| 91 |
+
$udoJson = json_encode ( $udoObject() );
|
| 92 |
+
} elseif (is_array ( $udoObject )) {
|
| 93 |
+
$udoJson = json_encode ( $udoObject );
|
| 94 |
+
} else {
|
| 95 |
+
$udoJson = "{}";
|
| 96 |
+
}
|
| 97 |
+
$udoJs = "utag_data = $udoJson;";
|
| 98 |
+
|
| 99 |
+
$udo = <<<EOD
|
| 100 |
<!-- Tealium Universal Data Object / Data Layer -->
|
| 101 |
<script type="text/javascript">
|
| 102 |
+
$udoJs
|
| 103 |
</script>
|
| 104 |
<!-- ****************************************** -->
|
| 105 |
EOD;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
// Render Tealium tag in javaScript
|
| 109 |
+
$insert_tag = <<<EOD
|
| 110 |
(function(a,b,c,d){
|
| 111 |
a='//tags.tiqcdn.com/utag/$this->account/$this->profile/$this->target/utag.js';
|
| 112 |
b=document;c='script';d=b.createElement(c);d.src=a;d.type='text/java'+c;d.
|
| 113 |
async=true;
|
| 114 |
a=b.getElementsByTagName(c)[0];a.parentNode.insertBefore(d,a);
|
| 115 |
})();
|
| 116 |
+
EOD;
|
| 117 |
+
$tag = <<<EOD
|
| 118 |
+
<!-- Async Load of Tealium utag.js library -->
|
| 119 |
+
<script type="text/javascript">
|
| 120 |
+
$insert_tag
|
| 121 |
</script>
|
| 122 |
<!-- ************************************* -->
|
| 123 |
EOD;
|
| 124 |
+
if ($_REQUEST["tealium_api"] && $_REQUEST["tealium_api"] == "true") {
|
| 125 |
+
$tag = $insert_tag . "\n//TEALIUM_END\n";
|
| 126 |
+
$udo = "//TEALIUM_START\n" . $udoJs;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
// Determine what code to return
|
| 130 |
+
if ($this->account && $this->profile && $this->target) {
|
| 131 |
+
if ($type == "tag") {
|
| 132 |
+
$renderedCode = $tag;
|
| 133 |
+
} elseif ($type == "udo") {
|
| 134 |
+
$renderedCode = $udo;
|
| 135 |
+
} elseif ($type == "json") {
|
| 136 |
+
$renderedCode = $udoJson;
|
| 137 |
+
} else {
|
| 138 |
+
$renderedCode = $udo . "\n" . $tag;
|
| 139 |
+
}
|
| 140 |
+
} else {
|
| 141 |
+
if ($this->udo != null) {
|
| 142 |
+
$renderedCode = $udo;
|
| 143 |
+
} else {
|
| 144 |
+
// Render instructions if Tealium Object was not used correctly
|
| 145 |
+
$renderedCode = <<<EOD
|
| 146 |
<!-- Tealium Universal Data Object / Data Layer -->
|
| 147 |
<!-- Account, profile, or environment was not declared in
|
| 148 |
object Tealium(\$account, \$profile, \$target, \$pageType) -->
|
| 149 |
EOD;
|
| 150 |
+
}
|
|
|
|
|
|
|
| 151 |
}
|
| 152 |
+
|
| 153 |
+
return $renderedCode;
|
| 154 |
+
}
|
| 155 |
}
|
| 156 |
+
|
| 157 |
// Open source alternative for json_encode for PHP < 5.4 ***********************************************
|
| 158 |
+
if (! function_exists ( 'json_encode' )) {
|
| 159 |
+
function json_encode($a = false) {
|
| 160 |
+
if (is_null ( $a ))
|
| 161 |
+
return 'null';
|
| 162 |
+
if ($a === false)
|
| 163 |
+
return 'false';
|
| 164 |
+
if ($a === true)
|
| 165 |
+
return 'true';
|
| 166 |
+
if (is_scalar ( $a )) {
|
| 167 |
+
if (is_float ( $a )) {
|
| 168 |
+
// Always use "." for floats.
|
| 169 |
+
return floatval ( str_replace ( ",", ".", strval ( $a ) ) );
|
| 170 |
+
}
|
| 171 |
+
if (is_string ( $a )) {
|
| 172 |
+
static $jsonReplaces = array (
|
| 173 |
+
array (
|
| 174 |
+
"\\",
|
| 175 |
+
"/",
|
| 176 |
+
"\n",
|
| 177 |
+
"\t",
|
| 178 |
+
"\r",
|
| 179 |
+
"\b",
|
| 180 |
+
"\f",
|
| 181 |
+
'"'
|
| 182 |
+
),
|
| 183 |
+
array (
|
| 184 |
+
'\\\\',
|
| 185 |
+
'\\/',
|
| 186 |
+
'\\n',
|
| 187 |
+
'\\t',
|
| 188 |
+
'\\r',
|
| 189 |
+
'\\b',
|
| 190 |
+
'\\f',
|
| 191 |
+
'\"'
|
| 192 |
+
)
|
| 193 |
+
);
|
| 194 |
+
return '"' . str_replace ( $jsonReplaces [0], $jsonReplaces [1], $a ) . '"';
|
| 195 |
+
} else
|
| 196 |
+
return $a;
|
| 197 |
+
}
|
| 198 |
+
$isList = true;
|
| 199 |
+
for($i = 0, reset ( $a ); $i < count ( $a ); $i ++, next ( $a )) {
|
| 200 |
+
if (key ( $a ) !== $i) {
|
| 201 |
+
$isList = false;
|
| 202 |
+
break;
|
| 203 |
+
}
|
| 204 |
+
}
|
| 205 |
+
$result = array ();
|
| 206 |
+
if ($isList) {
|
| 207 |
+
foreach ( $a as $v )
|
| 208 |
+
$result [] = json_encode ( $v );
|
| 209 |
+
return '[' . join ( ',', $result ) . ']';
|
| 210 |
+
} else {
|
| 211 |
+
foreach ( $a as $k => $v )
|
| 212 |
+
$result [] = json_encode ( $k ) . ':' . json_encode ( $v );
|
| 213 |
+
return '{' . join ( ',', $result ) . '}';
|
| 214 |
}
|
| 215 |
+
}
|
| 216 |
}
|
| 217 |
// ***********************************************************************************************************
|
| 218 |
|
|
@@ -1,70 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
include 'Tealium.php';
|
| 3 |
-
|
| 4 |
-
// Each action corresponds to a method and renders accordingly.
|
| 5 |
-
// if attempting to use an action not defined in this array it will display the help output
|
| 6 |
-
// as long as "help => true" is set, "help => false" will only return "action not found"
|
| 7 |
-
|
| 8 |
-
$actions = array(
|
| 9 |
-
'render' => true,
|
| 10 |
-
'tag' => true,
|
| 11 |
-
'udo' => true,
|
| 12 |
-
'help' => true
|
| 13 |
-
); // setting any of these to false will disable that action
|
| 14 |
-
|
| 15 |
-
$action = ($_REQUEST['action'] && preg_match('/[.\-\w\d]+/',$_REQUEST['action'])) ? $_REQUEST['action'] : "help";
|
| 16 |
-
$account = ($_REQUEST['account'] && preg_match('/[.\-\w\d]+/',$_REQUEST['account'])) ? $_REQUEST['account'] : false;
|
| 17 |
-
$profile = ($_REQUEST['profile'] && preg_match('/[.\-\w\d]+/',$_REQUEST['profile'])) ? $_REQUEST['profile'] : false;
|
| 18 |
-
$target = ($_REQUEST['target'] && preg_match('/[.\-\w\d]+/',$_REQUEST['target'])) ? $_REQUEST['target'] : false;
|
| 19 |
-
$pageType = ($_REQUEST['page_type'] && preg_match('/[.\-\w\d]+/',$_REQUEST['page_type'])) ? $_REQUEST['page_type'] : "Home";
|
| 20 |
-
echo $action;
|
| 21 |
-
if ($actions[$action]) {
|
| 22 |
-
header('Content-type: text/html');
|
| 23 |
-
$action();
|
| 24 |
-
}
|
| 25 |
-
else {
|
| 26 |
-
header('Content-type: text/html');
|
| 27 |
-
if ($action['help']){
|
| 28 |
-
help();
|
| 29 |
-
}
|
| 30 |
-
else {
|
| 31 |
-
echo "action not found";
|
| 32 |
-
}
|
| 33 |
-
}
|
| 34 |
-
function render()
|
| 35 |
-
{
|
| 36 |
-
global $account, $profile, $target, $pageType;
|
| 37 |
-
$tealium = new Tealium($account, $profile, $target, $pageType);
|
| 38 |
-
echo $tealium;
|
| 39 |
-
}
|
| 40 |
-
function tag()
|
| 41 |
-
{
|
| 42 |
-
global $account, $profile, $target;
|
| 43 |
-
$tealium = new Tealium($account, $profile, $target, null);
|
| 44 |
-
echo $tealium;
|
| 45 |
-
}
|
| 46 |
-
function udo()
|
| 47 |
-
{
|
| 48 |
-
global $pageType;
|
| 49 |
-
$tealium = new Tealium(null, null, null, $pageType);
|
| 50 |
-
echo $tealium->udo;
|
| 51 |
-
}
|
| 52 |
-
function help()
|
| 53 |
-
{
|
| 54 |
-
echo <<<EOD
|
| 55 |
-
<!-- Tealium not implemented correctly
|
| 56 |
-
send GET/POST with following parameters:
|
| 57 |
-
action:
|
| 58 |
-
render -> will return UDO and async tag - requires account,profile,target,page_type -,
|
| 59 |
-
tag -> will return async tag only - requires account,profile,target -,
|
| 60 |
-
udo -> will reyrn UDO only - requires page_type -,
|
| 61 |
-
|
| 62 |
-
acount: name of tealium account (.-A-Z1-10),
|
| 63 |
-
profile: name of tealium profile (.-A-Z1-10),
|
| 64 |
-
target: target environment [dev,qa,prod,custom] (.-A-Z1-10)
|
| 65 |
-
page_type: UDO page_type to return [Home, Search, Category, ...] (.-A-Z1-10)
|
| 66 |
-
-->
|
| 67 |
-
|
| 68 |
-
EOD;
|
| 69 |
-
}
|
| 70 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class TealiumExtendData {
|
| 4 |
+
private static $store;
|
| 5 |
+
private static $page;
|
| 6 |
+
|
| 7 |
+
public static function setStore($store){
|
| 8 |
+
TealiumExtendData::$store = $store;
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
public static function setPage($page){
|
| 12 |
+
TealiumExtendData::$page = $page;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
public function getHome(){
|
| 16 |
+
$store = TealiumExtendData::$store;
|
| 17 |
+
$page = TealiumExtendData::$page;
|
| 18 |
+
|
| 19 |
+
$outputArray = array();
|
| 20 |
+
//$outputArray['custom_key'] = "value";
|
| 21 |
+
|
| 22 |
+
return $outputArray;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
public function getSearch(){
|
| 26 |
+
$store = TealiumExtendData::$store;
|
| 27 |
+
$page = TealiumExtendData::$page;
|
| 28 |
+
|
| 29 |
+
$outputArray = array();
|
| 30 |
+
//$outputArray['custom_key'] = "value";
|
| 31 |
+
|
| 32 |
+
return $outputArray;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
public function getCategory(){
|
| 36 |
+
$store = TealiumExtendData::$store;
|
| 37 |
+
$page = TealiumExtendData::$page;
|
| 38 |
+
|
| 39 |
+
$outputArray = array();
|
| 40 |
+
//$outputArray['custom_key'] = "value";
|
| 41 |
+
|
| 42 |
+
return $outputArray;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
public function getProductPage(){
|
| 46 |
+
$store = TealiumExtendData::$store;
|
| 47 |
+
$page = TealiumExtendData::$page;
|
| 48 |
+
|
| 49 |
+
$outputArray = array();
|
| 50 |
+
//$outputArray['custom_key'] = "value";
|
| 51 |
+
// make sure any product values are in an array
|
| 52 |
+
|
| 53 |
+
return $outputArray;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
public function getCartPage() {
|
| 57 |
+
$store = TealiumExtendData::$store;
|
| 58 |
+
$page = TealiumExtendData::$page;
|
| 59 |
+
|
| 60 |
+
$outputArray = array();
|
| 61 |
+
//$outputArray['custom_key'] = "value";
|
| 62 |
+
// make sure any product values are in an array
|
| 63 |
+
|
| 64 |
+
return $outputArray;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
public function getOrderConfirmation(){
|
| 68 |
+
$store = TealiumExtendData::$store;
|
| 69 |
+
$page = TealiumExtendData::$page;
|
| 70 |
+
|
| 71 |
+
$outputArray = array();
|
| 72 |
+
//$outputArray['custom_key'] = "value";
|
| 73 |
+
// make sure any product values are in an array
|
| 74 |
+
|
| 75 |
+
return $outputArray;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
public function getCustomerData(){
|
| 79 |
+
$store = TealiumExtendData::$store;
|
| 80 |
+
$page = TealiumExtendData::$page;
|
| 81 |
+
|
| 82 |
+
$outputArray = array();
|
| 83 |
+
//$outputArray['custom_key'] = "value";
|
| 84 |
+
|
| 85 |
+
return $outputArray;
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
TealiumExtendData::setStore($data["store"]);
|
| 91 |
+
TealiumExtendData::setPage($data["page"]);
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
$udoElements = array(
|
| 95 |
+
'Home' => function(){
|
| 96 |
+
$tealiumData = new TealiumExtendData();
|
| 97 |
+
return $tealiumData->getHome();
|
| 98 |
+
},
|
| 99 |
+
'Search' => function(){
|
| 100 |
+
$tealiumData = new TealiumExtendData();
|
| 101 |
+
return $tealiumData->getSearch();
|
| 102 |
+
},
|
| 103 |
+
'Category' => function(){
|
| 104 |
+
$tealiumData = new TealiumExtendData();
|
| 105 |
+
return $tealiumData->getCategory();
|
| 106 |
+
},
|
| 107 |
+
'ProductPage' => function(){
|
| 108 |
+
$tealiumData = new TealiumExtendData();
|
| 109 |
+
return $tealiumData->getProductPage();
|
| 110 |
+
},
|
| 111 |
+
'Cart' => function(){
|
| 112 |
+
$tealiumData = new TealiumExtendData();
|
| 113 |
+
return $tealiumData->getCartPage();
|
| 114 |
+
},
|
| 115 |
+
'Confirmation' => function(){
|
| 116 |
+
$tealiumData = new TealiumExtendData();
|
| 117 |
+
return $tealiumData->getOrderConfirmation();
|
| 118 |
+
},
|
| 119 |
+
'Customer' => function(){
|
| 120 |
+
$tealiumData = new TealiumExtendData();
|
| 121 |
+
return $tealiumData->getCustomerData();
|
| 122 |
+
}
|
| 123 |
+
);
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
?>
|
| 127 |
+
|
|
@@ -1,241 +1,301 @@
|
|
| 1 |
<?php
|
| 2 |
// TealiumInit.php var definition file
|
| 3 |
// Replace $STRING or $ARRAY with your server side variable reference unique to that key
|
| 4 |
-
$store = $data["store"];
|
| 5 |
-
$page = $data["page"];
|
| 6 |
-
$STRING = "";
|
| 7 |
-
$ARRAY = array();
|
| 8 |
|
| 9 |
-
|
| 10 |
-
$
|
| 11 |
-
$
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
$
|
| 23 |
-
$
|
| 24 |
-
|
| 25 |
-
$
|
| 26 |
-
$
|
| 27 |
-
$
|
| 28 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
if (Mage::
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
}
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
$udoElements = array(
|
| 107 |
-
'Home' =>
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
'page_section_name' => $STRING ?: "", //"Men's",
|
| 136 |
-
'page_category_name' => $STRING ?: "", //"Clothing",
|
| 137 |
-
'page_subcategory_name' => $STRING ?: "", //"Shorts",
|
| 138 |
-
// THE FOLLOWING NEEDS TO BE MATCHED ARRAYS (SAME NUMBER OF ELEMENTS)
|
| 139 |
-
'product_id' => $page->getProduct() ? (array(
|
| 140 |
-
$page->getProduct()->getId()
|
| 141 |
-
) ?: array(
|
| 142 |
-
""
|
| 143 |
-
)) : array(
|
| 144 |
-
""
|
| 145 |
-
), //array("5225415241111"),
|
| 146 |
-
'product_sku' => $page->getProduct() ? (array(
|
| 147 |
-
$page->getProduct()->getSku()
|
| 148 |
-
) ?: array(
|
| 149 |
-
""
|
| 150 |
-
)) : array(
|
| 151 |
-
""
|
| 152 |
-
), //array("42526"),
|
| 153 |
-
'product_name' => $page->getProduct() ? (array(
|
| 154 |
-
$page->getProduct()->getName()
|
| 155 |
-
) ?: array(
|
| 156 |
-
""
|
| 157 |
-
)) : array(
|
| 158 |
-
""
|
| 159 |
-
), //array("Dr. Denim Chase Check Cargo Short"),
|
| 160 |
-
'product_brand' => $page->getProduct() ? (array(
|
| 161 |
-
$page->getProduct()->getBrand()
|
| 162 |
-
) ?: array(
|
| 163 |
-
""
|
| 164 |
-
)) : array(
|
| 165 |
-
""
|
| 166 |
-
), //array("Dr. Denim"),
|
| 167 |
-
'product_category' => array(
|
| 168 |
-
Mage::registry('current_category') ? Mage::registry('current_category')->getName() : 'no_category'
|
| 169 |
-
) ?: array(
|
| 170 |
-
""
|
| 171 |
-
), //array("Shorts"),
|
| 172 |
-
'product_unit_price' => $page->getProduct() ? (array(
|
| 173 |
-
number_format($page->getProduct()->getSpecialPrice(), 2)
|
| 174 |
-
) ?: array(
|
| 175 |
-
""
|
| 176 |
-
)) : array(
|
| 177 |
-
""
|
| 178 |
-
), //array("11.99"),
|
| 179 |
-
'product_list_price' => $page->getProduct() ? (array(
|
| 180 |
-
number_format($page->getProduct()->getPrice(), 2)
|
| 181 |
-
) ?: array(
|
| 182 |
-
""
|
| 183 |
-
)) : array(
|
| 184 |
-
""
|
| 185 |
-
) //array("59.00")
|
| 186 |
-
),
|
| 187 |
-
'Cart' => array(
|
| 188 |
-
'site_region' => Mage::app()->getLocale()->getLocaleCode() ?: "", //"uk",
|
| 189 |
-
'site_currency' => $store->getCurrentCurrencyCode() ?: "", //"GBP",
|
| 190 |
-
'page_name' => $page->getLayout()->getBlock('head')->getTitle() ?: "", //"cart",
|
| 191 |
-
'page_type' => "checkout", //"checkout",
|
| 192 |
-
// THE FOLLOWING NEEDS TO BE MATCHED ARRAYS (SAME NUMBER OF ELEMENTS)
|
| 193 |
-
'product_id' => $checkout_ids ?: array(), //array("5225415241111","5421423520051"),
|
| 194 |
-
'product_sku' => $checkout_skus ?: array(), //array("42526","24672"),
|
| 195 |
-
'product_name' => $checkout_names ?: array(), //array("Dr. Denim Chase Check Cargo Short","Renewal Denim Shirt"),
|
| 196 |
-
'product_brand' => $ARRAY ?: array(), //array("Dr. Denim",""),
|
| 197 |
-
'product_category' => $ARRAY ?: array(), //array("Shorts","Shirts"),
|
| 198 |
-
'product_quantity' => $checkout_qtys ?: array(), //array("1","1"),
|
| 199 |
-
'product_unit_price' => $ARRAY ?: array(), //array("1//array("11.99","37.00"),
|
| 200 |
-
'product_list_price' => $checkout_prices ?: array() //array("59.00","")
|
| 201 |
-
),
|
| 202 |
-
'Confirmation' => array(
|
| 203 |
-
'site_region' => Mage::app()->getLocale()->getLocaleCode() ?: "", //"uk",
|
| 204 |
-
'site_currency' => $store->getCurrentCurrencyCode() ?: "", //"GBP",
|
| 205 |
-
'page_name' => "cart success", //"confirmation",
|
| 206 |
-
'page_type' => "cart", //"checkout",
|
| 207 |
-
'order_id' => $order->getIncrementId() ?: "", //"12345678",
|
| 208 |
-
'order_discount' => number_format($order->getDiscountAmount(), 2, ".", "") ?: "", //"0.00",
|
| 209 |
-
'order_subtotal' => number_format($order->getSubtotal(), 2, ".", "") ?: "", //"70.99",
|
| 210 |
-
'order_shipping' => number_format($order->getShippingAmount(), 2, ".", "") ?: "", //"10.00",
|
| 211 |
-
'order_tax' => number_format($order->getTaxAmount(), 2, ".", "") ?: "", //"5.00",
|
| 212 |
-
'order_payment_type' => $order->getPayment() ? $order->getPayment()->getMethodInstance()->getTitle() : 'unknown', //"visa",
|
| 213 |
-
'order_total' => number_format($order->getGrandTotal(), 2, ".", "") ?: "", //"85.99",
|
| 214 |
-
'order_currency' => $order->getOrderCurrencyCode() ?: "", //"gbp",
|
| 215 |
-
'customer_id' => $customer_id ?: "", //"12345678",
|
| 216 |
-
'customer_email' => $order->getCustomerEmail() ?: "", //"customer@email.com"
|
| 217 |
-
// THE FOLLOWING NEEDS TO BE MATCHED ARRAYS (SAME NUMBER OF ELEMENTS)
|
| 218 |
-
'product_id' => $ids ?: array(), //array("5225415241111","5421423520051"),
|
| 219 |
-
'product_sku' => $skus ?: array(), //array("42526","24672"),
|
| 220 |
-
'product_name' => $names ?: array(), //array("Dr. Denim Chase Check Cargo Short","Renewal Denim Shirt"),
|
| 221 |
-
'product_brand' => $ARRAY ?: array(), //array("Dr. Denim",""),
|
| 222 |
-
'product_category' => $ARRAY ?: array(), //array("Shorts","Shirts"),
|
| 223 |
-
'product_unit_price' => $ARRAY ?: array(), //array("11.99","37.00"),
|
| 224 |
-
'product_list_price' => $prices ?: array(), //array("59.00",""),
|
| 225 |
-
'product_quantity' => $qtys ?: array(), //array("1","1"),
|
| 226 |
-
'product_discount' => $discounts ?: array(), //array("0.00","0.00"),
|
| 227 |
-
'product_discounts' => $discount_quantity ?: array()
|
| 228 |
-
),
|
| 229 |
-
'Customer' => array(
|
| 230 |
-
'site_region' => Mage::app()->getLocale()->getLocaleCode() ?: "",
|
| 231 |
-
'site_currency' => $store->getCurrentCurrencyCode() ?: "",
|
| 232 |
-
'page_name' => $page->getLayout()->getBlock('head')->getTitle() ?: "",
|
| 233 |
-
'page_type' => $page->getTealiumType() ?: "",
|
| 234 |
-
'customer_id' => $customer_id ?: "",
|
| 235 |
-
'customer_email' => $customer_email ?: "",
|
| 236 |
-
'customer_type' => $customer_type ?: ""
|
| 237 |
-
)
|
| 238 |
);
|
| 239 |
|
|
|
|
| 240 |
?>
|
| 241 |
|
| 1 |
<?php
|
| 2 |
// TealiumInit.php var definition file
|
| 3 |
// Replace $STRING or $ARRAY with your server side variable reference unique to that key
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
class TealiumData {
|
| 6 |
+
private static $store;
|
| 7 |
+
private static $page;
|
| 8 |
+
|
| 9 |
+
public static function setStore($store){
|
| 10 |
+
TealiumData::$store = $store;
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
public static function setPage($page){
|
| 14 |
+
TealiumData::$page = $page;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
public function getHome(){
|
| 18 |
+
$store = TealiumData::$store;
|
| 19 |
+
$page = TealiumData::$page;
|
| 20 |
+
|
| 21 |
+
$outputArray = array();
|
| 22 |
+
$outputArray['site_region'] = Mage::app()->getLocale()->getLocaleCode() ?: "";
|
| 23 |
+
$outputArray['site_currency'] = $store->getCurrentCurrencyCode() ?: "";
|
| 24 |
+
$outputArray['page_name'] = $page->getLayout()->getBlock('head')->getTitle() ?: "";
|
| 25 |
+
$outputArray['page_type'] = $page->getTealiumType() ?: "";
|
| 26 |
+
|
| 27 |
+
return $outputArray;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
public function getSearch(){
|
| 31 |
+
$store = TealiumData::$store;
|
| 32 |
+
$page = TealiumData::$page;
|
| 33 |
+
|
| 34 |
+
$outputArray = array();
|
| 35 |
+
$outputArray['site_region'] = Mage::app()->getLocale()->getLocaleCode() ?: "";
|
| 36 |
+
$outputArray['site_currency'] = $store->getCurrentCurrencyCode() ?: "";
|
| 37 |
+
$outputArray['page_name'] = "search results";
|
| 38 |
+
$outputArray['page_type'] = "search";
|
| 39 |
+
$outputArray['search_results'] = $page->getResultCount() . "" ?: "";
|
| 40 |
+
$outputArray['search_keyword'] = $page->helper('catalogsearch')->getEscapedQueryText() ?: "";
|
| 41 |
|
| 42 |
+
return $outputArray;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
public function getCategory(){
|
| 46 |
+
$store = TealiumData::$store;
|
| 47 |
+
$page = TealiumData::$page;
|
| 48 |
+
|
| 49 |
+
if ($page->getCurrentCategory()) {
|
| 50 |
+
$_category = $page->getCurrentCategory();
|
| 51 |
+
$parent = false;
|
| 52 |
+
$grandparent = false;
|
| 53 |
+
|
| 54 |
+
// check for parent and grandparent
|
| 55 |
+
if ($_category->getParentId()) {
|
| 56 |
+
$parent = Mage::getModel('catalog/category')->load($_category->getParentId());
|
| 57 |
+
|
| 58 |
+
if ($parent->getParentId()) {
|
| 59 |
+
$grandparent = Mage::getModel('catalog/category')->load($parent->getParentId());
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
// Set the section and subcategory with parent and grandparent
|
| 64 |
+
if ($grandparent) {
|
| 65 |
+
$section = $grandparent->getName();
|
| 66 |
+
$category = $parent->getName();
|
| 67 |
+
$subcategory = $_category->getName();
|
| 68 |
+
} elseif ($parent) {
|
| 69 |
+
$section = $parent->getName();
|
| 70 |
+
$category = $_category->getName();
|
| 71 |
+
} else {
|
| 72 |
+
$category = $_category->getName();
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
$outputArray = array();
|
| 77 |
+
$outputArray['site_region'] = Mage::app()->getLocale()->getLocaleCode() ?: "";
|
| 78 |
+
$outputArray['site_currency'] = $store->getCurrentCurrencyCode() ?: "";
|
| 79 |
+
$outputArray['page_name'] = $_category ? ($_category->getName() ?: "") : "";
|
| 80 |
+
$outputArray['page_type'] = "category";
|
| 81 |
+
$outputArray['page_section_name'] = $section ?: "";
|
| 82 |
+
$outputArray['page_category_name'] = $category ?: "";
|
| 83 |
+
$outputArray['page_subcategory_name'] = $subcategory ?: "";
|
| 84 |
+
|
| 85 |
+
return $outputArray;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
public function getProductPage(){
|
| 89 |
+
$store = TealiumData::$store;
|
| 90 |
+
$page = TealiumData::$page;
|
| 91 |
+
|
| 92 |
+
$outputArray = array();
|
| 93 |
+
$outputArray['site_region'] = Mage::app()->getLocale()->getLocaleCode() ?: "";
|
| 94 |
+
$outputArray['site_currency'] = $store->getCurrentCurrencyCode() ?: "";
|
| 95 |
+
$outputArray['page_name'] = $_category ? ($_category->getName() ?: "") : "";
|
| 96 |
+
$outputArray['page_type'] = "product";
|
| 97 |
+
|
| 98 |
+
// THE FOLLOWING NEEDS TO BE MATCHED ARRAYS (SAME NUMBER OF ELEMENTS)
|
| 99 |
+
if ( $page->getProduct() ) {
|
| 100 |
+
if ( !($outputArray['product_id'] = array( $page->getProduct()->getId() )) ){
|
| 101 |
+
$outputArray['product_id'] = array();
|
| 102 |
+
}
|
| 103 |
+
if ( !($outputArray['product_sku'] = array( $page->getProduct()->getSku() )) ){
|
| 104 |
+
$outputArray['product_sku'] = array();
|
| 105 |
+
}
|
| 106 |
+
if ( !($outputArray['product_name'] = array( $page->getProduct()->getName() )) ){
|
| 107 |
+
$outputArray['product_name'] = array();
|
| 108 |
+
}
|
| 109 |
+
if ( !($outputArray['product_brand'] = array( $page->getProduct()->getBrand() )) ){
|
| 110 |
+
$outputArray['product_brand'] = array();
|
| 111 |
+
}
|
| 112 |
+
if ( !($outputArray['product_unit_price'] = array( number_format($page->getProduct()->getSpecialPrice(), 2) )) ){
|
| 113 |
+
$outputArray['product_unit_price'] = array();
|
| 114 |
+
}
|
| 115 |
+
if ( !($outputArray['product_list_price'] = array( number_format($page->getProduct()->getPrice(), 2) )) ){
|
| 116 |
+
$outputArray['product_list_price'] = array();
|
| 117 |
+
}
|
| 118 |
+
}
|
| 119 |
+
else {
|
| 120 |
+
$outputArray['product_id'] = array();
|
| 121 |
+
$outputArray['product_sku'] = array();
|
| 122 |
+
$outputArray['product_name'] = array();
|
| 123 |
+
$outputArray['product_brand'] = array();
|
| 124 |
+
$outputArray['product_unit_price'] = array();
|
| 125 |
+
$outputArray['product_list_price'] = array();
|
| 126 |
+
}
|
| 127 |
|
| 128 |
+
if ( Mage::registry('current_category') ){
|
| 129 |
+
if ( Mage::registry('current_category')->getName() ){
|
| 130 |
+
$outputArray['product_category'] = array(Mage::registry('current_category')->getName());
|
| 131 |
+
}
|
| 132 |
+
else {
|
| 133 |
+
$outputArray['product_category'] = array();
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
+
else {
|
| 137 |
+
$outputArray['product_category'] = array();
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
return $outputArray;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
public function getCartPage() {
|
| 144 |
+
$store = TealiumData::$store;
|
| 145 |
+
$page = TealiumData::$page;
|
| 146 |
+
|
| 147 |
+
if (Mage::helper('checkout')) {
|
| 148 |
+
$quote = Mage::helper('checkout')->getQuote();
|
| 149 |
+
foreach ($quote->getAllVisibleItems() as $item) {
|
| 150 |
+
$checkout_ids[] = $item->getProductId();
|
| 151 |
+
$checkout_skus[] = $item->getSku();
|
| 152 |
+
$checkout_names[] = $item->getName();
|
| 153 |
+
$checkout_qtys[] = number_format($item->getQty(), 0, ".", "");
|
| 154 |
+
$checkout_prices[] = number_format($item->getPrice(), 2, ".", "");
|
| 155 |
+
}
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
$outputArray = array();
|
| 159 |
+
$outputArray['site_region'] = Mage::app()->getLocale()->getLocaleCode() ?: "";
|
| 160 |
+
$outputArray['site_currency'] = $store->getCurrentCurrencyCode() ?: "";
|
| 161 |
+
$outputArray['page_name'] = $page->getLayout()->getBlock('head')->getTitle() ?: "";
|
| 162 |
+
$outputArray['page_type'] = "checkout";
|
| 163 |
|
| 164 |
+
// THE FOLLOWING NEEDS TO BE MATCHED ARRAYS (SAME NUMBER OF ELEMENTS)
|
| 165 |
+
$outputArray['product_id'] = $checkout_ids ?: array();
|
| 166 |
+
$outputArray['product_sku'] = $checkout_skus ?: array();
|
| 167 |
+
$outputArray['product_name'] = $checkout_names ?: array();
|
| 168 |
+
$outputArray['product_brand'] = array();
|
| 169 |
+
$outputArray['product_category'] = array();
|
| 170 |
+
$outputArray['product_quantity'] = $checkout_qtys ?: array();
|
| 171 |
+
$outputArray['product_unit_price'] = array();
|
| 172 |
+
$outputArray['product_list_price'] = $checkout_prices ?: array();
|
| 173 |
+
|
| 174 |
+
return $outputArray;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
public function getOrderConfirmation(){
|
| 178 |
+
$store = TealiumData::$store;
|
| 179 |
+
$page = TealiumData::$page;
|
| 180 |
+
|
| 181 |
+
if (Mage::getModel('sales/order')) {
|
| 182 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($page->getOrderId());
|
| 183 |
+
foreach ($order->getAllVisibleItems() as $item) {
|
| 184 |
+
|
| 185 |
+
$ids[] = $item->getProductId();
|
| 186 |
+
$skus[] = $item->getSku();
|
| 187 |
+
$names[] = $item->getName();
|
| 188 |
+
$qtys[] = number_format($item->getQtyOrdered(), 0, ".", "");
|
| 189 |
+
$prices[] = number_format($item->getPrice(), 2, ".", "");
|
| 190 |
+
$discount = number_format($item->getDiscountAmount(), 2, ".", "");
|
| 191 |
+
$discounts[] = $discount;
|
| 192 |
+
$applied_rules = explode(",", $item->getAppliedRuleIds());
|
| 193 |
+
$discount_object = array();
|
| 194 |
+
foreach ($applied_rules as $rule) {
|
| 195 |
+
$quantity = number_format(Mage::getModel('salesrule/rule')->load($rule)->getDiscountQty(), 0, ".", "");
|
| 196 |
+
$amount = number_format(Mage::getModel('salesrule/rule')->load($rule)->getDiscountAmount(), 2, ".", "");
|
| 197 |
+
$type = Mage::getModel('salesrule/rule')->load($rule)->getSimpleAction();
|
| 198 |
+
$discount_object[] = array("rule" =>$rule,
|
| 199 |
+
"quantity" =>$quantity,
|
| 200 |
+
"amount" =>$amount,
|
| 201 |
+
"type" =>$type);
|
| 202 |
+
}
|
| 203 |
+
$discount_quantity[] = array("product_id" => $item->getProductId(),
|
| 204 |
+
"total_discount" => $discount,
|
| 205 |
+
"discounts" => $discount_object);
|
| 206 |
+
|
| 207 |
+
}
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
$outputArray = array();
|
| 211 |
|
| 212 |
+
$outputArray['site_region'] = Mage::app()->getLocale()->getLocaleCode() ?: "";
|
| 213 |
+
$outputArray['site_currency'] = $store->getCurrentCurrencyCode() ?: "";
|
| 214 |
+
$outputArray['order_id'] = $order->getIncrementId() ?: "";
|
| 215 |
+
$outputArray['order_discount'] = number_format($order->getDiscountAmount(), 2, ".", "") ?: "";
|
| 216 |
+
$outputArray['order_subtotal'] = number_format($order->getSubtotal(), 2, ".", "") ?: "";
|
| 217 |
+
$outputArray['order_shipping'] = number_format($order->getShippingAmount(), 2, ".", "") ?: "";
|
| 218 |
+
$outputArray['order_tax'] = number_format($order->getTaxAmount(), 2, ".", "") ?: "";
|
| 219 |
+
$outputArray['order_payment_type'] = $order->getPayment() ? $order->getPayment()->getMethodInstance()->getTitle() : 'unknown';
|
| 220 |
+
$outputArray['order_total'] = number_format($order->getGrandTotal(), 2, ".", "") ?: "";
|
| 221 |
+
$outputArray['order_currency'] = $order->getOrderCurrencyCode() ?: "";
|
| 222 |
+
$outputArray['customer_email'] = $order->getCustomerEmail() ?: "";
|
| 223 |
+
$outputArray['product_id'] = $ids ?: array();
|
| 224 |
+
$outputArray['product_sku'] = $skus ?: array();
|
| 225 |
+
$outputArray['product_name'] = $names ?: array();
|
| 226 |
+
$outputArray['product_brand'] = array();
|
| 227 |
+
$outputArray['product_category'] = array();
|
| 228 |
+
$outputArray['product_unit_price'] = array();
|
| 229 |
+
$outputArray['product_list_price'] = $prices ?: array();
|
| 230 |
+
$outputArray['product_quantity'] = $qtys ?: array();
|
| 231 |
+
$outputArray['product_discount'] = $discounts ?: array();
|
| 232 |
+
$outputArray['product_discounts'] = $discount_quantity ?: array();
|
| 233 |
+
|
| 234 |
+
return $outputArray;
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
public function getCustomerData(){
|
| 238 |
+
$store = TealiumData::$store;
|
| 239 |
+
$page = TealiumData::$page;
|
| 240 |
+
|
| 241 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
| 242 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
| 243 |
+
$customer_id = $customer->getEntityId();
|
| 244 |
+
$customer_email = $customer->getEmail();
|
| 245 |
+
$groupId = $customer->getGroupId();
|
| 246 |
+
$customer_type = Mage::getModel('customer/group')->load($groupId)->getCode();
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
$outputArray = array();
|
| 250 |
+
|
| 251 |
+
$outputArray['site_region'] = Mage::app()->getLocale()->getLocaleCode() ?: "";
|
| 252 |
+
$outputArray['site_currency'] = $store->getCurrentCurrencyCode() ?: "";
|
| 253 |
+
$outputArray['page_name'] = $page->getLayout()->getBlock('head')->getTitle() ?: "";
|
| 254 |
+
$outputArray['page_type'] = $page->getTealiumType() ?: "";
|
| 255 |
+
$outputArray['customer_id'] = $customer_id ?: "";
|
| 256 |
+
$outputArray['customer_email'] = $customer_email ?: "";
|
| 257 |
+
$outputArray['customer_type'] = $customer_type ?: "";
|
| 258 |
+
|
| 259 |
+
return $outputArray;
|
| 260 |
+
}
|
| 261 |
}
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
TealiumData::setStore($data["store"]);
|
| 265 |
+
TealiumData::setPage($data["page"]);
|
| 266 |
+
|
| 267 |
|
| 268 |
$udoElements = array(
|
| 269 |
+
'Home' => function(){
|
| 270 |
+
$tealiumData = new TealiumData();
|
| 271 |
+
return $tealiumData->getHome();
|
| 272 |
+
},
|
| 273 |
+
'Search' => function(){
|
| 274 |
+
$tealiumData = new TealiumData();
|
| 275 |
+
return $tealiumData->getSearch();
|
| 276 |
+
},
|
| 277 |
+
'Category' => function(){
|
| 278 |
+
$tealiumData = new TealiumData();
|
| 279 |
+
return $tealiumData->getCategory();
|
| 280 |
+
},
|
| 281 |
+
'ProductPage' => function(){
|
| 282 |
+
$tealiumData = new TealiumData();
|
| 283 |
+
return $tealiumData->getProductPage();
|
| 284 |
+
},
|
| 285 |
+
'Cart' => function(){
|
| 286 |
+
$tealiumData = new TealiumData();
|
| 287 |
+
return $tealiumData->getCartPage();
|
| 288 |
+
},
|
| 289 |
+
'Confirmation' => function(){
|
| 290 |
+
$tealiumData = new TealiumData();
|
| 291 |
+
return $tealiumData->getOrderConfirmation();
|
| 292 |
+
},
|
| 293 |
+
'Customer' => function(){
|
| 294 |
+
$tealiumData = new TealiumData();
|
| 295 |
+
return $tealiumData->getCustomerData();
|
| 296 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 297 |
);
|
| 298 |
|
| 299 |
+
|
| 300 |
?>
|
| 301 |
|
|
@@ -1,15 +1,18 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Tealium_Tags</name>
|
| 4 |
-
<version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Tealum tag management solution</summary>
|
| 10 |
<description>Tealum tag management solution extension injects the Tealium javascript into your magento pages, and on specific pages injects special javascript so that you can access specific data elements such as product, category or cart data.</description>
|
| 11 |
-
<notes>
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
| 13 |
1.0.2 - Added html/text help to admin config
|
| 14 |
1.0.1 - Fixed arrays that were rendering as strings
|
| 15 |
1.0.0 - refactored based on Tealium class
|
|
@@ -24,10 +27,10 @@
|
|
| 24 |
0.3.0 - fix for missing support message
|
| 25 |
0.2.0 - fix for product page tag syntax
|
| 26 |
0.1.0 - initial release</notes>
|
| 27 |
-
<authors><author><name>
|
| 28 |
-
<date>
|
| 29 |
-
<time>
|
| 30 |
-
<contents><target name="magelocal"><dir name="Tealium"><dir name="Tags"><dir name="Helper"><file name="Data.php" hash="
|
| 31 |
<compatible/>
|
| 32 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 33 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Tealium_Tags</name>
|
| 4 |
+
<version>2.0.1</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Tealum tag management solution</summary>
|
| 10 |
<description>Tealum tag management solution extension injects the Tealium javascript into your magento pages, and on specific pages injects special javascript so that you can access specific data elements such as product, category or cart data.</description>
|
| 11 |
+
<notes>2.0.1 - Fix for extended UDO rendering blank page
|
| 12 |
+
2.0.0 - Added external script support and refactored
|
| 13 |
+
1.2.0 - Added UI admin toggle for onePage Checkout
|
| 14 |
+
1.1.1 - Fixed pages not rendering
|
| 15 |
+
1.1.0 - Added support for alternate checkout pages
|
| 16 |
1.0.2 - Added html/text help to admin config
|
| 17 |
1.0.1 - Fixed arrays that were rendering as strings
|
| 18 |
1.0.0 - refactored based on Tealium class
|
| 27 |
0.3.0 - fix for missing support message
|
| 28 |
0.2.0 - fix for product page tag syntax
|
| 29 |
0.1.0 - initial release</notes>
|
| 30 |
+
<authors><author><name>Patrick McWilliams</name><user>Tealium</user><email>patrick.mcwilliams@tealium.com</email></author></authors>
|
| 31 |
+
<date>2015-02-19</date>
|
| 32 |
+
<time>04:16:45</time>
|
| 33 |
+
<contents><target name="magelocal"><dir name="Tealium"><dir name="Tags"><dir name="Helper"><file name="Data.php" hash="365fb4cdcd062ea8ff4c283fa0f9f61d"/><file name="Observer.php" hash="a4da187ee890256d09daa97c81a28795"/></dir><dir name="etc"><file name="adminhtml.xml" hash="e6ec5ba973cdb97a9925f02575392865"/><file name="config.xml" hash="022d31160f742934ad5a72a10703415a"/><file name="system.xml" hash="9c36bda7c12499354368fd21535222ec"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Tealium_Tags.xml" hash="3d6843433dffefb4600573950a83e765"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="tealium_tags.xml" hash="f1a764ba60627bbf4b0113c454bb892a"/></dir><dir name="template"><dir name="tealium_tags"><file name="base.phtml" hash="dc238fd913df60276c99a6c198716320"/><file name="catalog_product_compare_index.phtml" hash="2cddf1f61676707e75e8c6a6efa7dd93"/><file name="catalogsearch_advanced_result_index.phtml" hash="55751b56fdb95124e18e28dc22d310cf"/><file name="catalogsearch_result_index.phtml" hash="20534c754c0b52967cede5295925dc2f"/><file name="catalogsearch_term_popular.phtml" hash="31dea56323eb8329c35e9c3f147afca0"/><file name="category.phtml" hash="f6da5b510bac6c9b273de054046aa0e3"/><file name="checkout_cart_index.phtml" hash="6c6df883fb6375f15aa3c3a206026ac0"/><file name="checkout_onepage.phtml" hash="0ccfc96f256b254661dba05321809995"/><file name="checkout_success.phtml" hash="f3f2f13637a56d0193a0a711bdd9cef9"/><file name="cms.phtml" hash="6b22c74137dae766bb518da903629369"/><file name="customer.phtml" hash="9531acc69dbcebf685f54d9f0f3e5f83"/><file name="generic.phtml" hash="e08d99f69ddf6aca7db07e5fed9920d7"/><file name="guest_sales.phtml" hash="2568dbfff3033301e79850d69ac5335a"/><file name="product.phtml" hash="ff43f09465b688ee88e78838b2c7be0a"/><file name="product_send.phtml" hash="56cfd43733fae931410f29bdf8a812cf"/><file name="seo.phtml" hash="733576edcc66d64551afc61f99875c70"/><file name="tag_list_index.phtml" hash="4b234a62599ccaeb0f73d9373cc270b7"/><file name="tag_product_list.phtml" hash="58af545fe5a6dc1185d2507128aa9dbc"/></dir></dir></dir></dir></dir></target><target name="magelib"><dir name="Tealium"><file name="Tealium.php" hash="8b5745d0080f17045d66f4283a2b4176"/><file name="TealiumCustomData.php" hash="c7d066cbf120d79460928872d62f72e1"/><file name="TealiumInit.php" hash="009dab38e113a6cb77e8826c941f3c51"/></dir></target></contents>
|
| 34 |
<compatible/>
|
| 35 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 36 |
</package>
|
