How I Setup a WordPress Cron Job Using AWS Lambda

A little background on WordPress cron jobs and why they’re important. WordPress cron jobs is the tool that WordPress core uses to regularly run specific functions. For example, a widely used caching plugin, W3 Total Cache (which I use on many of my sites) can preload caches at regular intervals, to ensure that a page is always cached. WordPress by default though, triggers this when someone visits your site. This can cause a delay in loading the page though, if it takes a while for a job or jobs, to run. (more info: developer.wordpress.org) Personally, I disable the built-in WordPress …

Continue ReadingHow I Setup a WordPress Cron Job Using AWS Lambda

Using Cloudflare, an Amazon Load Balancer, with Nginx and Fail2Ban

I recently started using WordOps as the primary infrastructure solution for my WordPress sites. I’ve been quite happy with it as well. I’ve been using Cloudflare for quite a while now, and have been extremely pleased with the product offering; even the free service is fantastic — I have also used Cloudflare as an Enterprise customer. More recently though, I’ve started to dive into Amazon Web Services (AWS) and started using their Load Balancer technology in my high availability WordPress infrastructure configuration. WordOps comes out of the box with a configuration file called cloudflare.conf inside of /etc/nginx/conf.d. This file comes …

Continue ReadingUsing Cloudflare, an Amazon Load Balancer, with Nginx and Fail2Ban

How to Automate WordPress Backups to Amazon S3 with a Bash Script

I’ve been working with WordPress for almost 20 years now. Hosting has always been a pain in my side to properly handle scaling, caching, and delivery. Recently, I started using an Open Source product called WordOps and have been very impressed with it. The following WordPress backup script is tailored to the file structure of WordOps, but it can easily be customized to fit any need. To give you some basics of how I adapted this script. All my sites live in /var/www, such as /var/www/domain.com and furthermore, the main directories live in htdocs. For example, /var/www/domain.com/htdocs which is where …

Continue ReadingHow to Automate WordPress Backups to Amazon S3 with a Bash Script

How to Track Light/Dark Mode in Google Analytics through Google Tag Manager

Have you ever been on your phone late at night and you visit a web page and you’re suddenly blinded? Light and dark mode could ease that pain for your users, to give them a more pleasant experience. Thankfully, there is a CSS Media query which you can use to control it. Tracking visits at a session-level, whether they have light mode or dark mode enabled, could help give you some insight to see if visitors are even using that. This tutorial will walk you through how to track dark and light mode at a session-level within Google Analytics (GA), …

Continue ReadingHow to Track Light/Dark Mode in Google Analytics through Google Tag Manager

How to Track Ad Block Usage in Google Analytics through Google Tag Manager

In this guide, I’ll walk you through how to add track sessions that have ad blocking enabled, through Google Tag Manager (GTM) and Google Analytics (GA). Here’s a glance, similar to what you will see in your Google Analytics profile, after implementing the tag and variable in GTM. Data Preview Step 1 Click into your container. Step 2 Create a new Tag, as Custom HTML. This Javascript snippet will create a 1×1 ad unit that will always be triggered by an adblocker. It checks to see if the unit was able to be created and has a height, and if …

Continue ReadingHow to Track Ad Block Usage in Google Analytics through Google Tag Manager