[object Object]

← back to Ga Allsites

portfolio landing rollout: dns_point + GA4/deployment audits (73 domains live)

d52d9fa8a03802881e3065f1c484b59d19fa5be2 · 2026-08-17 13:58:44 -0700 · Steve Abrams

Files touched

Diff

commit d52d9fa8a03802881e3065f1c484b59d19fa5be2
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Aug 17 13:58:44 2026 -0700

    portfolio landing rollout: dns_point + GA4/deployment audits (73 domains live)
---
 _final_audit.py |  36 ++++++++++++++++++
 _ga4_audit.py   |  46 +++++++++++++++++++++++
 dns_point.py    | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 194 insertions(+)

diff --git a/_final_audit.py b/_final_audit.py
new file mode 100644
index 0000000..41d1db1
--- /dev/null
+++ b/_final_audit.py
@@ -0,0 +1,36 @@
+import json,pathlib,re,ssl,urllib.request
+from concurrent.futures import ThreadPoolExecutor
+cand=json.loads(pathlib.Path("cache/_candidates_noconf.json").read_text())
+ctx=ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE
+PARK=re.compile(r"(domain (is )?for sale|buy this domain|parked|godaddy|afternic|sedoparking|hugedomains|dan\.com|coming soon|under construction|default web page|welcome to nginx|apache2 ubuntu|it works!|future home)",re.I)
+REAL=re.compile(r"(<nav|<article|add to cart|shop|our services|©\s*20|privacy policy|contact us|sign in|log ?in|<form)",re.I)
+def dslug(d): return "".join(c for c in d.rsplit(".",1)[0].lower() if c.isalnum())
+def probe(d):
+    for scheme in ("https","http"):
+        try:
+            req=urllib.request.Request(f"{scheme}://{d}/",headers={"User-Agent":"Mozilla/5.0"})
+            r=urllib.request.urlopen(req,timeout=10,context=ctx)
+            final=r.geturl(); html=r.read(120000).decode("utf-8","ignore"); code=r.getcode()
+            off = dslug(d) not in dslug(final.split("//")[-1].split("/")[0])
+            if off: return (d,"REDIRECT_OFF",final[:50])
+            if PARK.search(html) or len(html)<500: return (d,"EMPTY_PARKED",f"{code} {len(html)}b")
+            if REAL.search(html): return (d,"HAS_SITE",f"{code} {len(html)}b")
+            return (d,"THIN",f"{code} {len(html)}b")
+        except Exception as e:
+            if scheme=="http": return (d,"DEAD",str(e)[:30])
+    return (d,"DEAD","")
+with ThreadPoolExecutor(max_workers=24) as ex:
+    res=list(ex.map(probe,cand))
+from collections import defaultdict
+b=defaultdict(list)
+for d,c,info in res: b[c].append(d)
+print("=== final audit of 87 no-Kamatera-conf candidates ===")
+for k in ["EMPTY_PARKED","DEAD","THIN","REDIRECT_OFF","HAS_SITE"]:
+    print(f"  {k:14} {len(b.get(k,[]))}")
+# SAFE to build = genuinely empty (parked/dead). THIN = borderline (manual). Others = leave alone.
+safe=sorted(b.get("EMPTY_PARKED",[])+b.get("DEAD",[]))
+pathlib.Path("cache/_safe_to_build.json").write_text(json.dumps(safe))
+pathlib.Path("cache/_thin_review.json").write_text(json.dumps(sorted(b.get("THIN",[]))))
+print(f"\n>>> SAFE TO BUILD (genuinely empty): {len(safe)}")
+print(f">>> THIN / needs eyeball: {len(b.get('THIN',[]))}")
+print(f">>> leave alone (has site / redirects): {len(b.get('HAS_SITE',[]))+len(b.get('REDIRECT_OFF',[]))}")
diff --git a/_ga4_audit.py b/_ga4_audit.py
new file mode 100644
index 0000000..a4f5573
--- /dev/null
+++ b/_ga4_audit.py
@@ -0,0 +1,46 @@
+import json,pathlib,re,urllib.request,ssl
+from concurrent.futures import ThreadPoolExecutor
+def slug(s):
+    x=s.lower().replace(" - ga4","").replace("&","and"); return "".join(c for c in x if c.isalnum())
+def dslug(d): return "".join(c for c in d.rsplit(".",1)[0].lower() if c.isalnum())
+data=json.loads(pathlib.Path("cache/data.json").read_text())
+ga4={slug(r["property"]) for r in data["rows"]}
+port=json.loads(pathlib.Path("cache/_portfolio_domains.json").read_text())["union"]
+missing=[d for d in port if not any(dslug(d)==g or dslug(d) in g or g in dslug(d) for g in ga4 if g)]
+ctx=ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE
+PARK=re.compile(r"(domain (is )?for sale|buy this domain|parked|godaddy\.com/domainsearch|afternic|sedoparking|this domain may be for sale|hugedomains|dan\.com|is coming soon|website coming soon|under construction|default web page|welcome to nginx|apache2 ubuntu default)",re.I)
+GA4=re.compile(r"(G-[A-Z0-9]{6,}|googletagmanager\.com/gtag/js|gtag\('config'|UA-\d{4,})")
+def probe(d):
+    url=f"https://{d}/"
+    try:
+        req=urllib.request.Request(url,headers={"User-Agent":"Mozilla/5.0 (audit)"})
+        r=urllib.request.urlopen(req,timeout=12,context=ctx)
+        final=r.geturl(); html=r.read(200000).decode("utf-8","ignore"); code=r.getcode()
+    except Exception as e:
+        return (d,"DEAD",str(e)[:40],False,"")
+    off = dslug(d) not in dslug(final.split("//")[-1].split("/")[0])
+    has_ga4=bool(GA4.search(html))
+    if PARK.search(html) or len(html)<400:
+        cls="PARKED"
+    elif off:
+        cls="REDIRECT"
+    else:
+        cls="LIVE"
+    return (d,cls,f"{code}",has_ga4,final if off else "")
+with ThreadPoolExecutor(max_workers=20) as ex:
+    res=list(ex.map(probe,missing))
+from collections import Counter,defaultdict
+buckets=defaultdict(list)
+for d,cls,info,ga,final in res:
+    key = "LIVE_HAS_GA4" if (cls=="LIVE" and ga) else cls
+    buckets[key].append((d,info,final))
+print("=== GA4 AUDIT of the 162 no-match domains ===")
+for k in ["LIVE","LIVE_HAS_GA4","REDIRECT","PARKED","DEAD"]:
+    print(f"  {k:14} {len(buckets.get(k,[]))}")
+install=[d for d,_,_ in buckets.get("LIVE",[])]
+pathlib.Path("cache/_ga4_install_list.json").write_text(json.dumps(sorted(install)))
+print(f"\n>>> INSTALL LIST (live site, genuinely no GA4): {len(install)}")
+for d in sorted(install): print("  ",d)
+if buckets.get("LIVE_HAS_GA4"):
+    print(f"\n(already has a tag, just name-mismatched — no action: {len(buckets['LIVE_HAS_GA4'])})")
+    for d,_,_ in sorted(buckets["LIVE_HAS_GA4"])[:20]: print("   ~",d)
diff --git a/dns_point.py b/dns_point.py
new file mode 100644
index 0000000..b76ddcb
--- /dev/null
+++ b/dns_point.py
@@ -0,0 +1,112 @@
+#!/usr/bin/env python3
+"""Point domains' apex(+www) A records at Kamatera (45.61.58.125), DNS-only.
+Handles Cloudflare (API) + GoDaddy (API). Skips CF-Worker-bound apexes.
+Idempotent + resumable. Prints a READY list (domains now pointing at Kamatera,
+safe to cert) and a SKIP list. Usage: python3 dns_point.py d1.com d2.com ..."""
+import json, os, pathlib, subprocess, sys, urllib.error, urllib.request
+
+IP = "45.61.58.125"
+ENV = pathlib.Path.home() / "Projects" / "secrets-manager" / ".env"
+
+
+def ev(*ks):
+    for k in ks:
+        if os.environ.get(k):
+            return os.environ[k]
+    for line in ENV.read_text().splitlines():
+        line = line.strip()
+        for k in ks:
+            if line.startswith(k + "="):
+                return line.split("=", 1)[1].strip().strip('"').strip("'")
+    return ""
+
+
+CF = ev("CLOUDFLARE_API_TOKEN", "CF_API_TOKEN")
+GK, GS = ev("GODADDY_API_KEY"), ev("GODADDY_API_SECRET")
+
+
+def cf(url, method="GET", payload=None):
+    req = urllib.request.Request(url, method=method,
+        data=json.dumps(payload).encode() if payload else None,
+        headers={"Authorization": f"Bearer {CF}", "Content-Type": "application/json"})
+    try:
+        return json.loads(urllib.request.urlopen(req, timeout=30).read())
+    except urllib.error.HTTPError as e:
+        return {"__err__": e.code, "__body__": e.read().decode()[:200]}
+
+
+def ns_host(d):
+    try:
+        out = subprocess.run(["dig", "+short", "NS", d], capture_output=True, text=True, timeout=15).stdout.lower()
+    except Exception:
+        out = ""
+    if "cloudflare" in out:
+        return "cf"
+    if "domaincontrol" in out:
+        return "godaddy"
+    return "other"
+
+
+def point_cf(d):
+    z = cf(f"https://api.cloudflare.com/client/v4/zones?name={d}").get("result")
+    if not z:
+        return "SKIP no-cf-zone"
+    zid = z[0]["id"]
+    for name in (d, f"www.{d}"):
+        recs = cf(f"https://api.cloudflare.com/client/v4/zones/{zid}/dns_records?name={name}").get("result", [])
+        # remove parking placeholders / conflicting CNAME so an A can live here
+        for r in recs:
+            if (r["type"] == "AAAA" and r["content"] in ("100::", "::")) or r["type"] == "CNAME":
+                cf(f"https://api.cloudflare.com/client/v4/zones/{zid}/dns_records/{r['id']}", "DELETE")
+        a = [r for r in recs if r["type"] == "A"]
+        body = {"type": "A", "name": name, "content": IP, "ttl": 300, "proxied": False}
+        if a:
+            res = cf(f"https://api.cloudflare.com/client/v4/zones/{zid}/dns_records/{a[0]['id']}", "PUT", body)
+        else:
+            res = cf(f"https://api.cloudflare.com/client/v4/zones/{zid}/dns_records", "POST", body)
+        if res.get("__err__"):
+            body_txt = res.get("__body__", "")
+            if "Workers" in body_txt:
+                return "SKIP cf-worker"
+            if name == d:  # apex failure is fatal for this domain
+                return f"ERR cf {res['__err__']}"
+    return "READY"
+
+
+def point_godaddy(d):
+    if not (GK and GS):
+        return "SKIP no-godaddy-creds"
+    hdr = {"Authorization": f"sso-key {GK}:{GS}", "Content-Type": "application/json"}
+    body = json.dumps([{"data": IP, "ttl": 600, "type": "A", "name": "@"}]).encode()
+    req = urllib.request.Request(f"https://api.godaddy.com/v1/domains/{d}/records/A/%40",
+                                 data=body, headers=hdr, method="PUT")
+    try:
+        urllib.request.urlopen(req, timeout=30).read()
+    except urllib.error.HTTPError as e:
+        return f"ERR gd {e.code}"
+    # www (best-effort; ignore failure)
+    try:
+        wb = json.dumps([{"data": IP, "ttl": 600, "type": "A", "name": "www"}]).encode()
+        urllib.request.urlopen(urllib.request.Request(
+            f"https://api.godaddy.com/v1/domains/{d}/records/A/www", data=wb, headers=hdr, method="PUT"), timeout=30).read()
+    except Exception:
+        pass
+    return "READY"
+
+
+def main():
+    doms = sys.argv[1:]
+    ready, skip = [], []
+    for d in doms:
+        host = ns_host(d)
+        r = point_cf(d) if host == "cf" else point_godaddy(d) if host == "godaddy" else "SKIP other-registrar"
+        (ready if r == "READY" else skip).append(d)
+        print(f"  {d:34} [{host}] {r}")
+    print(f"\nREADY={len(ready)}  SKIP={len(skip)}")
+    print("READY_LIST:" + " ".join(ready))
+    if skip:
+        print("SKIP_LIST:" + " ".join(skip))
+
+
+if __name__ == "__main__":
+    main()

← c905d09 yoloforever cycle 3: ungated slice done (6/41), remaining is  ·  back to Ga Allsites  ·  yoloforever cycle 4: site-factory port-roulette blocker + sa 1e51edf →