Buckets:
| from typing import List, Dict, Any | |
| def plan_campaign_budget(total_budget: float, platforms: List[str]) -> Dict[str, Any]: | |
| """ | |
| Suggests budget allocation across multiple platforms. | |
| """ | |
| # Industry standard allocations (Simplified) | |
| weights = { | |
| "google": 0.40, | |
| "meta": 0.35, | |
| "tiktok": 0.15, | |
| "linkedin": 0.10, | |
| "twitter": 0.05 | |
| } | |
| total_weight = sum(weights.get(p.lower(), 0.10) for p in platforms) | |
| allocation = {} | |
| for p in platforms: | |
| p_lower = p.lower() | |
| weight = weights.get(p_lower, 0.10) | |
| percentage = weight / total_weight | |
| allocation[p] = { | |
| "budget": round(total_budget * percentage, 2), | |
| "percentage": f"{percentage*100:.1f}%" | |
| } | |
| return allocation | |
| def calculate_ad_math(spend: float, clicks: int, conversions: int, revenue: float) -> Dict[str, Any]: | |
| """ | |
| Calculates key advertising metrics. | |
| """ | |
| cpc = spend / clicks if clicks > 0 else 0 | |
| cpa = spend / conversions if conversions > 0 else 0 | |
| roas = revenue / spend if spend > 0 else 0 | |
| cr = (conversions / clicks) * 100 if clicks > 0 else 0 | |
| return { | |
| "cpc": round(cpc, 2), | |
| "cpa": round(cpa, 2), | |
| "roas": round(roas, 2), | |
| "conversion_rate": f"{cr:.2f}%" | |
| } | |
Xet Storage Details
- Size:
- 1.33 kB
- Xet hash:
- f536e0d27109a502b29f9cfe4f2fd89a478de9ea9772e3cf51ebe0d402da7489
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.