Jump to content

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

Recommended Posts

Posted

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

  • Replies 5
  • Views 2.4k
  • Created
  • Last Reply
Posted

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.

Posted

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.

  • 5 months later...
Posted

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!

Posted
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....

Posted

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

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.