Category Archives: Uncategorized

IP anonymization with analytics.js – Google Analytics

You can anonymize user’s IP with analytics.js Google Analytics like this: (function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,’script’,’//www.google-analytics.com/analytics.js’,’ga’); ga(‘create’, ‘GA_TRACKING_ID’, ‘auto’); ga(‘send’, ‘pageview’); ga(‘set’, ‘anonymizeIp’, true); </script> (function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,’script’,’//www.google-analytics.com/analytics.js’,’ga’); ga(‘create’, ‘GA_TRACKING_ID’, ‘auto’); ga(‘send’, ‘pageview’); ga(‘set’, ‘anonymizeIp’, true); </script> This code indicates the user’s IP is anonymized: ga(‘set’, ‘anonymizeIp’, true);ga(‘set’, ‘anonymizeIp’, true); Make sure to […]

IP anonymization with gtag.js – Google Analytics

You can anonymize user’s IP with Global site tag (gtag.js) like this: <!– Global site tag (gtag.js) – Google Analytics –> <script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(‘js’, new Date());   gtag(‘config’, ‘GA_TRACKING_ID’, { ‘anonymize_ip’: true }); </script><!– Global site tag (gtag.js) – Google Analytics –> <script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script> <script> […]

Disable Affiliate Links (VGLNK) on Disqus

Disqus is the internet’s favorite comment plug-in that helps publishers increase engagement and build loyal audiences. It is free and is used by million of websites. However, recently we noticed an issue with their “Affiliate Links” option that was causing any text similar to a domain name (i.e abcdef.com) to be hyperlinked with this HTML […]

Delphi Scrollbox with Black Background on Windows XP

Problem: Delphi Scrollbox is completely black on Windows XP. Some Win XP users may experience strange behaviors with Scrollbar\Scrollbox. In particular they may see the background in black, example: To fix this issue just set ParentBackground to True on the Scroll component. If that still doesn’t work, try to put the Scrollbox inside a TPanel. […]

Simulate Multiple Monitors in VMWare guest

You can have one large host window with multiple monitors in the guest: 1) Power off the VM then go to VM > Settings > Hardware > Display 2) Select “Specify monitor settings”, and set “Number of monitors” to 2 or more. 3) Uncheck Autofit Guest by going to Edit > Preferences > Display. * […]

Delphi poScreenCenter and Dual Monitors

To correctly show your main form on dual monitors use poScreenCenter: So the main form is displayed on the center of the main monitor. Else the main form is displayed in the middle between the two monitors. More information on this link: Vcl.Forms.TPosition – RAD Studio API Documentation

PHP Check if a File is an Office 2007 Document by MIME Content Type

Simple PHP function to check if a file is an Office 2007 document by filtering the content type: function isOfficeDocumentByMIMEContentType($str) { //https://blogs.msdn.microsoft.com/vsofficedeveloper/2008/05/08/office-2007-file-format-mime-types-for-http-content-streaming-2/   $array = array( "application/msword", //doc "application/msword", //dot "application/vnd.openxmlformats-officedocument.wordprocessingml.document", //docx "application/vnd.openxmlformats-officedocument.wordprocessingml.template", //dotx "application/vnd.ms-word.document.macroEnabled.12", //docm "application/vnd.ms-word.template.macroEnabled.12", //dotm "application/vnd.ms-excel", //xls "application/vnd.ms-excel", //xlt "application/vnd.ms-excel", //xla "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", //xlsx "application/vnd.openxmlformats-officedocument.spreadsheetml.template", //xltx "application/vnd.ms-excel.sheet.macroEnabled.12", //xlsm "application/vnd.ms-excel.template.macroEnabled.12", //xltm "application/vnd.ms-excel.addin.macroEnabled.12", //xlam "application/vnd.ms-excel.sheet.binary.macroEnabled.12", […]

Determine if user is on mobile device with Javascript

Easiest way to determine if user is on mobile device with javascript: if (/Mobi/i.test(navigator.userAgent) == true || /Android/i.test(navigator.userAgent) == true ) { // Mobile device detected }if (/Mobi/i.test(navigator.userAgent) == true || /Android/i.test(navigator.userAgent) == true ) { // Mobile device detected }

Show Google AdSense based on User’s Device

Let’s say I want to show Google AdSense after the .header class for non-mobile devices (desktops, laptops, etc), and show Google AdSense before a form on mobile devices only. Here is the jQuery code example: // Show Google AdSense after the .header if device is not mobile if (/Mobi/i.test(navigator.userAgent) == false && /Android/i.test(navigator.userAgent) == false […]

OptinMonster and jQuery 3.2.1 Slim (Issue)

Looks like that OptinMonster does not load the campaign if you use jQuery 3.2.1 Slim version. To fix this, I have used the normal jQuery (minified) .js file like this: <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> And then I made sure OptinMonster does not load jQuery 1.12.2: <script>var om_load_jquery = false;</script><script>var om_load_jquery = false;</script> After the above trick […]