Back to Portfolio

PostPilot AI: Data-driven content generation

Automatic content recommendation and generation system for corporate blogs based on business data and web analytics

Summary
185
Overview

    What happens when a company uses artificial intelligence to write content without taking into account what is actually happening in its business?

    You can generate correct, well-structured, and seemingly SEO-optimized articles, but without knowing which pages are performing well, what topics interest your visitors, or what the organization's business priorities are.

    This was the question that gave rise to PostPilot, my Final Degree Project in Data Science at the Universitat Politècnica de València.

    PostPilot is a decision support system that combines web analytics, financial information, machine learning models, and generative artificial intelligence to transform business data into editorial recommendations and content drafts.

    Their goal is not simply to automate writing, but to achieve that The AI knows why it is writing content before it starts generating it..

    The problem: having data doesn't mean knowing what to do with it.

    Companies have tools like Google Analytics 4 to measure the performance of their website and accounting information to understand their financial situation.

    However, this data is usually analyzed separately. A dashboard allows you to visualize visits, sessions, and trends, but it's still necessary to interpret those results and decide what actions to take.

    On the other hand, language models can generate articles from instructions, but they do not automatically know a company's priorities or the historical performance of its publications.

    PostPilot connects both worlds: It uses analytical models to identify opportunities and converts its results into structured instructions for a model language.

    How PostPilot Works

    1. Data Ingestion and Preparation

    The system processes two main sources:

    • Google Analytics 4: sessions, landing pages, interaction time, and traffic evolution.
    • Financial information: historical balance sheets, revenues and business margins.

    An ETL pipeline developed in Python and Pandas cleans, normalizes, and structures CSV files, handling missing values, temporary formats, and records that do not represent editorial content.

    This stage provides a consistent database for subsequent models.

    2. Content segmentation with K-Means

    PostPilot uses unsupervised learning to rank web pages based on their traffic and dwell time.

    Using K-Means, with four groups, it identifies different performance patterns:

    • Top Performers: content with good traffic and retention.
    • Hidden Gems: Articles that retain the reader, but receive few visits.
    • Bouncing High: Pages that attract visits, but show little retention.
    • Underperformers: content with low performance in both dimensions.

    The result is a visual matrix that helps decide which content to reinforce, promote, or review.

    3. Traffic prediction with Prophet

    The second model uses time series to estimate the evolution of monthly traffic and identify possible seasonal patterns.

    To do this, PostPilot incorporates Meta Prophet, configured to analyze annual trends and seasonality.

    During the evaluation of the final degree project, the model obtained a mean absolute error (MAE) of 18.4 monthly sessions in the test set used.

    These predictions allow us to propose an advance publishing calendar, taking into account the periods in which demand historically increases.

    4. Business Health Score: business context for AI

    One of the components I designed specifically for PostPilot is the Business Health Score (BHS).

    It is a 0 to 100 indicator that combines financial and digital variables to offer a synthetic diagnosis of the company.

    The model assigns up to 60 points to financial indicators and up to 40 to digital performance.

    Its function is not to replace professional financial analysis, but to provide the generating engine with an interpretable signal about the business context.

    Based on that score, the system adjusts recommendations related to tone, priorities, and editorial frequency.

    The current thresholds are heuristic and part of a prototype; their generalization would require validating them with data from more companies.

    From analytical models to generative artificial intelligence

    This is the central part of PostPilot.

    Before generating an article, the backend gathers the results from the models and builds a dynamic prompt with:

    • Company context and its activity.
    • Business Health Score Diagnosis.
    • Content catalog performance.
    • Traffic trends and predictions.
    • Editorial priorities.
    • Structure, format and SEO requirements.

    The engine uses language model APIs to generate a structured proposal, with title, metadata, and content.

    The architecture includes a primary generation provider and an alternative backup mechanism to manage potential service failures.

    The important thing is that the generation does not begin with a generic prompt, but with decisions previously derived from the data.

    Technological architecture

    I developed PostPilot using a web architecture that separates the analytical components, the generation, and the user interface.

    Backend and data: Python, FastAPI, Pandas, scikit-learn, Prophet and Pydantic.

    Frontend: React, with interactive visualizations of web performance, predictions, and recommendations.

    Artificial intelligence: Integration of OpenAI and Gemini APIs, generation using dynamic prompts and structured responses.

    Integrations: Google Analytics 4 and SABI as data sources via exported files, and the WordPress REST API to send content to the CMS.

    Quality: Data validation, error management, and automated testing with Pytest.

    The system incorporates human supervision before the generated content reaches its editorial destination.

    Validation with a real company: Enervia

    The project was developed and evaluated using historical data from Enervia Energy Solutions, a Valencian company specializing in uninterruptible power supply systems.

    With authorization to use their data in the context of the TFG, I analyzed web traffic records from June 2023 to September 2025 and corresponding financial statements from 2009–2023.

    After processing and cleaning the data, the analyzed catalog contained 57 unique URLs and 2,024 landing page records.

    Among the results obtained, the following stood out:

    Detection of content with high traffic and low retention. The model identified pages that attracted many visits, but where users spent little time, pointing to opportunities to review their content and structure.

    Identification of seasonal patterns. Prophet made it possible to detect traffic cycles and use those forecasts to anticipate content proposals.

    Generation of a contextualized editorial strategy. The BHS and analytical results were translated into instructions for the generative engine. In the case studied, the system obtained a BHS of 50/100 and recommended a stability editorial strategy.

    This validation demonstrates the technical feasibility of the approach in the case analyzed. It does not yet constitute proof of effective improvements in sales, conversions, or SEO ranking in the long term.

    ARTIFICIAL INTELLIGENCE DATA SCIENCE RAG AUTOMATION chatbot PYTHON APIs UI / UX DESIGN WEB APPLICATIONS SYSTEMS INTEGRATION Data science ARTIFICIAL INTELLIGENCE DATA SCIENCE RAG AUTOMATION chatbot PYTHON APIs UI / UX DESIGN WEB APPLICATIONS SYSTEMS INTEGRATION Data science
    TECHNOLOGY STACK

    Tools and technologies that I use

    A selection of the tools, languages, and platforms I use to develop AI solutions, automation, data analytics, and web applications.

    ChatGPT
    ChatGPT

    Generative AI and development

    Claude
    Claude

    Generative AI and analytics

    Gemini
    Gemini

    Multimodal AI and development

    GitHub
    GitHub

    Version control

    Notion
    Notion

    Organization and documentation

    Cloudflare
    Cloudflare

    Web security and performance

    Python
    Python

    Development, data and AI

    Docker
    Docker

    Containers and deployment

    PHP
    PHP

    Backend web development

    ✉ SHALL WE TALK?

    Let's talk

    If we share interests in artificial intelligence, data, or software development, I'd be happy to exchange ideas. You can also contact me for professional matters.

    Read the blog