Analytics - Add Google Tag Manager usage #3877
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add Google Tag Manager usage.
Now, instead of passing posthog api key and api host variables, we provide the GTM id, so we can load the snippet.
The snippet includes the required posthog configuration.
The major reason to use GTM over simple posthog values is that it gives us more flexibility to change any posthog configuration dynamically, without the need of changing the code and releasing a new version.
For example, we could use different posthog instances, depending on the domain where trento is running, or other additional things.
The next step would be to see how we supply this value during compile time. Maybe having an
.envfile with a environment variable that sets the value onprodis enough.This way, we don't need to commit the GTM key on git.
We will need to write an ADR once the feature is in a more advanced stage.
How was this tested?
Unit tests and manual tests with @jagabomb