Lead info with country for Contact Form 7

September 23, 2023

Lead info with country for Contact Form 7 Plugin

Lead info with country for Contact Form 7 helps to track users that fill in forms.

Lead info with country for Contact Form 7 is an addon module for the Contact Form 7 plugin. It helps you track the user who fills out a form.
All you need to do is add the [tracking-info] shortcode in the Message body of the contact form 7.

Since version 1.5.0 you can also use the shortcode [tracking-info-noip] in the Message body of contact form 7 which will not include the IP of the user in case you have concerns regarding the General Data Protection Regulation (EU) 2016/679 (“GDPR”).

This plugin is an enhanced version of the plugin Contact Form 7 Leads Tracking, that includes translations and the lookup of the country of the IP from which the form is sent.

We decided to create this enhanced version of the plugin, because we needed a translation to Spanish and wanted to know the country from which the uses send the contact form, whithout having to lookup the IP adress.

The lead tracking info includes: Form Page URL, Original Referrer, Landing Page, User IP, Country of the User IP and Browser.

In order to display the Country it needs the Geolocation IP Detection (until March 2020: GeoIP Detection) plugin that can be found in the WordPress plugin repository. This plugin “provides geographic information detected by an IP adress”. This plugin auto-updates the GeoIP database once a week. This product includes GeoLite data created by MaxMind, available from www.maxmind.com.

If the Geolocation IP Detection (until March 2020: GeoIP Detection) plugin is not installed and enabled, you will only see the IP address, without the country of the IP adress.

We decided to use the Geolocation IP Detection (until March 2020: GeoIP Detection) plugin to handle the lookup of the country, because it’s a plugin that is actively developed and we saw no advantage in implementing all this functionality, when we could use an existing one.

The lead tracking info in this plugin includes:

  1. Form Page URL
    The URL on which the user filled out the form.

  2. Original Referrer
    The URL from which the user came to your site.

  3. Landing Page
    The first page the user visited on your site.

  4. User IP (is not included when using the shorcode [tracking-info-noip])
    The IP address of the user who filled out the form.

  5. Country of the IP
    The country of the IP address of the user who filled out the form. If the country is 0, please check the FAQ information.

  6. User Agent / Browser
    The browser information of the user who filled the form.

Please make sure that WP_DEBUG in wp-config.php is set to FALSE when using this plugin in production. If it’s true the message is sent but the AJAX code to show the OK message and clear the form is not executed. This has to do with the Contact Form 7 filter: wpcf7_mail_components we use for adding the tracking information and we can’t change this behaviour. Please be aware of this.

Lead info with country for Contact Form 7 in your Language!

This first release is avaliable in English and Spanish. In the languages folder we have included the necessary files to translate this plugin.

If you would like the plugin in your language and you’re good at translating, please drop us a line at Contact us.

Further Reading

You can access the description of the plugin in Spanish at: Lead info with country for Contact Form 7 en castellano.

Contact

For further information please send us an email.

Installation

  1. Upload the contact-form-7-lead-info-with-country folder to the /wp-content/plugins/ directory (or to the directory where your WordPress plugins are located)
  2. Activate the “Lead info with country for Contact Form 7” plugin through the ‘Plugins’ menu in WordPress.
  3. Plugin doesn’t need any configuration but you have to paste one of the shortcodes in the MESSAGE BODY of the form where you want to include the tracking info.

Screenshots

  1. A sample email with the tracking information generated by the plugin.

    A sample email with the tracking information generated by the plugin.

  2. Shortcode in the Contact Form 7 message body.

    Shortcode in the Contact Form 7 message body.

FAQ

What is Lead info with country for Contact Form 7 good for?

This plugin adds the Form Page URL, Original Referrer, Landing Page, User IP, Country of the User IP and Browser to Contact Form 7 when inserting the [tracking-info] shortcode in the Message body.
If the shortcode [tracking-info-noip] is used the plugin does not add the User IP but adds the other information: Form Page URL, Original Referrer, Landing Page, Country of the User IP and Browser.

What about the General Data Protection Regulation (EU) 2016/679 (“GDPR”)?

If you are concerned about the the General Data Protection Regulation (EU) 2016/679 (“GDPR”) you can use the [tracking-info-noip] shortcode which does not include the User IP in the email sent.

Do I need to install another plugin to make this one work?

Lead info with country for Contact Form 7 is an addon module for the Contact Form 7 plugin. You need to have Contact Form 7 installed and active.
In order to display the Country it needs the Geolocation IP Detection (until March 2020: GeoIP Detection) plugin that can be found in the WordPress plugin repository. This plugin “provides geographic information detected by an IP adress”. This plugin auto-updates the GeoIP database once a week. This product includes GeoLite data created by MaxMind, available from www.maxmind.com.

If the Geolocation IP Detection (until March 2020: GeoIP Detection) plugin is not installed and enabled, you will only see the IP address, without the country of the IP adress.

IMPORTANT: When you install the Geolocation IP Detection (until March 2020: GeoIP Detection) plugin for the first time, it’s important that you go to Tools > Geolocation Lookup and click on “Upgrade now”. When activated the plugin does not download the GeoIP database automatically. You have to download it the first time by clicking on “Upgrade now”. If you don’t install the database, the Country code is 0.

Please note that the size of the database “Maxmind GeoIP Lite City” is around 55MB. But you can also decide to use the “HostIP.info Web-API” which doesn’t require the download of any database and makes the IP query online (HostIP.info Web-API only supports English names and does only have the following fields: country name, country ID and city name).

