Spaces:
Runtime error
Runtime error
Create analytics/gs.py
Browse files- analytics/gs.py +18 -0
analytics/gs.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import streamlit.components.v1 as components
|
| 3 |
+
|
| 4 |
+
def ga_markdown():
|
| 5 |
+
# Add Google Analytics code to the header
|
| 6 |
+
html_string = """
|
| 7 |
+
<!-- Global site tag (gtag.js) - Google Analytics -->
|
| 8 |
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-RGME574XZF"></script>
|
| 9 |
+
<script>
|
| 10 |
+
window.dataLayer = window.dataLayer || [];
|
| 11 |
+
function gtag(){dataLayer.push(arguments);}
|
| 12 |
+
gtag('js', new Date());
|
| 13 |
+
gtag('config', 'G-RGME574XZF');
|
| 14 |
+
console.log('gtag')
|
| 15 |
+
</script>
|
| 16 |
+
"""
|
| 17 |
+
components.html(html_string)
|
| 18 |
+
st.markdown(html_string, unsafe_allow_html=True)
|