Automation and Data-Driven Decision: Hands-on Practice

We make too many decisions every day and hour of our lives. Sometimes we make these decisions based on our feelings, and sometimes based on our own previous experiences. Based on your personal experience, which decision led to a positive result in line with your end goal? feeling-based decision or experience-based decision?

I hope your answer is experience-based decision, if your answer is feeling-based based you are not suited for this article, Please leave as soon as possible!!!

That was a joke, but in the business field, decisions should be made based on data. If you want to base your business on feelings, you will probably lose money and time on the trial-and-error process.

What is a data-driven decision?

Let's say you want to create educational YouTube videos. You can jump right into video recording and keep uploading on YouTube, or you can study existing videos, analyze their likes, comments, length, title, description, and tags, and find the relation between them and their ranking and views. Which path will you pick? If your answer is jump right into the recording, I'm serious, this time leave as soon as possible, this article is not for you.

Why a Data-Driven approach?

The answer is really simple: the most important benefit of data-driven decision making is to accomplish your goal and celebrate the result you were looking for.

Hands-on Practice: How long should a YouTube video be

We are done with the reading part, let's get our hands dirty. We want to create an educational YouTube video about the n8n framework and reach a high number of views. There are many questions, and one of them is how long my video should be. This has a high impact on views number and engagement (likes and comments).

Let's break down what we want to do

Content TypeKeywordGoalWhat data we need ?
Educationaln8nHigh number of <b>views</b>, <b>likes,</b> and <b>comments</b>Youtube videos that has n8n in their title, description and tags, their length and number of likes and comments

We are going to use n8n to pull YouTube videos and log them in a Google Sheet. If you want to follow along, create an account in n8n and launch your instance, or self-host your n8n in your infrastructure

Step 1 - Add trigger and Get Videos

Let's start by adding a manual trigger node, so when we click on Execute workflow Button it starts

In the Get many videos node, we add n8n in the query field and pull existing videos

This returns ~600 videos.

Step 2 - Find Each Video Attribute

The previous node provides overall data about the videos, but it doesn't contain data like the number of comments, likes, and duration. To find this information, let's add a loop node to control the number of videos on each batch we want to process, so we don't hit the YouTube rate limit and use a YouTube Get a Video node to find a specific video using its id and write its data to a Google Sheet and wait for a couple of seconds before moving to the next batch. We also need a Code node to convert the Duration ISO 8601 string, like PT26M36S to a more human-readable number in minutes, like 26.6

Before writing the videos to the Google Sheet, let's filter them first. We don't want to use our resources to process videos with a low number of views since we want to analyze and find what works, not what doesn't work. We add a new Conditional If node to only process videos to have X number of videos. In our case, let's use 1000 views as our base number

Loop Node

If Node

TO make sure each item is a video and not channel or other content type, we add a condition to make sure {{ $json.id.kind }} is equal to youtube#video

Get a Video Node

Add a new Get a Video node to pass {{ $json.id.videoId }} as video id

Code Node

Let's add a new Code Node to sanitize each video data and calculate duration in minutes, and return fields we care about

If Node

Let's add a new conditional node to only process videos that have more than 1000 views. Set {{ $json.Views }} to is greater than 1000

Google Sheet Node

Now let's update the Google Sheet with video data

Wait Node

Now let's wait for 15 seconds and go to the next item

Step 3 - Define Best Video Length

In this step, we analyze each video's duration, defined in minutes, and determine which duration is best.

Start By Adding a Sheet Get Rows Node that pulls all of the rows in the Google Sheet we created previously

Add a Code Node to analyze videos by defining different bins of videos by their duration range (the delta starts small, but for higher durations, a couple of minutes doesn't have too much difference)

Now connect the Manual Workflow Execution node to this workflow and see the result. In my case, the result is

I found the answer to my question the length should be between 30-60 minutes. But to have a video that performs well on YouTube, I need to answer more questions

  • What Tags should I use?
  • What is YouTube Short videos' performance?
  • What people are asking in the comments of videos?
  • What is the audience's main language?
  • What topics should I cover that others didn't in their videos ?

These are important questions you should find answers for before you start creating your videos. I leave them as homework for you.

If you need any help with implementations for those questions, contact me at amir@cubite.io, and I would be more than happy to answer any questions.

Conclusion

Data-driven decision making is a crucial practice to achieve our business goals with the lowest amount of risk and resource cost. To begin with, define your goal. In our example, our goal was getting 1000+ views for our YouTube video. Next, write a list of questions like: What should be the length of the video? What tags should I use? etc and then implement an automation to gather data and implement a logic to process that data to answer your questions.

Related Blogs

Looking to learn more about n8n, youtube and data driven decisions? These related blog articles explore complementary topics, techniques, and strategies that can help you master Data-Driven Decision Making & Automation: YouTube Video Length Analysis.

How to Build an AI Agent for Automated Financial Market Summaries Using n8n

Learn how to create a powerful AI agent that autonomously analyzes financial news and market data to deliver real-time, actionable market summaries. This step-by-step guide walks you through leveraging n8n’s low-code automation platform combined with AI models like GPT to build a smart financial assistant that senses, plans, acts, and learns — helping investors and traders make informed decisions faster.

Build an AI Agent for Airbnb Hosting with n8n

Learn how to create a powerful AI agent for Airbnb hosts using Telegram and n8n. Automate guest messaging, manage bookings, and streamline operations with AI-driven workflows—no coding required. Boost efficiency and guest satisfaction today!

How to Automate Reddit Data Extraction with n8n for Quality Content Ideas

Learn how to automate Reddit data extraction with n8n to pull and score high-quality posts for content ideas. This step-by-step guide shows you how to set up workflows that filter and sanitize Reddit posts using a custom scoring system, helping you generate valuable, targeted content inspiration effortlessly.