GianJSX's picture
Create analytics/gs.py
48696aa
raw
history blame
668 Bytes
import streamlit as st
import streamlit.components.v1 as components
def ga_markdown():
# Add Google Analytics code to the header
html_string = """
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-RGME574XZF"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-RGME574XZF');
console.log('gtag')
</script>
"""
components.html(html_string)
st.markdown(html_string, unsafe_allow_html=True)