Skip to content

Commit

Permalink
fix: added fn configureDefaults() to up-ga.js (#2849)
Browse files Browse the repository at this point in the history
* fix: added fn configureDefaults() to up-ga.js

* clean up and update syntax of up-ga.js

* fix: change JS to be pre-ES6 due to compressor restrictions

* chore: lint JS
  • Loading branch information
bjagg authored Sep 20, 2024
1 parent b1dc6cd commit f4af51a
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ var uportal = uportal || {};
return up.analytics.model.defaultConfig;
};

/**
* Set the defaultConfig.config array as global settings
*/
var configureDefaults = function (propertyConfig) {
//console.log(propertyConfig);
var defaults = propertyConfig.config || [];
_.each(defaults, function (setting) {
// each setting is an object that might have more than 1 key-value pair
//console.log(setting);
_.each(Object.keys(setting), function (key) {
up.gtag('set', key, setting[key]);
});
});
};

/**
* Set the dimensions that apply to the current user
*/
Expand Down Expand Up @@ -371,6 +386,9 @@ var uportal = uportal || {};
return;
}

// Set default config
configureDefaults(propertyConfig);

// Create the tracker
createTracker(propertyConfig);

Expand Down

0 comments on commit f4af51a

Please sign in to comment.