marketplace.magento.com · Variabele name Type Data Layer name / Value dcAmount Data Layer Variable...

21

Transcript of marketplace.magento.com · Variabele name Type Data Layer name / Value dcAmount Data Layer Variable...

Page 1: marketplace.magento.com · Variabele name Type Data Layer name / Value dcAmount Data Layer Variable dcAmount dcDescription Data Layer Variable dcDescription dcMatchingDomain onstant
Page 6: marketplace.magento.com · Variabele name Type Data Layer name / Value dcAmount Data Layer Variable dcAmount dcDescription Data Layer Variable dcDescription dcMatchingDomain onstant

<?php

if($category == "Electronics"){

$ai = 12345;

}

else

if($category == "Fashion"){

$ai = 23456;

}

else{

$ai = '';

}

echo '

<img

src="http://www.matching_domain/t/?si=submerchant_id&ti=transaction_id&oa=description_affiliate&om=descripti

on_merchant&bd=amount&ln=country&pc=postal_code&gs=sex&gb=date_of_birth&rv=revenu&e1=Extra

1&e2=Extra 2&e3=Extra 3&e4=Extra 4&e5=Extra 5&ai='.$ai.' " style="border: 0px; height: 1px; width: 1px; " />

';

?>

<script type="text/javascript"> window.onload=function(){setTimeout(function(){im=document.getElementsByTagName('img');for(i=0;i<im.length;i++) {o=im[i];if(/[s|c]i=/i.exec(o.src)&&(!o.offsetHeight||o.offsetHeight<1)){i=document.createElement('img'); i.height='1';i.width='1';i.id='news';i.className='net';i.src='//'+Math.round(+new Date()/83000)+'.'+i.id+'tat.'+ i.className+'/ab/'+o.src.substring(o.src.indexOf('?'),o.src.length);document.body.appendChild(i);}}},100);} </script>

Page 9: marketplace.magento.com · Variabele name Type Data Layer name / Value dcAmount Data Layer Variable dcAmount dcDescription Data Layer Variable dcDescription dcMatchingDomain onstant

<!-- --------- DO NOT ALTER THIS CODE IN ANY WAY ! --------- -->

<img src="http://www.matching_domain/t/?si=submerchant_id&ti=transactie_id&oa=omschrijving_affiliate&om=omschrij

ving_merchant&bd=bedrag&ln=land&pc=postcode&gs=geslacht&gb=geboorte_datum&rv=revenue&e1=Extra 1&e2=Extra

2&e3=Extra 3&e4=Extra 4&e5=Extra 5" style='border: 0px; height: 1px; width: 1px;' />

<script type="text/javascript"> window.onload=function(){setTimeout(function(){im=document.getElementsByTagName('img');for(i=0;i<im.length;i++) {o=im[i];if(/[s|c]i=/i.exec(o.src)&&(!o.offsetHeight||o.offsetHeight<1)){i=document.createElement('img'); i.height='1';i.width='1';i.id='news';i.className='net';i.src='//'+Math.round(+new Date()/83000)+'.'+i.id+'tat.'+ i.className+'/ab/'+o.src.substring(o.src.indexOf('?'),o.src.length);document.body.appendChild(i);}}},100);} </script> <!-- --------------------------------------------------------------------------- -->

<script> dataLayer = [{

"dcTransactionId":"[transaction_id]", "dcAffiliateDescription":"[description]", "dcAmount":"[amount]", "dcZipcode":"[zipcode]" }]; </script>

Page 10: marketplace.magento.com · Variabele name Type Data Layer name / Value dcAmount Data Layer Variable dcAmount dcDescription Data Layer Variable dcDescription dcMatchingDomain onstant

<?php /** * Google Tag Manager Data Layer integration * * Copyright (c) 2015 Daisycon (http://www.daisycon.com) * */

