How To Remove query parameters from Landing Page Data Element?

Avatar

Avatar

adilk

Avatar

adilk

adilk

18-07-2019

Hi,

I have a data element within Core > Visitor Behavior > Landing Page that I'm using to pull the first page of the session.

If my landing page is this: www.foo.com/?parameter1=test

and my current value for landing page data element is this: www.foo.com/campaign?parameter1=test

How can I create another data element called Landing Page without Query Param to get this as the value: www.foo.com/campaign

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

AlexisCazes

MVP

Avatar

AlexisCazes

MVP

AlexisCazes
MVP

26-07-2019

You cannot use in JavaScript var x=%Landing Page%; you need to use var x=_satellite.getVar('Landing Page');

Answers (3)

Answers (3)

Avatar

Avatar

adilk

Avatar

adilk

adilk

28-07-2019

Thanks, Alexis.

There was a closing parenthesis missing in my code. Now changed to:

var x=_satellite.getVar('Landing Page');

return (x.split("?")[0]);

Avatar

Avatar

adilk

Avatar

adilk

adilk

21-07-2019

Hello,

If my Landing Page variable is a data element, I tried the below custom code for a new eVar called Landing Page without parameters but the code didn't work. Can you please check.

--

var x=%Landing Page%;

return (x.split("?")[0];

--

Thanks.

Avatar

Avatar

MA1985

Avatar

MA1985

MA1985

18-07-2019

adilk​ you can try this

var x = "www.foo.com/campaign?parameter1=test"

console.log(x.split("?")[0]

Result: www.foo.com/campaign