Closed Kolossi closed 3 years ago
Thanks for the PR @Kolossi.
I would just suggest you move the logic to _includes/analytics.html
file instead of creating a separate file. As I think, all the analytics code should live in a single file so it becomes more maintainable.
Thanks!
Thx.
I sure would have done, but the reason I didn't is one style needs to go in head, the other in body. Any ideas how to tackle that?
Hi Amit,
Thanks for all your work on this great theme.
I noticed Issue #45 about new style "GA4" analytics and I had already fixed it in my generated version, so here is a PR for you to review.
There's different ways to tackle this - maybe auto-detect by looking at the form of the
google_analytics
id given ("G-..." or "UA-...").In my version I just used 2 config values. It also looks if GA4 is set and if so doesnt include the old UA stuff. Someone might want it though I guess, so I didn't do that in this PR.
(To do it, my
analytics.html
line 1:{% if site.google_analytics_ua and not site.google_analytics_ga4 %}
)Note that as I'm starting fresh, in my site I also renamed the existing
google_analytics
togoogle_analytics_ua
but that's very "breaky" for existing users!Anyway, this PR as it is seems to me like a non-breaking easy implementation for the main repo.
YMMV, but my wish is that this at least saves you a little time in addressing the issue.
Thanks again for a great theme.
Paul