How to Live Monitor YouTube Views and Google Analytics With a Raspberry Pi

People who make YouTube videos or produce web content often set up dedicated displays to monitor performance statistics live, such as YouTube Analytics and Google Analytics. The live analytics data can give an insight of trending content, while the statistics can be used to quickly tweak and optimize related content.

In an ideal world, live monitoring should start at the flip of a power switch or the push of a power button on the television remote. A Raspberry Pi connected to a television or a monitor is ideal for this.

4

Using a Raspberry Pi for Live Analytics Saves Energy

Compared to regular computers that use 230V, 110V, 19V or a 12V power supply, the Pi can be powered by the TV’s 5V USB port. So, switching on/off using the TV remote will boot the Pi and turn it off along with the TV, resulting in power savings.

This implementation works with Pi4 as well as the Pi3. Many Pi3s are shelved because of an upgrade to the much more powerful Pi4. This use case will find a purpose for those Pi3s as it has sufficient processing power to drive this activity.

Woman looking at Live Google Analytics on a monitor

Energy Consumption of a Raspberry Pi

A Pi4 running at standard clock consumes six watts of power and an overclocked Pi4 consumes 8 Watts.

Total energy consumption in a year (12 hours of usage daily):

Woman looking at Live YouTube Analytics on a monitor and discussing with others

8 (Watts) x 12 (Hours) x 365 (Days) = Around 35 KWh

Compared to the Pi4, PCs use much higher power. A Mini PC which is at the lower end of the power consumption spectrum, has a processor that is usually rated to consume around 15 Watts. Club that with the power consumption of the motherboard, and it is in the zone of 25 Watts.

Raspberry Pi3 and Raspberry Pi4 single board computers

25 (Watts) x 12 (Hours) x 365 (Days) = Around 110 KWh

The calculation shows that the Pi can save around 75 units of electricity every year. Mini PCs may have the additional processing power, but you would not use the excess anyway for live monitoring.

Many raspberry pis top view of the circuit board

All of this points to the Pi being the right device for the purpose. It has just the right amount of processing power, and it consumes little power. It has a small footprint and can be powered from the host USB using a single cable (less clutter).

Live Monitoring on Various Raspberry Pi Operating Systems

Among browsers, Firefox is well-suited for the purpose since it has the right extensions.

How to Start Firefox at Startup on Raspberry Pi OS

Since Raspberry Pi OS does not come with Firefox installed by default, you can install it by typing this command in the terminal:

To run Firefox at startup, edit a file:

Add a line:

On Ubuntu Flavors

Ubuntu Desktop and Ubuntu Mate come with Firefox pre-installed.

To start Firefox at startup on Ubuntu OS:

Navigate toMenu > Control Center > Startup Applicationsand add an entry:

How to Disable Screen Blanking on Raspberry Pi

To prevent screen blanking, power management for the display must be configured.

On Raspberry Pi OS

In the terminal:

Reboot the Pi and open Screensaver. Set screensaver to disabled, click power management and set all the values to zero.

On Ubuntu Desktop

Navigate toMenu > Control Center > Power Management

And turn off display blanking

From here, the instructions are common for all OS.

How to Set Up YouTube Analytics URLs for Live Monitoring

Along with live analytics,YouTube Studio has many features built-in. Open Firefox and sign in to Youtube Studio.

Navigate toAnalytics > See more

Go to full screen mode by pressing F11 and adjust the zoom to fit the live analytics content to fit perfectly.

you may also turn on the Dark Mode, it is easy on the eyes.

How to Set Up Google Analytics URLs for Live Monitoring

Google Analytics is a great way to measure website performance. Open Firefox and sign in to Google Analytics.

ExpandRealtime,Contentwill show you the currently visited pages:

To see which part of the world is visiting your web pages, useLocations.

Remember that it’s possible to adjust the zoom for the world map to fit well to your view port.

How to Display Google Analytics in Dark Mode

Google Analytics does not have a Dark Mode like YouTube Analytics.

