Automatik loyalty program management points tracking, tier progression, reward redemption, dan engagement analisis.
import requests, json, pandas as pd CRM_API = "https://api.retail.com/v2/loyalty" def fetch_customers(): resp = requests.get(CRM_API + "/customers") return resp.json().get("customers", []) def calculate_tier(points): if points >= 5000: return "Platinum" if points >= 2000: return "Gold" if points >= 500: return "Silver" return "Bronze" def suggest_reward(customer): if customer["tier"] == "Platinum": return "VIP access" if customer["tier"] == "Gold": return "RM 50 reward" if customer["tier"] == "Silver": return "20% voucher" return "Welcome bonus" def analyze_loyalty(customers): for c in customers: c["tier"] = calculate_tier(c["points"]) c["reward"] = suggest_reward(c) return customers report = analyze_loyalty(fetch_customers()) print(json.dumps(report, indent=2))
Kami menghargai privasi anda
Kami menggunakan storan pelayar untuk mengingati pilihan anda. Analitik pilihan hanya dijalankan selepas anda membenarkannya; pilihan anda direkodkan dengan ID tanpa nama. Dasar Privasi