Skip to content

Commit 75645f0

Browse files
committed
Remove Google Analytics Tracking
1 parent d53fef3 commit 75645f0

File tree

2 files changed

+0
-29
lines changed

2 files changed

+0
-29
lines changed

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ streamlit-pills
88
matplotlib~=3.9.2
99
numpy~=2.1.0
1010
toml~=0.10.2
11-
beautifulsoup4
1211
python-dotenv

src/ui/__init__.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import os
2-
import pathlib
32

43
import streamlit as st
5-
from bs4 import BeautifulSoup
64

75
from .layout import render as render_layout
86
from .sidebar import render as render_sidebar
@@ -14,7 +12,6 @@
1412
def run(financial_data, financial_calculations):
1513
feedback_form_url = os.getenv("FEEDBACK_FORM_URL")
1614
donation_url = os.getenv("DONATION_URL")
17-
ga_tracking_id = os.getenv("GA_TRACKING_ID")
1815

1916
st.set_page_config(
2017
page_title="Stock Analysis Dashboard",
@@ -23,31 +20,6 @@ def run(financial_data, financial_calculations):
2320
initial_sidebar_state="expanded",
2421
)
2522

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-
5123
# Injecting global CSS stylesheet
5224
st.markdown(global_stylesheet, unsafe_allow_html=True)
5325

0 commit comments

Comments
 (0)