Last active
March 15, 2019 03:04
-
-
Save mynameisbart/65960773d7fb5597c7b3cdea1904c64c to your computer and use it in GitHub Desktop.
Magento Dynamic Remarketing Templates Changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- replace the {conversion_id_goes_here} placeholder with your own --> | |
| <?php | |
| $checkoutSession = Mage::getSingleton('checkout/session'); | |
| $currentQuote = $checkoutSession->getQuote(); | |
| $items = $currentQuote->getAllItems(); | |
| $totalValue = $currentQuote->getSubtotal(); | |
| ?> | |
| <script type="text/javascript"> | |
| var google_tag_params = { | |
| ecomm_prodid: [<?php foreach ($items as $item) {?>'<?php echo $item->getSku();?>',<?php }?>], | |
| ecomm_pagetype: 'cart', | |
| ecomm_totalvalue: <?php echo $totalValue ?>, | |
| }; | |
| </script> | |
| <script type="text/javascript"> | |
| /* <![CDATA[ */ | |
| var google_conversion_id = {conversion_id_goes_here}; | |
| var google_custom_params = window.google_tag_params; | |
| var google_remarketing_only = true; | |
| /* ]]> */ | |
| </script> | |
| <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"> | |
| </script> | |
| <noscript> | |
| <div style="display:inline;"> | |
| <img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/{conversion_id_goes_here}/?guid=ON&script=0"/> | |
| </div> | |
| </noscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- replace the {conversion_id_goes_here} placeholder with your own --> | |
| <?php | |
| $order_details = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId()); | |
| $adwords_saleamt = $order_details->getSubtotal(); | |
| $items = $order_details->getAllItems(); | |
| ?> | |
| <script type="text/javascript"> | |
| var google_tag_params = { | |
| ecomm_prodid: [<?php foreach ($items as $item) {?>'<?php echo $item->getSku();?>',<?php }?>], | |
| ecomm_pagetype: 'purchase', | |
| ecomm_totalvalue: <?php echo $adwords_saleamt; ?>, | |
| }; | |
| </script> | |
| <script type="text/javascript"> | |
| /* <![CDATA[ */ | |
| var google_conversion_id = {conversion_id_goes_here}; | |
| var google_custom_params = window.google_tag_params; | |
| var google_remarketing_only = true; | |
| /* ]]> */ | |
| </script> | |
| <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"> | |
| </script> | |
| <noscript> | |
| <div style="display:inline;"> | |
| <img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/{conversion_id_goes_here}/?value=0&guid=ON&script=0"/> | |
| </div> | |
| </noscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Some themes already have a $_product variable defined. If this is the case do not repeat it. --> | |
| <!-- replace the {conversion_id_goes_here} placeholder with your own --> | |
| <?php $_product = Mage::registry('current_product');?> | |
| <?php if ($_product && $_product->getId()): ?> | |
| <script type="text/javascript"> | |
| var google_tag_params = { | |
| ecomm_prodid: '<?php echo $_product->getSku(); ?>', | |
| ecomm_pagetype: 'product', | |
| ecomm_totalvalue: <?php echo $_product->getfinalprice(); ?>, | |
| }; | |
| </script> | |
| <?php endif; ?> | |
| <script type="text/javascript"> | |
| /* <![CDATA[ */ | |
| var google_conversion_id = {conversion_id_goes_here}; | |
| var google_custom_params = window.google_tag_params; | |
| var google_remarketing_only = true; | |
| /* ]]> */ | |
| </script> | |
| <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"> | |
| </script> | |
| <noscript> | |
| <div style="display:inline;"> | |
| <img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/{conversion_id_goes_here}/?guid=ON&script=0"/> | |
| </div> | |
| </noscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment