Follow Brian Li (@DecryptoBL) on Twitter.
Follow Brian Li (@bwhli) on Instagram.

How to Create a Fixed Sponsor Ad on a WordPress Site

November 7, 2018

I hate Adsense, but I believe display ads are a necessity for modern web publishers who wish to monetize their work. Projects like Brave and Coil are working on unobtrusive monetization solutions, but they won’t be ready for mainstream adoption anytime soon. For now, I’ve chosen to stick with a small old fashioned HTML/CSS fixed display ad inspired by Daring Fireball, The Loop, and of course Carbon Ads. I didn’t see any tutorials on how to implement this kind of sponsor ad in WordPress without a plugin, so I decided to share my process in this post.

Continue Reading →


How to Display Bitcoin Price in WordPress With PHP

November 1, 2018

Yesterday, I spent the afternoon playing around with different ways to display the price of Bitcoin in Decrypto’s page header. After I got everything working, I realized forcing the price of Bitcoin on readers is a terrible and stress-inducing idea from a UX perspective. Regardless, here’s the PHP code I used to make it happen.

Continue Reading →


A Dark Mode

October 27, 2018

I was playing around with the latest Safari Technology Preview, which supports the new prefers-color-scheme media query for detecting light and dark modes in MacOS Mojave. I ended up really liking the dark theme, so I decided to make it the default style for the time being. I’m still experimenting with colors, but I think this will be the general look.

@ me on Twitter if you hate it.


Timestamping & Archiving Blog Posts on the ICON Blockchain

October 24, 2018

Recently, I was accused of editing past blog posts to fit my current perspective and narrative on a certain blockchain project. Considering this is my blog where I have 100% creative control over what gets published, I don’t think editing past content is necessarily an issue – especially when it’s an edit like the one below from a recent post on Substratum.

Update: As of September 1, 2018, I’ve been banned from the Substratum Telegram channel and subreddit for expressing an unapproved opinion.

Regardless, I decided to take this opportunity to figure out how to use blockchain to timestamp and archive blog posts. The idea here is to be able to point people to an HTML backup of a webpage on the blockchain to prove that I did not make any unreasonable edits since the “freeze date”.

Continue Reading →


How to Filter Your Own Internal Traffic in Google Analytics

July 7, 2015

If you’re like me, and spend a lot of time on your own blog, chances are you’re unknowingly skewing your Google Analytics data. This can often lead to exaggerated page views, among other things. Fortunately, there’s an easy way to filter out your own traffic from Google Analytics reports.

Finding Your Public IP Address

First, you’ll need to find your public IP address. To do this, just type “what is my IP address” into Google. For the purpose of this tutorial, I’ll be using 93.103.172.109 as my IP address.

Configuring Google Analytics

google-analytics-all-filters

Next, click on the Admin tab in your Google Analytics dashboard. Navigate to the Account section of the page, and make sure the correct account is selected. Next, click on All Filters.

Now, click on +New Filter, and you should see a page that looks something like this.

Using Predefined Filters

google-analytics-predefined-filters

If you’re just filtering out one IP address, using a predefined filter with the following settings is the easiest solution.

  • Select filter type – Exclude
  • Select source or destination – traffic from the IP addresses
  • Select expression – that are equal to
  • IP address – your public IP address (93.103.172.109 in my case)

Next, you’ll want to add all the the necessary available views to filter from. Since I use the same Google Analytics account for four of my websites, I have four instances of All Web Site Data under Available Views. I want my home IP address to be filtered for all my sites, so I have added all four of them to Selected Views. Next, click Save Changes. All done.

Using Custom Filters

If you want to exclude a range of IP addresses, you’ll have to use a custom filter instead. To do this, select Custom for the filter type instead of Predefined. Use the following configuration.

  • Select filter type – Exclude
  • Filter field – IP Address

Next, you need to type in a filter pattern for your IP range. Let’s say you want to filter 93.103.172.109 through 93.103.172.121. It’s not as simple as just typing 93.103.172.109–121. There’s a special syntax called regular expression (regex) you’ll have to follow.

For the IP range 93.103.172.109–121, the filter pattern would look like this.

?³.103.172.(1(09|1[0–9]|2[0–1]))$

Click here for a handy dandy regex generator.

Here’s what a completed IP range configuration should look like.

google-analytics-custom-filters

As with predefined filters, you’ll have to select the necessary web views to filter from. After that, click on Save Changes to complete the process.

Conclusion

If you’re serious about blogging, proper IP address filtering is crucial. Now, you can feel free to view your website as much as you want without affecting your Google Analytics data.



Questions?

Find me on Twitter, or send me an email.