Skip to content

Commit

Permalink
feat: Add Google Analytics tracking to top bar component
Browse files Browse the repository at this point in the history
  • Loading branch information
little9 committed Jul 17, 2024
1 parent 00d271a commit 3ac6fd8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
9 changes: 9 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,21 @@ import { AuthService } from './services/AuthService';
import { CapitalizeService } from './services/CapitalizeService';
import { primawsRest } from './services/primawsRest';


const app = angular.module('viewCustom', ['angularLoad']);

app.factory('itemRequestUrlInterceptor', itemRequestUrlInterceptor);

configureInterceptors(app);

(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-KVWVGLP');

app.component('prmTopBarBefore', prmTopBarBefore);
app.component('prmSearchResultThumbnailContainerAfter', prmSearchResultThumbnailContainerAfter);
Expand Down
16 changes: 1 addition & 15 deletions src/components/prmTopBarBefore.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
export const prmTopBarBefore = {
bindings: { parentCtrl: `<` },
templateUrl: "/discovery/custom/01JHU_INST-JHU/html/prm-top-bar-before.html",
controller: ['$scope', function ($scope) {
var ctrl = this;

ctrl.$onInit = function () {
(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-KVWVGLP');
}
}]
templateUrl: "/discovery/custom/01JHU_INST-JHU/html/prm-top-bar-before.html"
};

0 comments on commit 3ac6fd8

Please sign in to comment.