From b66cbe34840007b6de8c3ee52e054502240b3447 Mon Sep 17 00:00:00 2001 From: Andy Armstrong Date: Tue, 6 Oct 2015 00:13:19 -0400 Subject: [PATCH] Upgrade segment.io to match documentation. May improve performance. TNL-3538 --- cms/templates/base.html | 1 + cms/templates/widgets/segment-io-footer.html | 22 ++++++++++++++++++++ cms/templates/widgets/segment-io.html | 14 +++++-------- lms/templates/footer-edx-v3.html | 1 + lms/templates/footer.html | 1 + lms/templates/main.html | 1 + lms/templates/widgets/segment-io-footer.html | 14 +++++++++++++ lms/templates/widgets/segment-io.html | 11 +++------- 8 files changed, 48 insertions(+), 17 deletions(-) create mode 100644 cms/templates/widgets/segment-io-footer.html create mode 100644 lms/templates/widgets/segment-io-footer.html diff --git a/cms/templates/base.html b/cms/templates/base.html index 2c4564abdf..996bcc9659 100644 --- a/cms/templates/base.html +++ b/cms/templates/base.html @@ -96,6 +96,7 @@ import json }); }); + <%include file="widgets/segment-io-footer.html" /> diff --git a/cms/templates/widgets/segment-io-footer.html b/cms/templates/widgets/segment-io-footer.html new file mode 100644 index 0000000000..571011d68b --- /dev/null +++ b/cms/templates/widgets/segment-io-footer.html @@ -0,0 +1,22 @@ +% if settings.CMS_SEGMENT_KEY: + + + +% endif diff --git a/cms/templates/widgets/segment-io.html b/cms/templates/widgets/segment-io.html index 0e0c4a3f7f..5d6bdc1872 100644 --- a/cms/templates/widgets/segment-io.html +++ b/cms/templates/widgets/segment-io.html @@ -14,16 +14,12 @@ var course_location_analytics = "${locator | escapejs}"; %endif - var analytics=analytics||[];analytics.load=function(e){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src=("https:"===document.location.protocol?"https://":"http://")+"d2dq2ahtl5zl1z.cloudfront.net/analytics.js/v1/"+e+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n);var r=function(e){return function(){analytics.push([e].concat(Array.prototype.slice.call(arguments,0)))}},i=["identify","track","trackLink","trackForm","trackClick","trackSubmit","pageview","ab","alias","ready"];for(var s=0;s % else: diff --git a/lms/templates/footer-edx-v3.html b/lms/templates/footer-edx-v3.html index 5df9e230e5..992d43744e 100644 --- a/lms/templates/footer-edx-v3.html +++ b/lms/templates/footer-edx-v3.html @@ -70,6 +70,7 @@ <%static:js group='base_vendor'/> <%static:css group='style-vendor'/> <%include file="widgets/segment-io.html" /> + <%include file="widgets/segment-io-footer.html" /> % endif % if footer_css_urls: % for url in footer_css_urls: diff --git a/lms/templates/footer.html b/lms/templates/footer.html index 3a703da5b1..7264422d4f 100644 --- a/lms/templates/footer.html +++ b/lms/templates/footer.html @@ -75,6 +75,7 @@ <%static:js group='base_vendor'/> <%static:css group='style-vendor'/> <%include file="widgets/segment-io.html" /> + <%include file="widgets/segment-io-footer.html" /> % endif % if footer_css_urls: % for url in footer_css_urls: diff --git a/lms/templates/main.html b/lms/templates/main.html index 93cef17af1..1e450583ec 100644 --- a/lms/templates/main.html +++ b/lms/templates/main.html @@ -159,6 +159,7 @@ from branding import api as branding_api % endif <%block name="js_extra"/> + <%include file="widgets/segment-io-footer.html" /> diff --git a/lms/templates/widgets/segment-io-footer.html b/lms/templates/widgets/segment-io-footer.html new file mode 100644 index 0000000000..287cf6a15d --- /dev/null +++ b/lms/templates/widgets/segment-io-footer.html @@ -0,0 +1,14 @@ +% if settings.LMS_SEGMENT_KEY: + + + +% endif diff --git a/lms/templates/widgets/segment-io.html b/lms/templates/widgets/segment-io.html index 68013f6c28..d8b225eb5c 100644 --- a/lms/templates/widgets/segment-io.html +++ b/lms/templates/widgets/segment-io.html @@ -2,16 +2,11 @@ % else: