User Tools

Site Tools


google_recaptcha

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

google_recaptcha [2023/01/09 04:02] – created admingoogle_recaptcha [2026/03/21 10:11] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== Google ReCaptcha ====== ====== Google ReCaptcha ======
  
-It'a great way to skip a regular captcha+Google reCAPTCHA is a convenient alternative to traditional CAPTCHA for verifying visitors. Here'how to set it up:
  
-Here's how to implement it+1. Visit https://developers.google.com/recaptcha and register to obtain: 
 +   - reCAPTCHA V3 Site Key 
 +   - reCAPTCHA V3 Secret Key
  
-1Open https://developers.google.com/recaptcharegister and get 2 keys+2Enter these values in Rotation > Settings > Social, and enable "Use Captcha on Comments?"
  
  
-  Recaptcha V3 Site key  +===== reCAPTCHA for comments =====
-  Recaptcha V3 Secret key+
  
-2. Add those codes to Rotation - Settings - Social  and switch to "Use Captcha on Comments?" in Rotation - Settings +reCAPTCHA works by adding Google's JavaScript code to your form to verify the user is not a bot, storing the verification result in a hidden fieldHere's an example for comments page. Add this code to the HTML head section:
- +
- +
-===== Recaptcha for comments ===== +
- +
-Google adds a small JS code and checks if a current surfer is a bot, then it adds the result of the check to appointed field  +
- +
-Here's an example for comments (gallery page)+
  
 <code> <code>
Line 40: Line 34:
 </code> </code>
  
-take a look at those tags <!--TUBE_RECAPTCHA_SITE_KEY-->, this is Recaptcha V3 Site key (ie public key)+Note that <!--TUBE_RECAPTCHA_SITE_KEY--> is your reCAPTCHA V3 Site Key (not the secret key).
  
-comments form+Here's the comment form itself:
 <code> <code>
  
Line 50: Line 44:
 <FORM name="add_comment" method="POST"> <FORM name="add_comment" method="POST">
 <input type="hidden" name="action" value="add_comment"> <input type="hidden" name="action" value="add_comment">
-<input type="hidden" name="recaptcha" id="recaptcha" value=""> (google adds the result of the check here)+<input type="hidden" name="recaptcha" id="recaptcha" value=""> Google will write the answer here
  
 <label>Name:</label> <input class="s_input" type="text" name='username' id='username' value="<?=$user['username']?>"> <label>Name:</label> <input class="s_input" type="text" name='username' id='username' value="<?=$user['username']?>">
Line 57: Line 51:
  <textarea class="s_text" class="ph2" name='comment' id='comment' rows=5 cols=35 value="Leave Your Comments Here"></textarea>  <textarea class="s_text" class="ph2" name='comment' id='comment' rows=5 cols=35 value="Leave Your Comments Here"></textarea>
  
-<input type=button value='Send comment' onClick=CheckRecaptcha()> (note that type=button so we check google status bufore submit )+<input type=button value='Send comment' onClick=CheckRecaptcha()> Note: this is a button, not a submit button. The form only submits after Google approves the user.
 </form> </form>
  
Line 65: Line 59:
  
  
-===== Recaptcha Anticheat===== 
  
-There's a good way to check traffic with google, ie you'll get what amount of traffic Google mark as bot traffic +===== reCAPTCHA Anticheat =====
  
-At any page (in most cases that would be an index page) you have to add+reCAPTCHA can also be used to monitor traffic quality. Google analyzes traffic and reports the percentage it considers legitimate (non-bot).
  
 +Add the following code to your site (typically on index and category pages):
  
 <code> <code>
Line 121: Line 115:
  
  
-you have to add "class='gallery_link' "  to each link at that page, here's an example+Add class='gallery_link' to links to galleries or categories as in the example below
  
  
Line 130: Line 124:
 </code> </code>
  
-Of course you can replace gallery_link, the idea is to call Google JS each time user clicks a link +You can replace gallery_link with any class name. The key is to attach bot detection event to your links using JavaScript: $('.gallery_link').each(function() { ... }).
  
 +4. In the admin panel, go to Settings > Layouts and enable the Google reCAPTCHA column.
  
-Then you have to go to **Settings - layouts**  and add a column **Google Recaptcha**+Now you can view the percentage of legitimate traffic in Trade > reCAPTCHA column.
  
-That's it, in an hour take a look at the column **Google Recaptcha** in trade screen +**Note:** Google allows only 1300 free checks per hour, so not all hits are analyzed—they're sampled based on RECAPTCHA_MAX_RATE. If you need unlimited checks, contact support about paid options.
  
-PS Note that free amount is 1300 hits \ hour so we dont check each hit, but a part of it (RECAPTCHA_MAX_RATE), but if you are ready to pay Google for more - you can remove RECAPTCHA_MAX_RATE (contact support if you have issues removing this parameter) 
google_recaptcha.1673236952.txt.gz · Last modified: by admin