axodotdev / axodotdev/oranda

Wrong GA script injection - script is inserted in the body as text

Open
#699 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
543
Forks
34
PR merge metrics
No merged PRs in 30d

Description

hi
first of all - thanks for this tool and OSS contributions

### Desctiption
today I've decided to use it for my project https://github.com/voiceapiai/ralertsinua, and when I configured analytics settings I found that google tag script injection is broken - script is inserted in the body as text

![image](https://github.com/axodotdev/oranda/assets/151379496/f41e4e5e-7e50-4f27-92da-a946bd8bb2c1)

### How to reproduce:
- remote: find broken script text visible at https://voiceapiai.github.io/ralertsinua/ at the very bottom of the screen
- local - add analytics configuration according to the docs, run oranda build, find broken injection in generated index.html - script is inserted in the body as text

### Possible solution:
according to Google, this is the code one need to insert at the website (notice **2 script tags**):
```

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-TCJ5D14XV4');

```

but this line https://github.com/axodotdev/oranda/blob/fb97859c99ab81f644ab5b1449f725fc5c3e9721/src/site/layout/javascript/analytics.rs#L71
doesn't have HTML tag, and thus the string is being inserted **directly in the body**

if possible, I would like to contribute and help to solve this issue

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.