From cc6c95b388ba8473a9641ec91ae3109edc5f714c Mon Sep 17 00:00:00 2001 From: afzaledx Date: Wed, 28 Mar 2018 12:11:03 +0500 Subject: [PATCH] OC-3995 Moved the ID string used in the google-site-verification meta tag to settings so that it can be overridden from site_configuration. --- lms/envs/aws.py | 1 + lms/envs/common.py | 1 + lms/templates/main.html | 8 +++++++- themes/README.rst | 7 +++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lms/envs/aws.py b/lms/envs/aws.py index fe15f32775..2d4d79606c 100644 --- a/lms/envs/aws.py +++ b/lms/envs/aws.py @@ -730,6 +730,7 @@ ADVANCED_SECURITY_CONFIG = ENV_TOKENS.get('ADVANCED_SECURITY_CONFIG', {}) 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') ##### BRANCH.IO KEY ##### BRANCH_IO_KEY = AUTH_TOKENS.get('BRANCH_IO_KEY') diff --git a/lms/envs/common.py b/lms/envs/common.py index 5dd103c97b..846a71a88d 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -795,6 +795,7 @@ TRACKING_SEGMENTIO_SOURCE_MAP = { ######################## GOOGLE ANALYTICS ########################### GOOGLE_ANALYTICS_ACCOUNT = None +GOOGLE_SITE_VERIFICATION_ID = None GOOGLE_ANALYTICS_LINKEDIN = 'GOOGLE_ANALYTICS_LINKEDIN_DUMMY' ######################## BRANCH.IO ########################### diff --git a/lms/templates/main.html b/lms/templates/main.html index afd20ba32d..e35290e562 100644 --- a/lms/templates/main.html +++ b/lms/templates/main.html @@ -18,6 +18,7 @@ from django.core.urlresolvers import reverse from django.utils.http import urlquote_plus from django.utils.translation import ugettext as _ from django.utils.translation import get_language_bidi +from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_string from openedx.core.release import RELEASE_LINE from pipeline_mako import render_require_js_path_overrides @@ -122,7 +123,12 @@ from pipeline_mako import render_require_js_path_overrides <%include file="widgets/segment-io.html" /> - + + <% google_site_verification_id = configuration_helpers.get_value('GOOGLE_SITE_VERIFICATION_ID', settings.GOOGLE_SITE_VERIFICATION_ID) %> + % if google_site_verification_id: + + % endif + <% ga_acct = static.get_value("GOOGLE_ANALYTICS_ACCOUNT", settings.GOOGLE_ANALYTICS_ACCOUNT) %> diff --git a/themes/README.rst b/themes/README.rst index 7c5868e6ec..8379801b16 100644 --- a/themes/README.rst +++ b/themes/README.rst @@ -179,6 +179,13 @@ In addition, there are some other changes you'll need to make: in the Django settings, or by setting the newly-added "GOOGLE_ANALYTICS_ACCOUNT" config value in your site configuration. +* You can set the google site verification ID in the GOOGLE_SITE_VERIFICATION_ID + in your site configuration. Otherwise, edit the /edx/app/edxapp/lms.env.json + file to set the value for GOOGLE_SITE_VERIFICATION_ID. Setting the value for + GOOGLE_SITE_VERIFICATION_ID will add the meta tag for google site verification + in the lms/templates/main.html which is the main Mako template that all page + templates should include. + * If you don't want the Google Analytics JavaScript to be output at all in your site, set the "GOOGLE_ANALYTICS_ACCOUNT" config value to the empty string. If you want to customize the way that Google Analytics is loaded, set the