Category: Code

A place for code php, ruby, javascript, jquery, html, css etc.

micro conversion example

Micro Conversions | Complete Guide To Optimising & Scaling With Micro Conversions

What are micro conversions? Micro conversions are minor events such as clicks and scrolls that we can use to track visitor behaviour and optimise advertising and landing pages faster. They are generally not directly linked to key performance indicators for an advertising campaign but can be used to scale (increase traffic volumes) more effectively. Scale Campaigns Profitably Micro conversions are most valuable when you are scaling a campaign across multiple...

8 Tips For The Perfect Blog Post

This is the revised 2020 complete guide to the best practices when creating content for your blog. You you can use this framework to create a the “perfect blog post” and move your site up the search engine rankings. The Title The title or headline of a blog post should be a close match to a search query but also just clickbaity enough to get a higher click through rate...

How to encrypt text in Visual Studio Code (VSCode)

I wanted a way to quickly encrypt and decrypt files in Visual Studio Code using a memorised pass phrase so I created an easy to use plugin. VSC has become the text editor of choice for most developers and it is relatively simple to create and publish a plugin using Javascript or Typescript. The Encryption-VScode plugin uses AES encryption to encrypt/decrypt the contents of the current text file. The Crypto-JS...

Preventing Mobile Browsers From Turning Off

The following code has been published which prevents a mobile browser from going into sleep mode. This was affecting setTimeout functions as the javascript code in the browser is effectively paused preventing the event loop from processing once sleep mode is activated. I originally looked at nosleep.js but ended up simplifying the code and putting it into a standard module for Vue.js https://github.com/jamesbachini/StayAwake.js The code works by looping through a...

Search For Satoshi

In 2008 an anonymous user with the alias Satoshi Nakamoto posted the original Bitcoin whitepaper to the Cryptography mailing list. Satoshi mined a lot of the early Bitcoin blocks and the rewards that are held in bitcoin wallets associated are estimated to be around 1 million BTC or 10 Billion USD. If Bitcoin eventually reaches $120k, Satoshi will become the richest man in the world. These wallet addresses and no...

Pop Under Code 2020

Updated January 2020 This code is used for running pop under traffic on your own site. It adds an onclick function to every link on the page which opens a new tab with the clicked link and changes the existing window (underneath) to a popped ad url. Make sure you change the var puURL from http://Google.com to whatever you want to pop. The number 3600 in the code is number...

Passing URL parameters (GET variables) on a PHP redirect

Update Feb 2020 The query parameter string is stored in the following variable $_SERVER[‘QUERY_STRING’] So for the URL: server.com/index.php?test=123&hi=hello the $_SERVER[‘QUERY_STRING’] will contain this string “test=123&hi=hello” We can then pass this out when redirecting landing page (see code below from original blog post). If you want to access a single variable then you can use $_GET[‘variableName’]; From the example above $_GET[‘hi’] === “hello” If you want to forward on the...

Wasabi Opensource A/B Testing Platform

Intuit have opensourced a enterprise grade A/B testing platform called Wasabi. This runs as an API on a separate server from your site/landers. It isn’t the easiest thing to setup and will require some knowledge of using the command line from a linux based system. You can setup multiple split tests on your website. For example you may want to test two different headlines or another test might be different...

How to display different banners for web/mobile

Adsense’s flex box has made it really simple to put in a piece of code which adapts to the size of available space. I had a situation where I wanted to put my own banners in and then realised I didn’t have the code to change the banner depending on the screen size. What I wanted was a dynamic ad block that displayed different ads depending on the width of...

Block bots and crawlers with .htaccess and robots.txt

If you want to block search engine and crawler bots from visiting your pages you can do so by uploading the following files to the / directory on your site. Double check you aren’t rewriting over any .htaccess file before you do it. http://jamesbachini.com/misc/blockbots/robots.txt http://jamesbachini.com/misc/blockbots/.htaccess (.htaccess link doesn’t work because it’s a no read file. So I have uploaded them as a zip) Download both files in a zip These...