1
1
import os
2
- import pathlib
3
2
4
3
import streamlit as st
5
- from bs4 import BeautifulSoup
6
4
7
5
from .layout import render as render_layout
8
6
from .sidebar import render as render_sidebar
14
12
def run (financial_data , financial_calculations ):
15
13
feedback_form_url = os .getenv ("FEEDBACK_FORM_URL" )
16
14
donation_url = os .getenv ("DONATION_URL" )
17
- ga_tracking_id = os .getenv ("GA_TRACKING_ID" )
18
15
19
16
st .set_page_config (
20
17
page_title = "Stock Analysis Dashboard" ,
@@ -23,31 +20,6 @@ def run(financial_data, financial_calculations):
23
20
initial_sidebar_state = "expanded" ,
24
21
)
25
22
26
- # Add Google Analytics Tracking
27
- google_analytics_content = f"""
28
- <script async src="https://www.googletagmanager.com/gtag/js?id={ ga_tracking_id } "></script>
29
- <script>
30
- window.dataLayer = window.dataLayer || [];
31
-
32
- function gtag() {{
33
- dataLayer.push(arguments);
34
- }}
35
-
36
- gtag('js', new Date());
37
-
38
- gtag('config', { ga_tracking_id } );
39
- </script>
40
- """
41
- # Insert the script in the head tag of the static template inside your virtual environment
42
- index_path = pathlib .Path (st .__file__ ).parent / "static" / "index.html"
43
- soup = BeautifulSoup (index_path .read_text (), "lxml" )
44
-
45
- if not soup .find (id = "ga-script" ):
46
- script_tag = soup .new_tag ("script" , id = "ga-script" )
47
- script_tag .string = google_analytics_content
48
- soup .head .append (script_tag )
49
- index_path .write_text (str (soup ))
50
-
51
23
# Injecting global CSS stylesheet
52
24
st .markdown (global_stylesheet , unsafe_allow_html = True )
53
25
0 commit comments