Jump to content

Pass the Page Title (or Slug) into a Hidden Field in a form

Recommended Posts

Site URL: https://jontyhurwitz.com

I have an enquiry form in the site footer.

When I get the enquiry through, I have no way of know which page it was submitted from.

I have created a hidden field in the form, and would like to pass the Page Title or the slug into this hidden form field.

You can see in this image, its the variable SQF_SLUG that I'd like to fill with the Page Title or the Page Slug.

Is it possible?  I can't find a way

 

 

222374764_Screenshot2020-10-19at16_20_06.thumb.png.0f9569460073e31ac4bbd9206aef9480.png

Link to comment
  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

When tracking forms from different sources it is worth noting that you may have better transparency tracking origins through the use of separate forms each with their own unique name (i.e. Facebook Offer Form, Google Offer Form, etc.) Additionally you could consider sending the submissions from each form to a separate storage destination.

To specifically answer your question however using the hidden fields you will need to update the URL slug you want to track by adding the tracking code to the end of the slug.

/?SQF_<field-title>=<value>

There is a full article on how to implement this feature on available from Squarespace at https://support.squarespace.com/hc/en-us/articles/206543997-Tracking-Form-Block-referral-sources.

Link to comment

Thanks MoltoBello, yea I read that article, but that extracts from the URL.

In this case I'm not looking for the referrer.... I need the actual whole URL (or slug) of the page in the variable.

It seems to me there might be a way to do it by setting SQF_SLUG  variable in a code block.

<script>

SQF_SLUG = {Page-Title}

</script>

.... something like that.

Link to comment
  • 5 months later...

I have the same issue and can't believe the circles I'm going in to sort this out. The article on the topic assumes you're tracking from another source. I'm an artist and my work has an inquiry button on each piece. I simply need the form to pass which page the user is on. I'd rather do this with a script than have to update the value manually on each button. If any of you sorted out how to do this, please share. Thank you!

Link to comment
On 10/19/2020 at 12:18 PM, jontyh said:

Thanks MoltoBello, yea I read that article, but that extracts from the URL.

In this case I'm not looking for the referrer.... I need the actual whole URL (or slug) of the page in the variable.

It seems to me there might be a way to do it by setting SQF_SLUG  variable in a code block.

<script>

SQF_SLUG = {Page-Title}

</script>

.... something like that.

@MoltoBello if you have an answer to this, I'm all ears, too -- please share! this must be simple....

Link to comment

If you would prefer a ready-made enquiry form that automatically includes the product title and product URL in each submission, you may be interested in our Product Enquiry Form extension. It's easy-to-install and can be enabled site-wide or on to products you've tagged. 

The button name and form details can be customised to meet your needs. It's compatible with Squarespace 7.1 as well as Squarespace 7.0 sites using a Brine-family template.

You'll find full details here: Product Enquiry Form.

enquiry-form-baume.gif.08a9444df38e88fffa035c38779ff907.gif

Improve your online store with our extensions.
About: Squarespace Circle Leader since 2017. I value honesty, transparency, appreciation and great design ♥.
Work: Squarespace Developer and founder of SF Digital, building the features Squarespace didn't include™.
Content: Links in my posts may refer to SF Digital products or may be affiliate links.

Buy me a coffee

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.