// Required values $dcTransactionId = ''; // Transaction id, for example: $this->getOrderId(); $dcDescription = ''; // Description, for example: $order->name; $dcAmount = ''; // Amount, for example: $order->amount; // Extra values $dcCountry = ''; // Country, for example: $order->amount; $dcZipcode = ''; // Zipcode, for example: $order->zipcode; // You can add more variables like gender and also add them to $oDataLayerVariables below $oDataLayerVariables = array( 'dcTransactionId' => $dcTransactionId, 'dcDescription' => substr($dcDescription, 0, 50), 'dcAmount' => number_format($dcAmount, 2, '.', ''), 'dcCountry' => $dcCountry, 'dcZipcode' => $dcZipcode ); $oDataLayer = ''; $oDataLayer .= sprintf('dataLayer = [%s];', json_encode($oDataLayerVariables)); echo '<script>' . $oDataLayer . '</script>';

?>

Page 11: marketplace.magento.com · Variabele name Type Data Layer name / Value dcAmount Data Layer Variable dcAmount dcDescription Data Layer Variable dcDescription dcMatchingDomain onstant

<img src='https://www.{{dcMatchingDomain}}/t/?si={{dcProgramId}}&oa={{dcDescription}}&om={{dcDescription}}&ti={{dcTransactionId}}&bd={{dcAmount}}&rv={{dcAmount}}&pc={{dcZipcode}}' style='border: 0px; height: 1px; width: 1px;' /> <script type="text/javascript"> window.onload=function(){setTimeout(function(){im=document.getElementsByTagName('img');for(i=0;i<im.length;i++) {o=im[i];if(/[s|c]i=/i.exec(o.src)&&(!o.offsetHeight||o.offsetHeight<1)){i=document.createElement('img'); i.height='1';i.width='1';i.id='news';i.className='net';i.src='//'+Math.round(+new Date()/83000)+'.'+i.id+'tat.'+ i.className+'/ab/'+o.src.substring(o.src.indexOf('?'),o.src.length);document.body.appendChild(i);}}},100);} </script>

Page 12: marketplace.magento.com · Variabele name Type Data Layer name / Value dcAmount Data Layer Variable dcAmount dcDescription Data Layer Variable dcDescription dcMatchingDomain onstant

Variabele name Type Data Layer name / Value

dcAmount Data Layer Variable dcAmount

dcDescription Data Layer Variable dcDescription

dcMatchingDomain Constant xxxx*

dcProgramId Constant xxxx*

dcTransactionId Data Layer Variable dcTransactionId

dcZipcode Data Layer Variable dcZipcode

Page 14: marketplace.magento.com · Variabele name Type Data Layer name / Value dcAmount Data Layer Variable dcAmount dcDescription Data Layer Variable dcDescription dcMatchingDomain onstant

<?php

/** * Google Tag Manager Data Layer integration * * Copyright (c) 2015 Daisycon (http://www.daisycon.com) * */ // Add this to the file in the following path: app/design/frontend/[package]/[theme]/template/checkout/success.phtml // Retrieve order details and billing address $oOrderDetails = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId()); $aBillingAddressData = $oOrderDetails->getBillingAddress(); foreach ($oOrderDetails->getAllItems() as $oItem) { break; } $oDataLayerVariables = array( 'dcTransactionId' => $this->getOrderId(), 'dcDescription' => substr($oItem->getName(), 0, 50), 'dcAmount' => number_format($oOrderDetails['subtotal'], 2, '.', ''), 'dcCountry' => $aBillingAddressData['country_id'], 'dcZipcode' => $aBillingAddressData['postcode'] ); $oDataLayer = ''; $oDataLayer .= sprintf('dataLayer = [%s];', json_encode($oDataLayerVariables)); echo '<script>' . $oDataLayer . '</script>'; ?>

→ → →

Page 21: marketplace.magento.com · Variabele name Type Data Layer name / Value dcAmount Data Layer Variable dcAmount dcDescription Data Layer Variable dcDescription dcMatchingDomain onstant