Category Archives: Magento 1

How to add ecommerce tracking with gtag in magento order success

Every merchant wants to track their sales in google analytics. Currently google have changed google analytics (GA) to google tag manager(GTag). If you use gtm.js as your Google Analytics tag and you have Ecommerce reporting enabled, you can measure ecommerce transactions. <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({‘gtm.start’: new Date().getTime(),event:’gtm.js’});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!=’dataLayer’?’&l=’+l:”;j.async=true;j.src= ‘’+i+dl;f.parentNode.insertBefore(j,f); })(window,document,’script’,’dataLayer’,'{your-gtm-id}’);</script>   To measure a transaction, send a purchase event… Read More »

how to block requests with specific string using .htaccess in apache

These days common problem of hacking of website by hacker with scrips. They always use some common method or string to hack it. Now you can prevent these requests by adding some simple .htaccess rules. You could send a 403 Forbidden (access denied) in case -admin is requested : RewriteEngine On RewriteCond %{REQUEST_URI} ^/(.*?)admin RewriteRule ^(.*)$ – [F,L]  … Read More »

How to redirect non www or non https url to www and https

This is very common problem to everyone to redirect non www urls to www with https. You can follow simple .htaccess rules to implement it. RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$$1 [L,R=301] RewriteCond %{HTTPS} off RewriteRule ^(.*)$$1 [L,R=301] The only real difference here is that first we redirect from non-WWW to… Read More »