diff --git a/sphinxcontrib/googleanalytics.py b/sphinxcontrib/googleanalytics.py
index 81b16d8..d655ffd 100644
--- a/sphinxcontrib/googleanalytics.py
+++ b/sphinxcontrib/googleanalytics.py
@@ -8,18 +8,18 @@ def add_ga_javascript(app, pagename, templatename, context, doctree):
return
metatags = context.get('metatags', '')
- metatags += """
+""" % app.config.googleanalytics_id
+ gtag('config', '{0}');
+
+
+ """.format(app.config.googleanalytics_id)
context['metatags'] = metatags
def check_config(app):