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 blog as 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:

Konami code

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.

Digg Konami code

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.


#1. Doge


I used this one in Soundest’s (startup where I work) blog. Unfortunately I cannot find the original author of this script anymore. If you know, contact me and I’ll add a link to his/her website.

What does this Konami code do?

  • It checks images on the page and replaces them with image of Doge (remember this meme?)
  • It also randomly displays on the screen various words using Comic Sans.


#2. Classic RICK RoLL

Good Guy Rick Astley

What does this Konami code do?

  • It checks images on the page and replaces them with a GIF of dancing Rick Astley.
  • Plays Never Gonna Give You Up in the background.
  • And also randomly displays lyrics on the screen using Comic Sans.


#3. Harlem Shake

Harlem shake gif

Another dead meme. Yay! This Konami code for Google Tag Manager is based on a meme from 2013. Yeah, it’s four years old. Feeling much older, huh?

Anyway, I took this Javascript which turns your website into some crazy party, connected it with Simo Ahava’s Konami code listener and made a GTM recipe for you. You’re welcome!


#4. Shooting Star

Ok, let’s milk the same Konami code one more time. But first, here’s the meme this Konami code was based on. It was really popular about a month ago.

I used Rick Roll’s Javascript but with different GIF and background music. You can try it by clicking the button below and entering the Konami code’s keyboard combination.


Create your own Konami code for Google Tag Manager

If you’re not happy with what is offered in this blog post, there are two ways you can easily create your own Konami code.


Option #1. You already know Some Awesome Javascript code

In that case:

  1. Download any ready-made Konami code GTM recipe from this blog post.
  2. Open cHTML – [xxx] Konami code[xxx] stands for Doge, Rick Roll or any other title that I used in the GTM container.
  3. Remove all Javascript from that tag and paste yours.
  4. Do not forget to rename the tag – replace [xxx] with some title that clearly describes your new Konami code.
  5. Test your new code with Preview and Debug mode.
  6. Publish.


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

Download Rick Roll Konami code for Google Tag Manager, open cHTML – Rick Roll Konami Code tag and edit Javascript according to the following instructions:

  1. 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.
    Edit audio link
  2. 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:

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

    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.
  3. 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.
    edit img link in script

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.



Remember, you can always add humor to serious topics. Web analytics isn’t an exception.

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.

Once the visitor enters ↑ ↑ ↓ ↓ ← → ← → B A on his/her keyboard (while being on a website) a funny Javascript function (Konami code) will be executed.

This page also contains a Konami code. Try it yourself!

Konami code with Google Tag Manager

If you know other universal Javascript codes that can be used as Konami code, share a link in the comments.

Julius Fedorovicius

Head of Developer Operations at Omnisend. I am highly interested in Google Tag Manager, Google Analytics, Google Ads, Email marketing, Email Deliverability, Digital Marketing in general. You can follow me on Twitter or Linkedin.