How to include a Google analytics tag to a scribble website

I would like to add a Google Analytics tag to a scribble generated website. I have found this solution here, but it is outdated. The new form of the tags is:

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-SOMETHING"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-SOMETHING');
</script>

Basically, what I haven't managed to do is to include the first part with the async. How could I adapt the solution linked in the post to achieve this?

Thanks in advance.

Does this help?

How to create a custom tag

Following code demonstrates how to create details, which corresponds to <details> in HTML.

#lang scribble/base

@(require (only-in scribble/core make-style)
          (only-in scribble/html-properties alt-tag))

@(define details-style (make-style #f (list (alt-tag "details"))))

@(define (details . arg*)
   (apply elem #:style details-style arg*))

@; -----------------------------------------------------------------------------

This is a Scribble document with a @tt{details} element.

@details{
 The @tt{alt-tag} style property can change the HTML tag that
 Scribble creates for an @tt{element} or @tt{paragraph}.
}

Reference: 6.3 Structures And Processing))

2 Likes