GDPR: What is the EU General Data Protection Regulation?

The General Data Protection Regulation (GDPR) will have an impact on how organisations handle the personal information that they look after.

GDPR is a regulation by which the European Parliament, the Council of the European Union and the European Commission intend to strengthen and unify data protection for all individuals within the European Union (EU). It also addresses the export of personal data outside the EU. The GDPR aims primarily to give control back to citizens and residents over their personal data and to simplify the regulatory environment for international business by unifying the regulation within the EU.

GDPR will have a role in four main areas:

1. Easier Access
Users will have easier access to their own data. Individuals will be better informed as to how their information is processed and stored and organisations will need to inform users in the clearest way possible.

2. Portability
Users should easily transfer their own information between service providers.

3. Right to be forgotten
Users that no longer want you to control or store their personal information you have processed should be able to easily have their data removed from your system unless there are legitimate grounds for keeping it.

4. Data breaches
Users should know that their information has been lost/stole or otherwise compromised. If your systems have been breached the users affected should be informed as soon as possible.

The implementation of the four points will depend on how you currently store and access user information. You will also need to be clear what you are using that information for.

 

All-in-one Google Analytics tracking in Magento

Simple single script to add Google’s conversion tracking to your Magento ecommerce website. The code should be added into the footer.phtml file within your current template. The code includes tracking of catalogue browsing, checkout and new orders.

Simply replace all the $googleConversionId with your actual Google Conversion ID.

<!-- Google Conversion Tracking -->
<?php $googleConversionId = ""; // Your conversion ID goes here ?>
<?php $page_type = Mage::app()->getFrontController()->getRequest()->getControllerName();
if($page_type == 'index') { ?>
 <script type="text/javascript">
 var google_tag_params = {
 ecomm_pagetype: 'home',
 ecomm_prodid: '',
 ecomm_totalvalue: 0
 };
 </script>
<?php } elseif($page_type == 'category') { ?>
 <script type="text/javascript">
 var google_tag_params = {
 ecomm_pagetype: 'category',
 ecomm_prodid: '',
 ecomm_totalvalue: 0
 };
 </script>
<?php } elseif($page_type == 'product') {
 $product_id = Mage::registry('current_product')->getId();
 $product_id = Mage::getModel('catalog/product')->load($product_id)->getSku();
 $product_price = Mage::registry('current_product')->getPrice();
 ?>
 <script type="text/javascript">
 var google_tag_params = {
 ecomm_pagetype: 'product',
 ecomm_prodid: '<?php echo $product_id; ?>',
 ecomm_totalvalue: parseFloat('<?php echo $product_price; ?>')
 };
 </script>
<?php } elseif($page_type == 'cart') { ?>
 <script>
 var id = new Array();
 var price = new Array();
 </script>
 <?php
 $cart = Mage::getModel('checkout/session')->getQuote();
 foreach ($cart->getAllItems() as $item) {
 $product_id = $item->getProductId();
 $product_id = $item->getSku();
 $product_id_all = $product_id_all.','.$product_id ;
 $productPrice = $item->getProduct()->getPrice();
 $productPrice_all = $productPrice_all.','.$productPrice;
 ?>
 <Script>
 id.push('<?php echo $product_id; ?>');
 price.push(parseFloat('<?php echo $productPrice; ?>'));
 </Script>
 <?php
 }
 $product_id_all=substr($product_id_all, 1);
 $productPrice_all=substr($productPrice_all, 1);
 ?>
 <script type="text/javascript">
 var google_tag_params = {
 ecomm_pagetype: 'cart',
 ecomm_prodid: id,
 ecomm_totalvalue: price
 };
 </script>
 <?php } elseif($page_type == 'onepage') { ?>
 <script>
 var id = new Array();
 var price = new Array();
 </script>
 <?php
 $cart = Mage::getModel('checkout/session')->getQuote();
 foreach ($cart->getAllItems() as $item)
 {
 $product_id = $item->getProductId();
 $product_id = $item->getSku();
 $product_id_all = $product_id_all.','.$product_id ;
 $productPrice = $item->getProduct()->getPrice();
 $productPrice_all = $productPrice_all.','.$productPrice;
 ?>
 <Script>
 id.push('<?php echo $product_id; ?>');
 price.push(parseFloat('<?php echo $productPrice; ?>'));
 </Script>
 <?php } 
 $product_id_all=substr($product_id_all, 1);
 $productPrice_all=substr($productPrice_all, 1);
 ?>
 <script type="text/javascript">
 var google_tag_params = {
 ecomm_pagetype: 'purchase',
 ecomm_prodid: id,
 ecomm_totalvalue: price
 };
 </script>
 <?php }else{ ?>
 <script type="text/javascript">
 var google_tag_params = {
 ecomm_pagetype: 'other',
 ecomm_prodid: '',
 ecomm_totalvalue: 0
 };
 </script>
 <?php } ?>
