I am currently using Webhook to transfer data from Metform for Elementor to Google Sheets. However, since I am using the same form on several pages, I'm wondering if there's any way to obtain the URL of the page where the submission was made?
Hi
Good question.
That likely has to be configured in Elementor.
Click Webhook tab to open its options.
- Webhook URL:Enter the integration URL (like Zapier) that will receive the form’s submitted data.
- Advanced Data: Slide to YES to send Advanced Data to the webhook, which will include meta data such as Date and Time, Remote IP, etc. It will also send the data as an array, such as: ‘Name’ => ‘John Doe’, ‘Email’ => ‘john@doe.com’, ‘Message’ => ‘Please contact me’ ]If Advanced Data is set to NO, the data will be sent in Simple form, which will send the form fields to the webhook as a text message, such as:“Name: John Doe, Email: john@doe.com, Message: Please contact me.”
I am currently using Webhook to transfer data from Metform for Elementor to Google Sheets. However, since I am using the same form on several pages, I'm wondering if there's any way to obtain the URL of the page where the submission was made?
To obtain the URL of the page where the submission was made when using Metform for Elementor and Webhook to transfer data to Google Sheets, you can follow these steps:
-
Add a hidden field to your form: In the form builder of Metform for Elementor, add a hidden field to your form. This hidden field will capture the URL of the page where the form is embedded.
-
Retrieve the current page URL: Use JavaScript to retrieve the current page URL. You can do this by adding a script to the page that will populate the hidden field with the URL.
Here's an example of how you can achieve this:
<script> document.addEventListener('DOMContentLoaded', function() { // Get the current page URL var currentPageUrl = window.location.href; // Set the value of the hidden field with the URL document.getElementById('hidden-field-id').value = currentPageUrl; }); </script>
Make sure to replace 'hidden-field-id'
with the actual ID or name of your hidden field in the form.
- Pass the hidden field value through the Webhook: When the form is submitted, the hidden field value containing the URL will be included in the form data. Set up your Webhook configuration to transfer this data to Google Sheets along with the other form fields.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.