The result for the Country is 0. What can I do?

When you install the Geolocation IP Detection (until March 2020: GeoIP Detection) plugin for the first time, it’s important that you go to Tools > Geolocation Lookup and click on “Upgrade now”. When activated the plugin does not download the GeoIP database automatically. You have to download it the first time by clicking on “Upgrade now”. If you don’t install the database, the Country code is 0.

How exact is the Country data?

Think of it as an “educated guess”: IP adresses and their allocation change on a frequent basis. If you need more exact data, consider purchasing the commercial version of the data.

Does Lead info with country for Contact Form 7 make changes to the database?

The plugin doesn’t make any changes to the database. It only adds the tracking info to the email sent by contact form 7.

How can I check out if the plugin works for me?

Install and activate. Paste shortcode in Contact Form 7 Message body. Test contact form. In the email you receive you should see the tracking info added where you placed the shortocde.

How can I remove Lead info with country for Contact Form 7?

You can simply activate, deactivate or delete it in your plugin management section.
As there is no data stored in the database you can delete it safely through FTP.
Please remind to remove the shortcodes in the contact forms. If the plugin is not active the shortcode will not be replaced with the info and it will be displayed as [tracking-info] or [tracking-info-noip].

Are there any known incompatibilities?

If you are using Contact Form 7 Leads Tracking and this plugin is active, the Lead info with country for Contact Form 7 will not work.

Does your plugin work with mail services like MAILGUN?

The plugin works correclty with Mailgun but there is something to take into account. If the emails are sent as plain text emails and you are using Mailgun open tracking, the emails are converted to HTML but the line breaks are lost. We have not found a solution for this. If the emails are sent as HTML text emails, there is no problem.

Why does this plugin offer no support for WordPress versions before 3.5?

Because the Geolocation IP Detection (until March 2020: GeoIP Detection) plugin needs at least WordPress 3.5, we decided to also ask for a version equal or higher than WordPress 3.5.

When using this plugin and send a message in a contact form apparently nothing happens

Please make sure that WP_DEBUG in wp-config.php is set to FALSE when using this plugin in production. If it’s true the message is sent but the AJAX code to show the OK message and clear the form is not executed.

Do you make use of Lead info with country for Contact Form 7 yourself?

Of course we do. 😉

Changelog

2.5 (24/FEB/2022)

  • Made changes to session_destroy() to prevent resetting the session to early. Thanks to @edioreza for brinnging this to our attention. Also included code from Tony J. to show path on website before filling and sending the form (we are testing this as we are not sure how it will behave on large sites).

2.4.1 (08/JAN/2021)

  • Small bug fix to prevent error: “Use of undefined constant body – assumed ‘body’ in wpshore_cf7_lead_tracking.php on line 61”.

2.4 (07/JAN/2021)

  • Added check for headers_sent() on line 29 to prevent the “cannot start session when headers already sent” error that some users were seeing in their logs.

2.3 (22/OCT/2020)

  • Changed array used to detect if email sent is HTML or plain text to prevent error: “Use of undefined constant body – assumed ‘body’ in wpshore_cf7_lead_tracking.php on line 61”.

2.2 (08/JAN/2020)

  • Made a change to how we handle session_destroy() to prevent error: “Trying to destroy uninitialized session in wpshore_cf7_lead_tracking.php on line 55”.

2.1 (20/NOV/2019)

  • Solved “Site Health” error: “The REST API encountered an error”.

2.0 (19/SEP/2019)

  • Updated name from “Contact Form 7 Lead info with country” to “Lead info with country for Contact Form 7” in order to comply with the WordPress plugin repository trademark guidelines.

1.6.0 (27/JUN/2019)

  • Updated check for HTML or PLAIN TEXT to make line breaks correctly.

1.5.1 (15/FEB/2019)

  • Updated translation files and added POT file to translate to other languages.

1.5.0 (14/FEB/2019)

  • Add new shortcode [tracking-info-noip] which does not include the User IP in the email sent.

1.4.3 (12/JUL/2018)

  • Removed line break when PROXY is detected.

1.4.2 (03/JAN/2018)

  • Added declaration of variable $trackingInfo to avoid “Notice: Undefined variable: cf7isSecure” with PHP 7.

1.4.1 (10/SEP/2017)

  • Added declaration of variable $cf7ltisSecure to avoid “Notice: Undefined variable: cf7isSecure” with PHP 7.

1.4.0

  • Added check for landing page protocol. Now it will show https or http depending if there is a SSL certificate in use on the landing page.

1.3.2

  • Added GEO info for Proxy Server IP when set.

1.3.1

  • Some code improvements.

1.3

  • Changed function used to retrieve the IP data from “GeoIP Detection” to support reverse proxies.

1.2

  • Solved error when WordPress DEBUG was true: “Notice: Undefined index: HTTP_REFERER” when HTTP_REFERER was not set by browser

1.1.1

  • Change to solve error in line 101 of the plugin when WordPress DEBUG is TRUE: Notice: “Undefined index: HTTP_REFERER in contact-form-7-lead-info-with-country/wpshore_cf7_lead_tracking.php on line 101”

1.1

  • First stable release.

1.0

  • Second beta release.

0.5

  • Beta release.

Details

  • Version: 2.5
  • Active installations: 5,000
  • WordPress Version: 3.5
  • Tested up to: 6.3.5
  • PHP Version: 5.3

Ratings


5 Stars
4 Stars
3 Stars
2 Stars
1 Stars