April Fools Pranks with Google Tag Manager – 4 Konami Codes

Multiple websites have added Konami code as a joke to their websites. In case you don’t know, it’s a cheat code in many Konami games, where the cheat is executed with a sequence of key presses on the keyboard. In this blog post I’ll show several examples how you can easily add Konami code with Google Tag Manager to your website. Feel free to use them!

But first, a quick confession to my CEO:

Dear Rytis, Last year on April Fools, I added a Konami code to Soundest blogas a joke. I thought I would remove it soon but then forgot. Honestly. Months have passed. Now it’s almost a year. If you wish to see how it works, open our blog with desktop and type the following keyboard combination anywhere.

up, up, down, down, left, right, left, right, B, A

Anyway, I decided to keep it. Just like a kid keeps a pet found on a street.
Yours truly.

Ok, now let’s get back to the topic.

So what is Konami Code anyway?

The Konami Code is a cheat code that appears in many Konami video games, although the code also appears in some non-Konami games as well. Years later it became an internet meme and was adopted by multiple website creators.

Various web developers have hidden an Easter egg in their projects that can be accessed by entering the following sequence of key presses on the keyboard:

As an example I always mention Digg.When executed, Konami code changes images to a mosaic of Rick Astley and Never Gonna Give You Up starts playing in the background.

Here are few more examples (for science). I won’t spoil them, go see it for yourself:

How Can I Add Konami Code With Google Tag Manager?

The idea was introduced by Simo Ahava (who borrowed it from Gerry White). In his blog post he shared a Javascript code which listens to keyboard clicks. If the last ten pressed keys are ↑ ↑ ↓ ↓ ← → ← → B A, it fires a particular function – the KONAMI CODE.

Since April Fools is coming, I decided to collect and publish several Konami codes as ready-made Google Tag Manager Recipes.

Each template not only contains the actual Konami code, but it also fires an event to Google Analytics after someone enters that magic keyboard combination. You know, for science… as usual.

Option #2. You Modify RICk Roll Script from this Blog Post

Edit URL (see the screenshot below) – a link to a publicly accessible audio file. If you plan to upload a file to Dropbox, make sure you add ?dl=1 at the end of the link.

In lines 5-8 add phrases that will be randomly displayed on the screen. There’s no limit, so you can add as many additional lines as you want. Just make sure there’s no comma after the last list item. Here’s an example:

JavaScript

1

2

3

4

5

6

varrickroll=newrickroll([

'Never Gonna Give You Up',

'Never Gonna Let You Down',

'Another text',

'Example'

]);

Or if you don’t want any text to be displayed at all, remove all list items like this:

JavaScript

1

2

varrickroll=newrickroll([

]);

The most recommended way is to remove rickroll variable from this Javascript (JS) code as well and remove the part of code responsible for display of random text. But that requires some Javascript knowledge. So if you don’t feel confident about your JS skills, leave the the code as it is and only change what I tell you.

Change the link of image/GIF that will be used by the script. Try not to use too large image – if it takes more than several megabytes, it will take longer to load. Try being as optimal as possible.

And there you have it! Your custom Konami code ready to be published with Google Tag Manager. Just make sure you test it before going live. Preview and debug mode is your best friend!

A call for Contribution

I have a small favor to ask – if you know other hilarious Javascript codes that can be universally used as Konami codes on any website, share a link in the comments and I’ll add it to this blog post.

Conclusion

In this blog post I have shared several examples how you can easily add Konami code with Google Tag Manager to your website. Each code can be downloaded from Library of GTM recipes and easily imported to your Google Tag manager container.