Jump to content
  • 0

Capture Referer URL in Webform


aukirk

Question

I know that there is an Auto Value field within Caspio Bridge to capture the URL for the datapage, but is there a way to capture the referring URL that led the user to that DataPage?

This would be similar to the PHP command $_SERVER['HTTP_REFERER']

If we have a contact form on a page http://www.domain.com/contact.htm, we would like to know what page the visitor came from to land on that contact form. For example, I would like to have a hidden field on the Caspio DataPage for "Referrer" that would display "http://www.domain.com/page.htm" if that is the page they were on before going to the contact.htm page.

Using PHP forms, we could use HTTP_REFERER to capture that information and add it to a hidden field.

Any help would be greatly appreciated.

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Thanks for the quick response..... that appears to be setting the value to the same thing I get when I choose Form Element=AutoValue, AutoValueType=DataPage Host, with the option for "complete URL".

What I am hoping to achieve is to get the URL of the page the visitor was on BEFORE they landed on the page where the DataPage is deployed. For example, if the DataPage is on a generic contact us page, I would like to know what page of the site they were on before they clicked through to that contact form so I have some indication what generated the inquiry.

Hopefully there is some other code similar to this that will accomplish that.

Link to comment
Share on other sites

  • 0

Let me double check everything again on my end... is it possible that you have some Javascript on the datapage where you are using this, which is working with that to make it get the prior page?

Right now I have it deployed on a closed site, but if it still doesn't work after clearing all of my browsing history and making sure everything is set correct, I will deploy it on an open page so you can maybe help me trouble shoot...

Thanks!

Link to comment
Share on other sites

  • 0

The only page in this set up that is a Caspio DataPage is the contact form. The other pages are just regular pages. I have cleared the browser and after setting up links to that Caspio Datapage on a variety of different places, it still fills that field as the DataPage Host URL.

Link to comment
Share on other sites

  • 0

You are right, the [@cbHostURL] will give you the current page URL but not the previous one. What you are looking for can be done using a simple Java Script explained in the link below.

http://www.w3schools.com/jsref/prop_doc_referrer.asp

You can use Java Scripts in the HTML block of a DataPage and for example assign the document.referrer value to a field to store in the table if you want.

Best,

Bahar M.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...