ViralMarketingWP – ReCaptcha Integration
Introduction
The ViralMarketingWP – ReCaptcha Integration addon provides powerful spam protection for your viral marketing campaigns by incorporating Google’s ReCaptcha technology. This integration helps ensure that only genuine participants can join your campaigns, protecting your data quality and preventing automated bot submissions.
Features
- Dual ReCaptcha Support: Implement either ReCaptcha V2 (checkbox) or ReCaptcha V3 (invisible)
- Easy Configuration: Simple setup with site and secret keys from Google
- Seamless Integration: Automatically adds ReCaptcha to all campaign forms
- Customizable Error Messages: Clear feedback for users when verification fails
- IP Validation: Advanced security with proper IP address detection
- Minimal Impact on UX: Options for visible or invisible verification
Requirements
- WordPress 5.0 or higher
- ViralMarketingWP plugin (core) installed and activated
- Google ReCaptcha account with site and secret keys
- PHP 7.0 or higher
Installation
- Download the ViralMarketingWP – ReCaptcha Integration addon from your account at viralmarketingwp.com
- Go to WordPress Admin > Plugins > Add New > Upload Plugin
- Choose the downloaded zip file and click Install Now
- After installation is complete, click Activate Plugin
Getting ReCaptcha Keys
Before configuring the plugin, you need to obtain ReCaptcha keys from Google:
- Visit the Google ReCaptcha Admin Console
- Sign in with your Google account
- Click the + button to create a new site registration
- Enter a label for your site (e.g., “My Viral Marketing Campaigns”)
- Choose the ReCaptcha type:
- ReCaptcha v2 “I’m not a robot” Checkbox for visible verification
- ReCaptcha v3 for invisible verification
- Add your domain(s) in the “Domains” field
- Accept the Terms of Service and click Submit
- You’ll receive two keys:
- Site Key: Used in the frontend form
- Secret Key: Used for backend verification
Configuration
Accessing ReCaptcha Settings
- Go to ViralMarketingWP > Settings in your WordPress admin
- Click on the Integrations tab
- Scroll down to find the Google ReCaptcha Integration section
Available Settings
- Enable ReCaptcha: Turn ReCaptcha protection on or off for all campaign forms
- ReCaptcha Version: Choose between ReCaptcha V2 (Checkbox) or ReCaptcha V3 (Invisible)
- Site Key: Enter your ReCaptcha site key from Google
- Secret Key: Enter your ReCaptcha secret key from Google
Setting Up ReCaptcha V2 (Checkbox)
ReCaptcha V2 displays a checkbox that users must click to verify they are human:
- Select ReCaptcha V2 (Checkbox) in the ReCaptcha Version dropdown
- Enter your V2 site key and secret key
- Save your settings
- A “I’m not a robot” checkbox will appear in all campaign forms
Setting Up ReCaptcha V3 (Invisible)
ReCaptcha V3 works invisibly in the background, scoring user interactions without requiring explicit verification:
- Select ReCaptcha V3 (Invisible) in the ReCaptcha Version dropdown
- Enter your V3 site key and secret key
- Save your settings
- ReCaptcha will work invisibly when users submit campaign forms
How ReCaptcha Works in Your Campaigns
ReCaptcha V2 (Checkbox)
- Users fill out your campaign form
- Before submitting, they must check the “I’m not a robot” box
- Google verifies the user based on their behavior and checkbox interaction
- If verification passes, the form is submitted
- If verification fails, an error message is displayed
ReCaptcha V3 (Invisible)
- Users fill out your campaign form
- When they click submit, ReCaptcha runs invisibly in the background
- Google analyzes the user’s behavior and assigns a score (0.0 to 1.0)
- If the score is above 0.5 (configurable threshold), the form is submitted
- If the score is below the threshold, the submission is blocked with an error message
Troubleshooting
ReCaptcha Not Appearing
If the ReCaptcha widget is not appearing on your forms:
- Verify that ReCaptcha is enabled in your settings
- Ensure you’ve entered valid site and secret keys
- Check that your site domain matches the domains you registered with Google
- Look for JavaScript errors in your browser console that might be preventing the ReCaptcha from loading
- Ensure your theme is not interfering with the form’s HTML structure
Form Submissions Being Blocked
If legitimate users are being blocked from submitting forms:
- For V2, make sure the ReCaptcha checkbox is visible and accessible
- For V3, consider that Google may be scoring some users too low – you might want to switch to V2 for better user control
- Check if users are on networks that Google might flag (VPNs, shared IPs, etc.)
- Verify that your secret key is correct and properly saved
Network Connection Issues
If you see errors related to ReCaptcha verification:
- Ensure your server can make outbound HTTP requests to Google’s verification servers
- Check if your server’s IP address is being rate-limited by Google
- Verify that any security plugins or firewalls are not blocking the verification requests
Technical Details
How Verification Works
The verification process follows these steps:
- When a form is submitted, the plugin captures the ReCaptcha response token
- The plugin sends this token to Google’s verification API along with your secret key
- Google returns a verification result, including success status and (for V3) a score
- The plugin evaluates the result and either allows or blocks the submission
IP Address Detection
The plugin uses a sophisticated method to detect the visitor’s IP address:
- Checks
HTTP_CLIENT_IP
header (if available) - Checks
HTTP_X_FORWARDED_FOR
header (if available) - Falls back to
REMOTE_ADDR
- Validates the IP format for security
Error Handling
When ReCaptcha verification fails:
- Custom error messages are displayed to users
- Error details are logged (when WP_DEBUG is enabled)
- The form submission is prevented
- Special handling is applied for certain cases (e.g., emails with ‘+’ symbols)
Best Practices
Choosing Between V2 and V3
- Use V2 (Checkbox) when:
- You want users to be explicitly aware of the verification
- Your audience may include users who could be incorrectly scored by V3
- You prefer an obviously visible security measure
- Use V3 (Invisible) when:
- You want a frictionless user experience
- Your forms are on high-traffic pages
- You’re willing to accept some false positives for greater convenience
Optimizing Your Forms
- Position matters: If using V2, place the ReCaptcha widget in a visible location
- Clear instructions: Let users know verification is required
- Mobile-friendly design: Ensure your forms work well on all devices
- Error messages: Customize error messages to be helpful and clear
Updates
This plugin receives regular updates to ensure compatibility with the latest versions of WordPress, ViralMarketingWP, and Google ReCaptcha. Keep your plugin updated to ensure optimal functionality and security.