-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support to GA4 DS-577 #169
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried adding EDNX_ENABLE_GOOGLE_ANALYTICS
y GOOGLE_ANALYTICS_4_ID
in the lms.env.yml
to test the conditional % if ga_4_id:
when is added or skipped the a GA4 ID and this happend:
tutor_dev-lms-1 | ga_4_id = static.get_value("GOOGLE_ANALYTICS_4_ID", settings.GOOGLE_ANALYTICS_4_ID)
tutor_dev-lms-1 | AttributeError: 'Undefined' object has no attribute 'get_value'
tutor_dev-lms-1 | Internal Server Error: /dashboard
help!
My bad, @bra-i-am. I needed to define the static and realized that I needed to import the js_escape_string. Can you review it again, please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @MaferMazu, I thought I was missing some configuration.
Now looks good to me and is working as expected 👌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* feat: add support to GA4 * fix: define static and import js_escaped_string
<% ga_4_id = static.get_value("GOOGLE_ANALYTICS_4_ID", settings.GOOGLE_ANALYTICS_4_ID) %> | ||
% if ga_4_id: | ||
ga('create', '${ga_4_id | n, js_escaped_string}', 'auto', {'name': 'edunext', 'alwaysSendReferrer': true}); | ||
ga('edunext.require', 'displayfeatures'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creo que no era necesario mantener el nombre de edunext aquí. Eso era particularmente útil cuando teniamos 2 cuentas de analytics para reportar. Si solo vamos a mantener una ya no necesita eso.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dejé las dos cuentas de analytics @felipemontoya, realmente lo que se hizo fue simplemente que el tracking code no estuviera quemado. Y tome esa decisión porque en el equipo de marketing me dijero que lo están usando.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
El cuento es que en esta linea:
ga('create', '${ga_4_id | n, js_escaped_string}', 'auto', {'name': 'edunext', 'alwaysSendReferrer': true})
Lo defines con el nombre edunext. Luego en las otras dos lo usas con ese nombre. Puedes ponerle otro nombre, como analytics o cualquier otra cosa. Esto para que cuando un cliente usa su propio código no parezca que son nuestras analyticas cuando no lo son.
* feat: add support to GA4 * fix: define static and import js_escaped_string
feat: add support to GA4 DS-577 (#169)
* feat: add support to GA4 * fix: define static and import js_escaped_string
* feat: add support to GA4 * fix: define static and import js_escaped_string
Allow tracking data with GA4. To do so, we need to set:
GOOGLE_ANALYTICS_4_ID
.Important note: This is still working as usual for the clients (tenants).
The inspiration for these changes comes from openedx/edx-platform#32032
How to test it
(Run: tutor config save, tutor distro enable-themes, and tutor images build openedx)
GOOGLE_ANALYTICS_4_ID
andFEATURES["EDNX_ENABLE_GOOGLE_ANALYTICS"]=True
For deep test:
<p>${static.get_value("GOOGLE_ANALYTICS_4_ID", settings.GOOGLE_ANALYTICS_4_ID)}</p>
in env/build/openedx/themes/ednx-saas-themes/edx-platform/bragi/lms/templates/google_analytics.htmltutor dev exec lms reload-uwsgi
GOOGLE_ANALYTICS_4_ID
in elements, in inspect, in your browser.