javascript - Append bannercode from a webpage -
i've got problem i'm having trying append bannercode end of url. customer journey follows:
- person receives email contains link site (site1), url contain banner code e.g. www.site1.com?banner=helloworld
 - once person on site, there 2 buttons take customer second site: 
- button 1 goes https://www.site2.com/page1
 - button 2 goes same url/page2
 
 
$(document).ready( function () {     var banner = string($.query.get('banner'));     if(banner){         href = $('a[href^="https://"]').attr("href") + "?banner=" + banner;             $('a[href^="https://"]').attr("href", href);     } });   basically happens is, piece of code have makes both buttons go same url example button 1. how can script not change url buttons? in advance.
do understand right: want add banner part every link, keep original part unchanged?
$(document).ready(function(){ var banner=string($.query.get('banner')); if(banner){     $('a[href^="https://"]').attr('href',function(){         return this+'?banner='+banner;     }); } });   or in shorter:
$(document).ready(function(){     (banner=$.query.get('banner'))?$('[href^=https]').attr('href',function(){             return this+'?banner='+banner}):null; })      
Comments
Post a Comment