feat: Add GA 4 support to edX platform
This commit is contained in:
@@ -1515,6 +1515,7 @@ GOOGLE_ANALYTICS_ACCOUNT = None
|
||||
GOOGLE_SITE_VERIFICATION_ID = ''
|
||||
GOOGLE_ANALYTICS_LINKEDIN = 'GOOGLE_ANALYTICS_LINKEDIN_DUMMY'
|
||||
GOOGLE_ANALYTICS_TRACKING_ID = None
|
||||
GOOGLE_ANALYTICS_4_ID = None
|
||||
|
||||
######################## BRANCH.IO ###########################
|
||||
BRANCH_IO_KEY = ''
|
||||
|
||||
@@ -694,6 +694,7 @@ GOOGLE_ANALYTICS_ACCOUNT = AUTH_TOKENS.get('GOOGLE_ANALYTICS_ACCOUNT')
|
||||
GOOGLE_ANALYTICS_TRACKING_ID = AUTH_TOKENS.get('GOOGLE_ANALYTICS_TRACKING_ID')
|
||||
GOOGLE_ANALYTICS_LINKEDIN = AUTH_TOKENS.get('GOOGLE_ANALYTICS_LINKEDIN')
|
||||
GOOGLE_SITE_VERIFICATION_ID = ENV_TOKENS.get('GOOGLE_SITE_VERIFICATION_ID')
|
||||
GOOGLE_ANALYTICS_4_ID = AUTH_TOKENS.get('GOOGLE_ANALYTICS_4_ID')
|
||||
|
||||
##### BRANCH.IO KEY #####
|
||||
BRANCH_IO_KEY = AUTH_TOKENS.get('BRANCH_IO_KEY')
|
||||
|
||||
@@ -19,6 +19,19 @@ course_mode_class = course_mode if course_mode else ''
|
||||
<title>${document_title}</title>
|
||||
|
||||
<%static:css group='style-certificates'/>
|
||||
|
||||
|
||||
<% ga_4_id = static.get_value("GOOGLE_ANALYTICS_4_ID", settings.GOOGLE_ANALYTICS_4_ID) %>
|
||||
% if ga_4_id:
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=${ga_4_id}"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '${ga_4_id}');
|
||||
</script>
|
||||
% endif
|
||||
</head>
|
||||
|
||||
<body class="layout-accomplishment view-valid-accomplishment ${dir_rtl} certificate certificate-${course_mode_class}" data-view="valid-accomplishment">
|
||||
|
||||
@@ -162,6 +162,18 @@ from common.djangoapps.pipeline_mako import render_require_js_path_overrides
|
||||
</script>
|
||||
% endif
|
||||
|
||||
<% ga_4_id = static.get_value("GOOGLE_ANALYTICS_4_ID", settings.GOOGLE_ANALYTICS_4_ID) %>
|
||||
% if ga_4_id:
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=${ga_4_id}"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '${ga_4_id}');
|
||||
</script>
|
||||
% endif
|
||||
|
||||
<% branch_key = static.get_value("BRANCH_IO_KEY", settings.BRANCH_IO_KEY) %>
|
||||
% if branch_key and not is_from_mobile_app:
|
||||
<script type="text/javascript">
|
||||
|
||||
Reference in New Issue
Block a user