Definitely.
Situation: A CTA button labeled “Get Pricing” is on all product pages of a website and clicking it takes you to a dedicated page that has a form generated by Contact Form 7 plugin. You wish to capture the page the visitor was on upon form submission and here is how I have accomplished it.
1. Add a Text Field element with a css class referer-page
[ text referer-page class:referer-page]
2. Add the following css to your styles.css
input.referer-page { display:none; }
3. Add the following code snippets to your functions.php
function getRefererPage( $form_tag )
{
if ( $form_tag['name'] == 'referer-page' ) {
$form_tag['values'][] = $_SERVER['HTTP_REFERER'];
}
return $form_tag;
}
if ( !is_admin() ) {
add_filter( 'wpcf7_form_tag', 'getRefererPage' );
}
4. Add the following to the Contact Form 7 Message body (under Mail)
Referer Page: [referer-page]
That’s it!
Pingback: Referral Conversion Tracking with WordPress Contact Form 7 | FLDtrace
Pingback: Karesansui on "Can fields be initialized with php code ?" | گــــوگــــــل