Update GA tags
Also auto gen docs if running publish only for website
This commit is contained in:
parent
95a420534d
commit
2970bbdf6f
19
publish.py
19
publish.py
@ -68,14 +68,15 @@ def run_html(args: Any) -> None:
|
||||
|
||||
def add_analytics() -> None:
|
||||
analytics = '''
|
||||
<!-- Google Analytics -->
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-20736318-2"></script>
|
||||
<script>
|
||||
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
||||
ga('create', 'UA-20736318-2', 'auto');
|
||||
ga('send', 'pageview');
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'UA-20736318-2');
|
||||
</script>
|
||||
<script async="async" src='https://www.google-analytics.com/analytics.js'></script>
|
||||
<!-- End Google Analytics -->\
|
||||
'''
|
||||
for dirpath, firnames, filenames in os.walk(publish_dir):
|
||||
for fname in filenames:
|
||||
@ -87,6 +88,10 @@ ga('send', 'pageview');
|
||||
f.write(html.encode('utf-8'))
|
||||
|
||||
|
||||
def run_docs(args: Any) -> None:
|
||||
subprocess.check_call(['make', 'docs'])
|
||||
|
||||
|
||||
def run_website(args: Any) -> None:
|
||||
if os.path.exists(publish_dir):
|
||||
shutil.rmtree(publish_dir)
|
||||
@ -384,6 +389,8 @@ def main() -> None:
|
||||
ans = 'n'
|
||||
if ans.lower() != 'y':
|
||||
return
|
||||
if actions == ['website']:
|
||||
actions.insert(0, 'docs')
|
||||
for action in actions:
|
||||
print('Running', action)
|
||||
cwd = os.getcwd()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user