<script type="text/javascript">
 /* <![CDATA[ */
 var google_conversion_id = <?php echo $googleConversionId; ?>;
 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/<?php echo $googleConversionId; ?>/?value=0&amp;guid=ON&amp;script=0"/>
 </div>
</noscript>
<!-- End Google Conversion Tracking -->

All-in-one Facebook Pixel Code for Magento ecommerce

Simple single script to add Facebook’s Pixel Code tracking to your Magento ecommerce website. The code should be added into the head.phtml file within your template. This includes tracking of search and checkout progress and new orders.

Simply replace all the $facebookPixelId with your actual Facebook Pixel Code ID.

<!-- All in one Facebook Pixel Code --> 
<?php $facebookPixelId = "000000000000000000000"; // Your Pixel Code goes here ?>
<script> 
 !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod? 
 n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n; 
 n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0; 
 t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window, 
 document,'script','//connect.facebook.net/en_US/fbevents.js');
 fbq('init', '<?php echo $facebookPixelId; ?>'); 
 fbq('track', "PageView");
<?php 
 $request = $this->getRequest();
 $module = $request->getModuleName();
 $controller = $request->getControllerName();
 $action = $request->getActionName();
 $pageIdentifier = Mage::app()->getFrontController()->getAction()->getFullActionName(); 
 // Lead
 if(Mage::registry('current_product')) {
 echo "fbq('track', 'Lead');";
 }
 // Search
 if($controller == 'result' || $controller =='advanced') { 
 echo "fbq('track', 'Search');"; 
 }
 // Customer registration
 if($module == 'customer' && $controller == 'account' && $action == 'index'){
 echo "fbq('track', 'CompleteRegistration')";
 }
 // Add to cart
 if($module == 'checkout' && $controller == 'cart' && $action == 'index') {
 echo "fbq('track', 'AddToCart');";
 }
 // Add to wishlist
 if($module == 'wishlist') {
 echo "fbq('track', 'AddToWishlist');";
 }
 // Checkout start 
 if(Mage::getURL('checkout/onepage') == Mage::helper('core/url')->getCurrentUrl()) {
 echo "fbq('track', 'InitiateCheckout');";
 
 // As the onepagecheckout don't have a specific page for add billing info, i placed the tracker here
 echo "fbq('track', 'AddPaymentInfo');";
 }
 // Checkout success
 if ($pageIdentifier == 'transparente_standard_redirect') {
 $lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();//Geeting last order id
 $order = Mage::getSingleton('sales/order'); //getting order model
 $order->load($lastOrderId); //loding current order
 $_totalData =$order->getData(); //loading order model data
 $grandTotal = number_format($_totalData['grand_total'],2,'.',''); //loading grand total
 echo "fbq('track', 'Purchase', {value: '$grandTotal', currency: 'BRL'});";
 }
 ?>
</script> 
<noscript><img height="1" width="1" style="display:none" 
src=" https://www.facebook.com/tr?id=<?php echo $facebookPixelId; ?>&ev=PageView&noscript=1" 
/></noscript> 
<!-- All in one End Facebook Pixel Code -->

Add Facebook Pixel Code to Magento Success Page

Update: Instead of this, try the All-in-one Facebook Pixel Code method. It’s easier to maintain.

Facebook Pixel Code is a new and even more complicated way to annoy web developers, so on top of all the Google Analytics we now have even more random JavaScript to drop into pages already growing under the weight of like and share buttons, analytics tracking, advert tracking on top of the code that actually makes the website work. Good times.

Anyhoo, this is the process for adding a successful order tracking. It all takes place on the success.phtml page or your theme so go ahead and open the file: app\design\frontend\PACKAGE\THEME\template\checkout\success.phtml

Facebook conversion tracking requires the order total. Add the following PHP to set the last order to an amount variable which can be reused later in the tracking code.

<?php
//Get Order Number & Order Total
$order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
$amount = number_format($order->getGrandTotal(),2);
?>

Finally, add the Facebook conversion code itself. Be sure to substitute the 100000001 below with the value form your Facebook conversion code – it appears twice in the JavaScript and the Image SRC. Also you may need to modify the currency parameter, again it appears twice.

<script type="text/javascript">
var fb_param = {};
fb_param.pixel_id = '100000001';
fb_param.value = '<?php echo $amount; ?>';
fb_param.currency = 'GBP';
(function(){
  var fpw = document.createElement('script');
  fpw.async = true;
  fpw.src = '//connect.facebook.net/en_US/fp.js';
  var ref = document.getElementsByTagName('script')[0];
  ref.parentNode.insertBefore(fpw, ref);
})();
</script>
<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/offsite_event.php?id=100000001&amp;value=<?php echo $amount; ?>&amp;currency=GBP" /></noscript>

You can now go ahead and test to confirm.