[Code] Inflate YouTube Views

Inflate YouTube Views

I was reading an article about YouTube removing billions of video views as big players in the music industry were using “YouTube view” services, where providers will guarantee X number of views for a fee. I was wondering how one could possibly inflate YouTube views “naturally”, for free, and without much effort.


This started as merely an experiment to see if this is technically possible. I have not read the YouTube Terms of Service for publishers to see if this is allowed or if any party will be penalized. I am not using this as a tactic on any YouTube campaigns. This is also pretty shady and probably shouldn’t be used ever.

The Code

  var tag = document.createElement('script');
  tag.src = "http://www.youtube.com/player_api";
  var firstScriptTag = document.getElementsByTagName('script')[0];
  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

  var ytPlayer;
  function onYouTubePlayerAPIReady() {
    ytPlayer = new YT.Player('ytPlayer', {
      playerVars: { 'autoplay': 1},
      videoId: '14sYwECBmR8',
      height: '1', //cannot be less than 1 or it won't play
      width: '0',
      events: {
        'onReady': onPlayerReady}
  function onPlayerReady(event) {

How It Works

We use the YouTube Javascript API. The video is hidden on the page, not visible to users. The video auto-plays without sound so the visitor is unaware of the execution. The native YouTube player will track this view as if it were a normal embedded video, and will increase the total view count each time the video is executed.

  1. Lines 1-4 allows for parts of the YouTube embed code to be amended with additional parameters which we pass later in the script.
  2. Lines 6-16 creates the YouTube embedded player, specifies the video (in the example, we play a scene from A Few Good Men), set auto-play to true (so the video plays immediately once the page is loaded), sets the size of the video, and calls an event once loaded.
  3. Line 18-20 mutes the video once loaded so the visitor cannot hear it or know it is playing.

Download & Demo

  1. You may view the demo
  2. And you can download the full source code

Final Thought to Consider

Google does not like hidden content, which this would be – sort of. Hidden content is information placed on the website, which visitors cannot see. Google states they do not want it there for the sole purposes of search engines to read. However, we may be exempt from this because a) the content is hosted offsite, b) we are not jamming keywords to get the site to rank better in search engines, and c) it doesn’t matter if search engines sees this or not, because search engines crawlers won’t trigger the video to play.


Do you have any other ideas for how to inflate your YouTube views on the sly – without buying views? Let me know in the comments.


Tagged with: , ,
Posted in Code