tdurbor commited on
Commit
f349942
·
1 Parent(s): bf6a215

Add GA tracking

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -25,6 +25,7 @@ from db import (
25
  # Load environment variables
26
  load_dotenv()
27
  huggingface_token = os.getenv("HUGGINGFACE_HUB_TOKEN")
 
28
 
29
  # Configure logging
30
  logging.basicConfig(level=logging.INFO)
@@ -202,9 +203,20 @@ function load_zoom() {
202
  }
203
  """
204
 
 
 
 
 
 
 
 
 
 
 
 
205
  def gradio_interface():
206
  """Create and return the Gradio interface."""
207
- with gr.Blocks(js=js, fill_width=True) as demo:
208
  button_name = "Difference between masks"
209
 
210
  with gr.Tabs() as tabs:
 
25
  # Load environment variables
26
  load_dotenv()
27
  huggingface_token = os.getenv("HUGGINGFACE_HUB_TOKEN")
28
+ google_analytics_tracking_id = os.getenv("GOOGLE_ANALYTICS_TRACKING_ID")
29
 
30
  # Configure logging
31
  logging.basicConfig(level=logging.INFO)
 
203
  }
204
  """
205
 
206
+ head = """
207
+ <!-- Google Tag Manager -->
208
+ <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
209
+ new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
210
+ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
211
+ 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;f.parentNode.insertBefore(j,f);
212
+ })(window,document,'script','dataLayer', '""" + f"{google_analytics_tracking_id}" + """');</script>
213
+ <!-- End Google Tag Manager -->
214
+ """
215
+
216
+
217
  def gradio_interface():
218
  """Create and return the Gradio interface."""
219
+ with gr.Blocks(js=js, head=head, fill_width=True) as demo:
220
  button_name = "Difference between masks"
221
 
222
  with gr.Tabs() as tabs: