WeblateOrg / WeblateOrg/weblate

Google Analytics 4 integration

Open
#14,015 3 comments 0 reactions 0 assignees View on GitHub
enhancement Waiting for: Demand
Dominant language
Python
Stars
6.1k
Forks
1.4k
Avg merge
9h 53m
Merged PRs (30d)
395

Description

### Describe the issue

Hello, I have attempted to use the lightly documented feature: `GOOGLE_ANALYTICS_ID` -- but the resulting code does not appear to be correct, and does not function. My Google Analytics Console is not able to receive any data with it.

```

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'G-##########', 'auto');
ga('send', 'pageview', {

'dimension1': 'en'
});


```

The Measurement ID has been omitted intentionally.

### I already tried

- [x] I've read and searched [the documentation](https://docs.weblate.org/).
- [x] I've searched for similar filed issues in this repository.

### Steps to reproduce the behavior

1 - Insert Measurement ID into the config
2 - Restart Weblate
3 - No Data is flowing into the GA4 property.

### Expected behavior

Google Analytics can receive data.

### Screenshots

_No response_

### Exception traceback

```pytb

```

### How do you run Weblate?

VPS running Ubuntu 24.04.2 LTS, manually installed.

### Weblate versions

5.10.1

### Weblate deploy checks

```shell
(weblate-env) weblate@git:~/weblate-env$ weblate check --deploy
System check identified some issues:

INFOS:
?: (weblate.I021) Error collection is not set up, it is highly recommended for production use
HINT: https://docs.weblate.org/en/weblate-5.10.1/admin/install.html#collecting-errors
?: (weblate.I028) Backups are not configured, it is highly recommended for production use
HINT: https://docs.weblate.org/en/weblate-5.10.1/admin/backup.html

System check identified 2 issues (12 silenced).
(weblate-env) weblate@git:~/weblate-env$
```

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.