UTM to Link
const queryParams = new URLSearchParams(window.location.search); const linkIdParameter = queryParams.get('linkId');
console.log("LinkId: " + linkIdParameter);
if(linkIdParameter) { // get the Outbound button element links = document.querySelectorAll("a");
links.forEach(function(outboundLink) { // edit Outbound button element property by appending the URL parameters outboundLink.href += "&utm_medium=referral" + "&utm_source=amazon" + "&utm_campaign=flex_launch";
// log final Outbound button link to console console.log(outboundLink.href); }); }