# How to include a Google analytics tag to a scribble website

**URL:** <https://racket.discourse.group/t/how-to-include-a-google-analytics-tag-to-a-scribble-website/2042>\
**Category:** Questions & Answers\
**Tags:** scribble\
**Created:** [June 25, 2023, 6:21pm UTC](https://racket.discourse.group/t/how-to-include-a-google-analytics-tag-to-a-scribble-website/2042 "2023-06-25T18:21:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Panadestein](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/panadestein/32/949_2.png) [@Panadestein](https://racket.discourse.group/u/Panadestein)\
**Post date:** [June 25, 2023, 6:21pm UTC](https://racket.discourse.group/t/how-to-include-a-google-analytics-tag-to-a-scribble-website/2042/1 "2023-06-25T18:21:16Z")

</div>

I would like to add a Google Analytics tag to a scribble generated website. I have found this solution [here](https://lists.racket-lang.org/users/archive/2011-June/046266.html), but it is outdated. The new form of the tags is:

```html
<!-- 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.

---

<div class="post-metadata">

**Author:** ![spdegabrielle](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/spdegabrielle/32/95_2.png) [@spdegabrielle](https://racket.discourse.group/u/spdegabrielle)\
**Post date:** [June 26, 2023, 9:08am UTC](https://racket.discourse.group/t/how-to-include-a-google-analytics-tag-to-a-scribble-website/2042/2 "2023-06-26T09:08:11Z")

</div>

Does this help?

## How to create a custom tag

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

```racket
#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&nbsp;Structures And Processing](https://docs.racket-lang.org/scribble/core.html#(def._((lib._scribble%2Fhtml-properties..rkt)._alt-tag)))

> **[FAQs: Scribble](https://github.com/racket/racket/wiki/FAQs:-Scribble#how-to-create-a-custom-tag)**
>
> The Racket repository. Contribute to racket/racket development by creating an account on GitHub.
