Skip to content

Commit

Permalink
Analytics services integration - better name for web analytics service
Browse files Browse the repository at this point in the history
  • Loading branch information
josegar74 committed Sep 6, 2023
1 parent 7edb719 commit 0f32776
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"$filter",
"gnExternalViewer",
"gnGlobalSettings",
"gnAnalyticsService",
"gnWebAnalyticsService",
function (
gnMap,
gnOwsCapabilities,
Expand All @@ -70,7 +70,7 @@
$filter,
gnExternalViewer,
gnGlobalSettings,
gnAnalyticsService
gnWebAnalyticsService
) {
this.configure = function (options) {
angular.extend(this.map, options);
Expand Down Expand Up @@ -248,11 +248,11 @@
var openLink = function (record, link) {
var url = $filter("gnLocalized")(record.url) || record.url;
if (url && angular.isString(url) && url.match("^(http|ftp|sftp|\\\\|//)")) {
gnAnalyticsService.trackLink(url, "link");
gnWebAnalyticsService.trackLink(url, "link");

return window.open(url, "_blank");
} else if (url && url.indexOf("www.") == 0) {
gnAnalyticsService.trackLink("http://" + url, "link");
gnWebAnalyticsService.trackLink("http://" + url, "link");

return window.open("http://" + url, "_blank");
} else if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -915,16 +915,16 @@
]);

/**
* Service to track links in the analytics service configured in GeoNetwork.
* Service to track links in the web analytics service configured in GeoNetwork.
*/
module.service("gnAnalyticsService", [
module.service("gnWebAnalyticsService", [
"gnGlobalSettings",
function (gnGlobalSettings) {
var analyticsType = gnGlobalSettings.webAnalyticsService;
var analyticsService = gnGlobalSettings.webAnalyticsService;

this.trackLink = function (url, linkType) {
// Implement track link for the analytics
if (analyticsType === "matomo") {
if (analyticsService === "matomo") {
_paq.push(["trackLink", url, linkType]);
}
};
Expand Down
8 changes: 4 additions & 4 deletions web-ui/src/main/resources/catalog/views/default/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
"gnFacetSorter",
"gnExternalViewer",
"gnUrlUtils",
"gnAnalyticsService",
"gnWebAnalyticsService",
function (
$scope,
$location,
Expand All @@ -193,7 +193,7 @@
gnFacetSorter,
gnExternalViewer,
gnUrlUtils,
gnAnalyticsService
gnWebAnalyticsService
) {
var viewerMap = gnSearchSettings.viewerMap;
var searchMap = gnSearchSettings.searchMap;
Expand Down Expand Up @@ -419,7 +419,7 @@
addMdLayerToMap: function (link, md) {
var config = buildAddToMapConfig(link, md);

gnAnalyticsService.trackLink(config.url, config.type);
gnWebAnalyticsService.trackLink(config.url, config.type);

// This is probably only a service
// Open the add service layer tab
Expand All @@ -435,7 +435,7 @@
});

config.forEach(function (c) {
gnAnalyticsService.trackLink(c.url, c.type);
gnWebAnalyticsService.trackLink(c.url, c.type);
});

$location.path("map").search({
Expand Down

0 comments on commit 0f32776

Please sign in to comment.