diff --git a/.gitignore b/.gitignore index 385cdce2e..794b1672e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ template1.html scrap.py scraplab.py *~ -content.html \ No newline at end of file +content.html +submission*.html \ No newline at end of file diff --git a/README.txt b/README.txt index 94344d753..719ef1444 100644 --- a/README.txt +++ b/README.txt @@ -99,4 +99,3 @@ Go to Command Terminal $ make theme=blue-icon * Now, open ui/build/index.html in the browser to test the template. - diff --git a/changelog.org b/changelog.org new file mode 100644 index 000000000..19c74cb2c --- /dev/null +++ b/changelog.org @@ -0,0 +1,21 @@ +#+NAME: Changelog + +* <2020-07-03 Fri> + + - Author :: Ojas Mohril + - Changes :: + - Updated makefile =patch-analytics= command to use + =scripts/patch-analytics.sh= instead of the script + from [[https://github.com/virtual-labs/vlabs-analytics][vlabs-analytics]]. + - This script is taken from the [[https://github.com/virtual-labs/vlabs-analytics][vlabs-analytics]] repo but updated + to ignore =content*.html= files. Justification for why this is + needed can be found in [[https://github.com/virtual-labs/problem-solving-iiith/issues/1213][this]] issue. (In brief, content*.html + files are not really html and break when touched by the + analytics code.) + - As a result of this change, the submission files will no longer + have analytics snippet and these page views will not be tracked. + - Removed all committed submission*.html files and added the + pattern to gitignore. These are radomly generated files and + should not be added to version control. + - As the broken content files were comitted at some point on the + master, the working files had to extracted from [[https://github.com/virtual-labs/problem-solving-iiith/commit/591c7f3c91d260a9a0ef12385c62be3b63577e44][this]] commit. diff --git a/scripts/gtm-patcher.py b/scripts/gtm-patcher.py new file mode 100755 index 000000000..fe86b64c1 --- /dev/null +++ b/scripts/gtm-patcher.py @@ -0,0 +1,110 @@ +#!/usr/bin/python + +from bs4 import BeautifulSoup, Tag, Comment +import sys + +headSnippet = """(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': +new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], +j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= +'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); +})(window,document,'script','dataLayer','GTM-W59SWTR');""" + +iframeSrc = "https://www.googletagmanager.com/ns.html?id=GTM-W59SWTR" + + +insert_head = "" +def patch_php(filepath): + # print(filepath) + try: + if(1): + f1 = open(filepath,"r") + lines = f1.readlines() + string_inserted = '' + for line in lines: + if(" + -
+