Spaces:
Sleeping
Sleeping
File size: 1,408 Bytes
efdcedc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | import re
# High-performing CTA keywords (marketing proven)
STRONG_CTA = [
"buy now", "shop now", "order now", "get started",
"sign up", "register", "download now", "limited offer",
"claim now", "book now", "subscribe", "grab now"
]
MEDIUM_CTA = [
"learn more", "discover", "find out", "see more",
"explore", "know more", "view details"
]
WEAK_CTA = [
"click here", "visit us", "check this",
"read more", "watch now"
]
def analyze_cta(ad_text: str):
"""
Analyze CTA strength inside ad copy
Returns CTA score and insights
"""
if not ad_text or len(ad_text.strip()) == 0:
return {"error": "Empty ad text"}
text = ad_text.lower()
found_strong = [cta for cta in STRONG_CTA if cta in text]
found_medium = [cta for cta in MEDIUM_CTA if cta in text]
found_weak = [cta for cta in WEAK_CTA if cta in text]
score = 0
# Scoring logic
score += len(found_strong) * 10
score += len(found_medium) * 5
score += len(found_weak) * 2
# Penalty if no CTA
if not (found_strong or found_medium or found_weak):
score -= 10
score = max(min(score, 100), 0)
return {
"cta_score": score,
"found_strong_cta": found_strong,
"found_medium_cta": found_medium,
"found_weak_cta": found_weak,
"has_cta": score > 0
}
|