Query String parsing and string substitution on page

I would like to be able to insert a string from a URL parameter on the page. This will be used for Dynamic Keyword Insertion on the page. For example, the page URL may contain a parameter


URL:
landingpage.wix.com/page1/?keyword="Nutrition Plan"


Page:
You are looking for a [[keyword]]


Where [[keyword]] would be replaced with “Nutrition Plan”

I am looking for a code approach to get the keyword value from the URL and perform string insertion on the page.

Thank you in advance.
Dave

MAybe this helps: https://www.wix.com/velo/reference/wix-location/queryparams-obj

Hi, Girl Zano, thanks very much! That is the answer for the first part 1; getting the parameter string. The “query” function will enable me to get the parameter, I can then parse it to get the value I am looking for to create the string I want to insert on the page.

Do you know how to insert a string on the page. In Wordpress I would insert a short code text like [[shortcode]]. This would cause a substitution of the shortcode function with the string.

I searched the docs, I expect there is a simple way to do this without writing custom JS/CSS functions. Sorry for the newbie questions. Any help is appreciated!

Not quite sure I understand your question. Do you merely want to display You are looking for a [[keyword]] ?
In that case, just put a textbox on the screen and do something like:

$w('#txtKeyword').text = "You are looking for a " + keyword;

where keyword would be the parsed keyword from the query string.
Hope this helps, if not, let me know.

Commenting here in case people haven’t found an answer yet.
Use case: to take a keyword you’ve passed from Google Ads, Facebook Ads or an email and insert it into a body of text on your website.
Here’s how to do Dynamic Keyword Insertion in Wix:

//Start
$w.onReady(function () {
//Saves the query 'keyword'
const keyword = wixLocation.query["keyword"];
    if (keyword) {
//Target text object 'headline'. += will add to the existing text, = will replace everything.
//e.g. if wix was the keyword you would get 'Test wix test2' (note the spaces)
    $w("#headline").text += "Test " + keyword + " test2";
  }
});


Hope this helps people!