However, this can be achieved using theDark Readerextension.

Although Dark Reader works fine, it has a processor overhead. It will work fine even with the Pi3 at the expense of slightly more power consumption.

Open Analytics URL Automatically When Firefox Starts

In Firefox, navigate toHome > Settings. Choose Custom URLs and paste the analytics URL.

How to Handle Firefox Restore Pages

The URL set inSettings > Homewill open automatically only when Firefox is shutdown cleanly. But, you would just power on/off the Pi using a switch, and doing so is not a clean shutdown. Firefox will show the Restore page when this happens:

To disable restore, type this in Firefox URL bar:

Accept the risk, search for:

Set it to false

Protect the Pi’s microSD Card From Getting Corrupted

You are going to just turn the power off for the Pi during daily use (for say, using the TV remote). This is not a clean shutdown and there is a minute possibility of the microSD card getting read-only locked.

The corruption does not happen when data is read from the microSD card but possibly when data is written to it. To prevent this you can stop Firefox from using the microSD card for disk cache.

Type this in Firefox URL bar:

Search for:

Set it to false and Firefox will only use the memory cache instead.

How to Run Firefox in Full Screen at Start

There are different ways to run Firefox full screen, such as running it as a kiosk. But, the easiest way is to use an extension calledAutoFullscreen.

OpenAdd-ons and themesfrom the Firefox menu, search for AutoFullscreen and install. It is a small piece of code with no processor overhead. Once installed, it will run Firefox in full screen at start. Unlike kiosk mode, you can use F11 to switch back to window mode.

Get the Pi to Auto-Update Itself to Maintain Security

This being an unmanaged Pi, if it is not updated at all, then it becomes a potential security risk. Unattended upgrades is a smooth way to patch security vulnerabilities automatically. Open the terminal and install it using:

Switch Between YouTube Analytics and Google Analytics Automatically

A Pi3 has enough processing power and RAM to drive a single live analytics monitor. If you want to run both YouTube and Google live analytics intermittently, you will need to use a Pi4.

In Firefox, sign in to both YouTube and Google Analytics in different tabs. Set the URLs inSettings > Home > Custom URLsto open both pages at startup.

Install a Firefox extension calledTab Rotator, it will rotate the tabs at predetermined intervals. Go to the Preferences of the extension and set the Rotation Time in seconds. Suppose you want to show YouTube Analytics for ten minutes and Google Analytics for five minutes, you would set it as:

Prevent or Minimize Screen Burn In for Televisions and Monitors

Modern monitors and televisions have built-in features like “pixel shifting” to minimize image retention, which usually happens when the same screen elements are shown for extended periods of time. This effect of burn in is much less in LCD displays compared to OLED displays. If you are using an expensive display, image retention can be reduced to an extent by displaying a blank screen intermittently; a few minutes during every hour should do the trick. If you are already rotating YouTube and Google Analytics screens, this step is not needed.

Install the Tab Rotator extension that is discussed above. Set the second URL as:

And set the timings:

Setting so will display Analytics for 59 minutes and a blank screen for one minute, every hour. This will minimize image retention.

Set It Up Once and the Pi Will Serve Well for Many Years

This is a close to perfect setup of live analytics monitoring using a Raspberry Pi. It should serve well to meet your needs. you may tweak the URLs, adjust the zoom factor and toggle the extensions to make it suit your needs for any other live monitoring services as well.

What would you do if you want to manage your Pi or change any of the URLs remotely? Connecting to your Pi via SSH or using VNC to view your Pi’s screen are the options to explore.

Access and control your Raspberry Pi remotely via SSH from any computer or even an Android phone.

Who asked for these upgrades?

Anyone with more than a passing interest in motorsports must see these films.

The key is not to spook your friends with over-the-top shenanigans.

OneDrive is one of the best, but it has a catch.

I plugged random USB devices into my phone and was pleasantly surprised by how many actually worked.

Technology Explained

PC & Mobile