DEV Community

Ujjwal Dubey
Ujjwal Dubey

Posted on

Turn a Brand Audit Into a Diff: Snapshot Your Homepage Copy Before and After Fixes

Brand audits produce opinions. Developers like evidence. Here is a small way to turn "we improved the homepage tone" into something you can review like code: snapshot the copy that matters, make fixes, and diff.

I use this alongside a free AI website brand audit tool run before and after each change, so the tool's read and the actual text change sit side by side.

What to snapshot

Only what visitors and AI assistants read first:

  • <title> and meta description
  • the first <h1>
  • the first two paragraphs after it
  • button and link text in the hero

The script

import json, sys, requests, datetime
from bs4 import BeautifulSoup

def snapshot(url):
    html = requests.get(url, timeout=20, headers={'User-Agent': 'copy-snapshot/0.1'}).text
    s = BeautifulSoup(html, 'html.parser')
    h1 = s.find('h1')
    paras = []
    if h1:
        for p in h1.find_all_next('p', limit=2):
            paras.append(p.get_text(' ', strip=True))
    meta = s.find('meta', attrs={'name': 'description'})
    return {
        'url': url,
        'taken': datetime.date.today().isoformat(),
        'title': s.title.get_text(strip=True) if s.title else '',
        'meta_description': meta['content'] if meta and meta.has_attr('content') else '',
        'h1': h1.get_text(' ', strip=True) if h1 else '',
        'first_paragraphs': paras,
        'buttons': [b.get_text(' ', strip=True) for b in s.select('a.button, button')][:6],
    }

if __name__ == '__main__':
    print(json.dumps(snapshot(sys.argv[1]), indent=2, ensure_ascii=False))
Enter fullscreen mode Exit fullscreen mode
python snap.py https://example.com > copy-before.json
# ...edit the site, deploy...
python snap.py https://example.com > copy-after.json
diff -u copy-before.json copy-after.json
Enter fullscreen mode Exit fullscreen mode

Why this helps

  • Reviewable. The diff goes into the pull request description, so a founder can approve tone changes like any other change.
  • Catches regressions. A redesign that quietly drops the clear headline shows up immediately.
  • Honest. If the h1 is empty in raw HTML because the page renders client-side, you will see it. That matters, because many crawlers and audit tools read raw HTML.

Limits

This reads server-rendered HTML only. For client-rendered pages, add a headless browser, but fix the server rendering first if you can.

If the copy is now clear but enquiries still fall through, that is a workflow question; our services page explains how we approach it.

I run NxFlowAI (Mumbai). Code is illustrative.

Top comments (0)