I created a code to take the utm and cut it specifically in the campaign part of the utm and return only it. this code works as long as the utm campaign comes first. But I also need to consider that the utm campaign can come from any position. for example, it can come after other utms. Does anyone have any idea how I can get part of a string regardless of the order it comes in?
Below is my code:
/* BANNER RESGATE*/set @data_disparo = FormatDate(now(),"dd/MM/yyyy")/*Here in this variable I store the link that has the utm that I want to search for*/Set @RESGATE_BANNER_LINK = LOOKUP("TB_Blocos_Promocionais_Jornadas","RESGATE_BANNER_LINK","DATA_DISPARO",@data_disparo)/*Point markings to substring the utm and get only the utm campaign*/ set @A = IndexOf(@RESGATE_BANNER_LINK,'&') set @A2 = IndexOf(@RESGATE_BANNER_LINK,'=') set @A3 = Subtract(@A,@A2)/* Here I get the utm campaign */set @utm_campaign = Substring(@RESGATE_BANNER_LINK,Add(1,IndexOf(@RESGATE_BANNER_LINK,"=")),Subtract(@A3,1))/*The link with the utms from which I want to get only the utm campaign regardless of the order in which it comes is something like this:https://www.test.com.br/?utm_campaign=This_Is_A_test1&utm_source=email&utm_medium=nda_nda&utm_content=This_Is_A_test2&utm_term=nda_nda_nda_id_200In this case the utm campaign comes first and the code works. But I need it to work even when the utm campaign comes after any other in the link*/