Expand my Community achievements bar.

We are excited to introduce our latest innovation to enhance the Adobe Campaign user experience — the Adobe Campaign v8 Web User Interface!

Extract part of a string in Adobe Campaign

Avatar

Level 1

Hi!

Can someone please give me some suggestions on how to extract part of the url, which is 3444444 in this case from this url http://abc.com/&q=2q42&ctype=ids&cval=3444444&ttag  using the adobe campaign functions?

Thanks!

2 Replies

Avatar

Level 10

Hi Chloe,

It's quite simple, If you are using this in webapp then you have two options

1. use parameters available in web app under properties.

2. use this in your script this.webApp.request.getParameter("cval");

if you are using a jssp page or java script templates or codes use below

request.getParameter("cval");

Regards,

Amit

Avatar

Community Advisor

Helo @chloechen1995

If you cannot use the above (in the webApp) you might use e.g.

// "http://domain.com?par1=pp&par2=ff"

var url = "http://abc.com?q=2q42&ctype=ids&cval=3444444&ttag";

String.prototype.getParameter = function(param){

  if(this.split("?").length != 2)

    return false;  

  for each(var qp in this.split("?")[1].split("&")){

    if (qp.split("=").length==2)

      if(qp.split("=")[0] == param)

        return qp.split("=")[1];

  }

  return false;

}

logInfo(url.getParameter("cval")); // >>> 3444444

Marcel