Only use analytics.js, not gtag.js

pull/162/head
MattIPv4 2020-07-17 16:25:00 +01:00
parent 7976e0a14e
commit 2dce7a956f
2 changed files with 12 additions and 11 deletions

View File

@ -167,7 +167,7 @@ THE SOFTWARE.
importData(query, this.$data.domains, this.$data.global, this.$nextTick); importData(query, this.$data.domains, this.$data.global, this.$nextTick);
// Send an initial GA event for column mode // Send an initial GA event for column mode
this.splitColumnEvent(); this.splitColumnEvent(true);
}, },
methods: { methods: {
changes(index) { changes(index) {
@ -261,8 +261,8 @@ THE SOFTWARE.
this.$data.splitColumn = !this.$data.splitColumn; this.$data.splitColumn = !this.$data.splitColumn;
this.splitColumnEvent(); this.splitColumnEvent();
}, },
splitColumnEvent() { splitColumnEvent(nonInteraction = false) {
analytics('toggle_split_column', 'Button', undefined, Number(this.$data.splitColumn)); analytics('toggle_split_column', 'Button', undefined, Number(this.$data.splitColumn), nonInteraction);
}, },
}, },
}; };

View File

@ -24,16 +24,16 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
export default (action, category, label, value) => { export default (action, category, label, value, nonInteraction = false) => {
try { try {
// gtag.js // gtag.js
if (window.gtag) { // if (window.gtag) {
return window.gtag('event', action, { // return window.gtag('event', action, {
event_category: category, // event_category: category,
event_label: label, // event_label: label,
value, // value,
}); // });
} // }
// analytics.js // analytics.js
if (window.ga) { if (window.ga) {
@ -43,6 +43,7 @@ export default (action, category, label, value) => {
eventAction: action, eventAction: action,
eventLabel: label, eventLabel: label,
eventValue: value, eventValue: value,
nonInteraction,
}); });
} }
} catch (_) { } catch (_) {