diff --git a/.gitmodules b/.gitmodules index 522d276fdf..c120ac5de8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,15 +1,15 @@ [submodule "vendor/jquery"] path = vendor/jquery - url = git://github.com/jquery/jquery.git + url = https://github.com/jquery/jquery.git [submodule "vendor/fonts/Font-Awesome"] path = vendor/fonts/Font-Awesome - url = git://github.com/FortAwesome/Font-Awesome.git + url = https://github.com/FortAwesome/Font-Awesome.git [submodule "vendor/lab-sensor-applet-interface"] path = vendor/lab-sensor-applet-interface - url = git://github.com/concord-consortium/lab-sensor-applet-interface.git + url = https://github.com/concord-consortium/lab-sensor-applet-interface.git [submodule "vendor/lab-sensor-applet-interface-dist"] path = vendor/lab-sensor-applet-interface-dist - url = git://github.com/concord-consortium/lab-sensor-applet-interface-dist.git + url = https://github.com/concord-consortium/lab-sensor-applet-interface-dist.git [submodule "vendor/lab-grapher"] path = vendor/lab-grapher url = https://github.com/concord-consortium/lab-grapher.git diff --git a/.jshintrc b/.jshintrc index c849b9c03f..3c273c5def 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,6 +1,6 @@ { "esversion": 6, - "predef": ["$", "d3", "describe", "it", "beforeAll", "beforeEach", "afterEach", "sinon", "should", "expect", "_gaq"], + "predef": ["$", "d3", "describe", "it", "beforeAll", "beforeEach", "afterEach", "sinon", "should", "expect", "gtag"], "browser" : true, "eqnull": true, "boss" : false, diff --git a/developer-doc/configuration.md b/developer-doc/configuration.md index ebee9d0b12..a7a1f5ed0e 100644 --- a/developer-doc/configuration.md +++ b/developer-doc/configuration.md @@ -60,7 +60,7 @@ Interactive **About** box. ### Runtime Google Analytics -If the global `_gaq` is defined, then Lab will send some events to Google Analytics. This is done +If the global `gtag` is defined, then Lab will send some events to Google Analytics. This is done through trackEvent method in `src/lab/common/controllers/scripting-api.js`. So if you want this to happen then the page embedding `lab.js` or `lab.min.js` should include the standard Google Analytics script setting things up. diff --git a/src/embeddable.html b/src/embeddable.html index 2033b2a505..bea9519db0 100644 --- a/src/embeddable.html +++ b/src/embeddable.html @@ -18,15 +18,14 @@ <% } %> <% if (htmlWebpackPlugin.options.gaAccountId) { %> - + <% } %> diff --git a/src/embeddable.js b/src/embeddable.js index d4e5b27583..dbb750349c 100644 --- a/src/embeddable.js +++ b/src/embeddable.js @@ -1,4 +1,4 @@ -/*global Lab, $, _gaq, Embeddable: true, AUTHORING: true */ +/*global Lab, $, gtag, Embeddable: true, AUTHORING: true */ /*jshint boss:true */ // Strawman setting for telling the interactive to be in "author mode", @@ -8,7 +8,7 @@ AUTHORING = false; Embeddable = window.Embeddable || {}; Embeddable.sendGAPageview = function (){ // send the pageview to GA - if (typeof _gaq === 'undefined'){ + if (typeof gtag === 'undefined'){ return; } // make an array out of the URL's hashtag string, splitting the string at every ampersand @@ -16,7 +16,7 @@ Embeddable.sendGAPageview = function (){ // grab the first value of the array (assuming that's the value that indicates which interactive is being viewed) var my_hashtag = my_hashtag_array[0]; - _gaq.push(['_trackPageview', location.pathname + my_hashtag]); + gtag("event", "page_view", { "page_path": location.pathname + my_hashtag }) }; Embeddable.load = function(interactiveUrl, containerSelector, callbacks) { diff --git a/src/index.html b/src/index.html index b7aed489d2..4426d549eb 100644 --- a/src/index.html +++ b/src/index.html @@ -7,15 +7,14 @@ <% if (htmlWebpackPlugin.options.gaAccountId) { %> - + <% } %> diff --git a/src/lab/common/controllers/scripting-api.js b/src/lab/common/controllers/scripting-api.js index 3e88cb5e98..51f2b98dc5 100644 --- a/src/lab/common/controllers/scripting-api.js +++ b/src/lab/common/controllers/scripting-api.js @@ -114,19 +114,17 @@ export default function ScriptingAPI(interactivesController, model) { /* Send a tracking event to Google Analytics */ function trackEvent(category, action, label) { - var googleAnalytics; - if (typeof _gaq === 'undefined') { - // console.error("Google Analytics not defined, Can not send trackEvent"); + if (typeof gtag === 'undefined') { + // console.error("Google Analytics not defined, Can not send event"); return; } - googleAnalytics = _gaq; if (!category) { category = "Interactive"; } // console.log("Sending a track page event Google Analytics (category:action:label):"); // console.log("(" + category + ":" + action + ":" + label + ")"); - googleAnalytics.push(['_trackEvent', category, action, label]); + gtag("event", action, { "event_category": category, "event_label": label }); } return {