Assign User's Name to a Variable

I’d like to ask my wix website visitors to type in their name and then I’d like to use that data to fill in sentences like, “Hi [name], welcome to our site”. Can you tell me how to do that?

You can easily do that with your users after they have signed themselves up as members as you will have their info to hand already in a dataset.

Either through the Wix Members app’s own Members PrivateMembersData collection.
https://support.wix.com/en/article/corvid-wix-members-privatemembersdata-collection-fields

Or through building your own Member Profile Pages through code and having your own Members dataset.
https://support.wix.com/en/article/corvid-tutorial-building-your-own-members-area

Then in your code you can simply get the current users id and then run a query on your dataset to fill a text element with the data from their first name field in your dataset for example.
https://www.wix.com/corvid/reference/wix-users.html
https://www.wix.com/corvid/reference/wix-users.html#currentUser
https://www.wix.com/corvid/reference/wix-users.User.html#id
https://www.wix.com/corvid/reference/wix-data.html#query
https://www.wix.com/corvid/reference/wix-data.WixDataQuery.html#eq

For just the normal public visitor to your website, then your best choice is to simply have a user input where they can add any name that they like, obviously you can limit it to first name only and a max amount of characters etc.

Validations without code and just through the Wix Editor.
https://support.wix.com/en/article/working-with-user-input-validation-in-the-settings-panel

Validations through code.
https://support.wix.com/en/article/corvid-about-validating-user-input-with-code
https://www.wix.com/corvid/reference/$w.ValidatableMixin.html

here is a Wix Example that you can open in the Wix Editor that shows a email code validation all setup in the Wix Editor along with all the code already done for you too.
https://www.wix.com/corvid/example/custom-validations

Then you can save that user input value through Wix Storage and you can use the user input that is saved in Wix Storage elsewhere on your site, providing the user doesn’t close the website window or refresh.
https://www.wix.com/corvid/reference/wix-storage.html

Otherwise, you can do something like still having a user input element that the public user can input their name into, however you will need a submit button and save it to a dataset which is open to everyone.

Then on the page that you want to show that public user input, then you can simply call that user input value and display it on the page.

However, note that you can’t display the name as a variable within a text element, you will have to add a seperate text box for the user input within the text that you are using to display it.

You can use variables in things like triggered emails or Wix Automations for example, however you can’t do it through the Wix Editor text element.