Skip to main content
adilk
Level 4
Jul 18, 2019 8:05 AM UTC
Solved

How To Remove query parameters from Landing Page Data Element?

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Alexis_Cazes_
Alexis_Cazes_Accepted solution
Level 10
Jul 26, 2019 1:46 PM UTC

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

4 replies

Level 4
Jul 18, 2019 4:50 PM UTC

adilk​ you can try this

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

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

Result: www.foo.com/campaign

Translate
adilk
adilkAuthor
Level 4
Jul 21, 2019 7:02 AM UTC

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.

Translate
Alexis_Cazes_
Alexis_Cazes_Accepted solution
Level 10
Jul 26, 2019 1:46 PM UTC

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

Translate
adilk
adilkAuthor
Level 4
Jul 28, 2019 11:48 AM UTC

Thanks, Alexis.

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

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

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

Translate