I was recently asked to set up a WordPress site, with a contact form which could be placed into any page or post.
No problem, the Contact Form 7 plugin lets me set up a contact form, and gives me a handy shortcode which I can use to insert the form anywhere within a page or post.
BUT, they also wanted to know which page the form was submitted from, so that they could track their leads, and send relevant information based on which page the user filled out the form on.
Now, I wasn’t aware of any obvious way to do this, without hacking the form, so I had a look at the Contact Form 7 documentation.
It took me a while to find, but there are some special mail tags you can add into your message body, to collect more detailed information about the form submission.
To collect the URL of the page where the form was submitted, you just need to paste [_post_url] into the message body of your contact form.
There are several other special mail tags you can use if you want to collect more details, such as post author, post date or sender’s IP address.
Let me know if you found this useful.
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.