Nior18867 commited on
Commit
245a04f
·
verified ·
1 Parent(s): 9a3789a

Add UTM tracking

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -23,6 +23,14 @@ POLL_MAX_SECONDS = 120
23
 
24
 
25
 
 
 
 
 
 
 
 
 
26
  # ============ CSS ============
27
  CUSTOM_CSS = """
28
  /* ===== Base Styles ===== */
@@ -385,7 +393,7 @@ with gr.Blocks(css=CUSTOM_CSS, title="Image Upscaler Comparison") as demo:
385
  <div class="hero-container">
386
  <div class="hero-badge">WAVESPEED AI</div>
387
  <h1 class="hero-title">Image Upscaler Comparison</h1>
388
- <p class="hero-desc">Compare Image Upscaler vs Ultimate Upscaler side by side. Try on <a href="https://wavespeed.ai" target="_blank" style="color: #8b5cf6; text-decoration: none; font-weight: 600;">wavespeed</a></p>
389
  </div>
390
  """)
391
 
@@ -399,7 +407,7 @@ with gr.Blocks(css=CUSTOM_CSS, title="Image Upscaler Comparison") as demo:
399
  <svg width="20" height="20" fill="#06b6d4" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M18 8a6 6 0 01-7.743 5.743L10 14l-1 1-1 1H6v2H2v-4l4.257-4.257A6 6 0 1118 8zm-6-4a1 1 0 100 2 2 2 0 012 2 1 1 0 102 0 4 4 0 00-4-4z" clip-rule="evenodd"/></svg>
400
  API Key
401
  </span>
402
- <a href="https://wavespeed.ai/accesskey" target="_blank" class="get-key-btn">Get API Key</a>
403
  </div>
404
  """)
405
  api_key_input = gr.Textbox(
@@ -440,7 +448,7 @@ with gr.Blocks(css=CUSTOM_CSS, title="Image Upscaler Comparison") as demo:
440
  <div class="cta-container">
441
  <h3 class="cta-title">Want More Features?</h3>
442
  <p class="cta-desc">Higher resolutions, batch processing, and 700+ AI models</p>
443
- <a href="https://wavespeed.ai/models" target="_blank" class="cta-btn">
444
  Explore WaveSpeed.ai
445
  </a>
446
  </div>
 
23
 
24
 
25
 
26
+
27
+ # ============ UTM Tracking ============
28
+ UTM_CAMPAIGN = "upscaler_comparison"
29
+
30
+ def add_utm(base_url: str, content: str) -> str:
31
+ separator = "&" if "?" in base_url else "?"
32
+ return f"{base_url}{separator}utm_source=huggingface&utm_medium=space&utm_campaign={UTM_CAMPAIGN}&utm_content={content}"
33
+
34
  # ============ CSS ============
35
  CUSTOM_CSS = """
36
  /* ===== Base Styles ===== */
 
393
  <div class="hero-container">
394
  <div class="hero-badge">WAVESPEED AI</div>
395
  <h1 class="hero-title">Image Upscaler Comparison</h1>
396
+ <p class="hero-desc">Compare Image Upscaler vs Ultimate Upscaler side by side. Try on <a href="{add_utm(\'https://wavespeed.ai\', \'hero_link\')}" target="_blank" style="color: #8b5cf6; text-decoration: none; font-weight: 600;">wavespeed</a></p>
397
  </div>
398
  """)
399
 
 
407
  <svg width="20" height="20" fill="#06b6d4" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M18 8a6 6 0 01-7.743 5.743L10 14l-1 1-1 1H6v2H2v-4l4.257-4.257A6 6 0 1118 8zm-6-4a1 1 0 100 2 2 2 0 012 2 1 1 0 102 0 4 4 0 00-4-4z" clip-rule="evenodd"/></svg>
408
  API Key
409
  </span>
410
+ <a href="{add_utm(\'https://wavespeed.ai/accesskey\', \'api_key_button\')}" target="_blank" class="get-key-btn">Get API Key</a>
411
  </div>
412
  """)
413
  api_key_input = gr.Textbox(
 
448
  <div class="cta-container">
449
  <h3 class="cta-title">Want More Features?</h3>
450
  <p class="cta-desc">Higher resolutions, batch processing, and 700+ AI models</p>
451
+ <a href="{add_utm(\'https://wavespeed.ai/models\', \'cta_button\')}" target="_blank" class="cta-btn">
452
  Explore WaveSpeed.ai
453
  </a>
454
  </div>