function replaceMacrosValues(url, macros) {
  var replacedMacrosUrl = url;

  for (var key in macros) {
    var value = macros[key]; // this will match [${key}] and %%${key}%% and replace it

    replacedMacrosUrl = replacedMacrosUrl.replace(new RegExp("(?:\\[|%%)(".concat(key, ")(?:\\]|%%)"), 'g'), value);
  }

  return replacedMacrosUrl;
}
/**
 * Replace the macros tracking url with their value.
 *
 * @param {String} url - Tracking url.
 * @param {Object} macros - Object of macros to be replaced in the tracking calls
 */
Replace the macros tracking url with their value.
@param {String} url - Tracking url.
@param {Object} macros - Object of macros to be replaced in the tracking calls
Replace the macros tracking url with their value . @param { String } url - Tracking url . @param { Object } macros - Object of macros to be replaced in the tracking calls
function replaceMacrosValues(url, macros) {
  var replacedMacrosUrl = url;
  for (var key in macros) {
    var value = macros[key]; 
    replacedMacrosUrl = replacedMacrosUrl.replace(new RegExp("(?:\\[|%%)(".concat(key, ")(?:\\]|%%)"), 'g'), value);
  }
  return replacedMacrosUrl;
}
function replaceMacrosValues ( url , macros ) { var replacedMacrosUrl = url ; for ( var key in macros ) { var value = macros [ key ] ; replacedMacrosUrl = replacedMacrosUrl . replace ( new RegExp ( "(?:\\[|%%)(" . concat ( key , ")(?:\\]|%%)" ) , 'g' ) , value ) ; } return replacedMacrosUrl ; }
Replace the macros tracking url with their value.
Replace the macros tracking url with their value .
// this will match [${key}] and %%${key}%% and replace it