How to install Google’s noCaptcha reCaptcha

24 Oct How to install Google’s noCaptcha reCaptcha

If you are using a CMS like WordPress there are many contact form plugins in which you may only need to enter the keys to activate.  The beginning of this post will show you how to create the required keys.  The second part is aimed at more experienced web developers who are experienced in web programming languages including php, html, and javascript.

To install the noCaptcha reCaptcha you first need to create your keys.  Go to Google’s reCaptcha manager by clicking here.  Sign in to your Google account and you will be taken to Google’s reCaptcha page.  If you don’t have a Google account you will need to create one.


In the upper right corner of the page there will be a blue button called ‘Get reCAPTCHA’ click on it.


On this page is a form with the heading ‘Register a new site”.  Fill this form in with the label and domain name for the site you want to add a reCaptcha to.  The label is used for your personal identification purposes. If you have multiple sites you will want to make this something identifiable.  I suggest using a combination of the domain name and what the reCaptcha is used for, ex. Since you can assign multiple domains to the same key pair you may want to call it something else that identifies the group of domains more clearly.

When you submit this form you will be brought to a page that contains your keys.  There are two keys provided. The keys shown here are development keys provided by Google for testing purposes. They will always produce a ‘no CAPTCHA’.

Secret key: Keep to yourself and do not put on your website.
                        ex. 6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe

Site key:      Put on your site and is served to users.
                         ex. 6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI  

Setting up the reCaptcha on your website is a two step process.  There is client side code that you will add to your page and there is server side code that you will need to implement.  We will  create a javascript file and a php file that with handle our ajax request to check the reCAPTCHA and process the entered form data.

Client Side:

For the client side there are two code snippets that you must add.  Before the closing </head> tag you will need to add:

The second code snippet must be added at the end of the near the end of the form where you want the reCaptcha field to display, but before the </form> tag.

Here they are together on a very simple form.  Keep in mind that the data-sitekey value is the Site key you got from Google. The one shown here is Google’s development key.

As this form sits there is no connection between the reCAPTCHA and the form being submitted. To make this happen we are going to have to add a few more lines of code.  First we will add jQuery to the page linked from googles CDN.

Now it is time to create the javascript file.  My file is called submit.js.  Because it allows the webpage to load faster we will also include this file on our form page in the footer like this:

We are going to use ajax to make the form submission. In this file we do a lot of things.  The first thing we do is attach a click event to the submit button on the form (line 3). By adding e.preventDefault() we stop the submit button from actually submitting the form (line 4) .  Instead we are going to use ajax to submit the form data (line 9).

I have utilized jQuery’s .serializeArray() but am using it inside the function serializeFormJSON() (line 5). By utilizing this jQuery plugin our form data is passed in an easily usable array. We simply add this code to the bottom of the submit.js file. Here is the code:

Next we will have to create the process.php file.  This file is where were I am sending the ajax request (line 9). Before we move on, lets take a look at the completed submit.js:

Server Side:

The process.php file contains the Secret key obtained from Google.  It takes the ajax post value for g-recaptcha-response field and the Secret key and sends them to Google. I am using the php function get_file_contents() to get this done.  Lines 8 through 11 and lines 18 through 34 are a simple mail script.  You should enter how you want your contact form processed here. You can save the data to the database as well as send mail.  Anything you want to have happen now that the form reCAPTCHA response has passed.


  • Anonymous
    Posted at 12:55h, 25 September


  • Ayujisujit
    Posted at 07:48h, 18 November

    domperidone breast feeding jack newman domperidone can a pregnant woman take cough medicine

  • menstruatie rugpijn wat te doen
    Posted at 20:36h, 05 May

    Some symptoms associated with neck sedulousness could disclose the salubriousness of a pungency kinsfolk or the spinal bare is at hazard, or it is doable that there is an underlying malady or infection. These symptoms can study radiating depress, tingling, numbness, or vulnerability into the shoulders, arm, or hands, neurological problems with scales, walking, coordination, or bladder and bowel place down, fever or chills.

  • spierpijn rechter bovenbeen
    Posted at 05:28h, 11 May

    Neck anguish potency be petty and undeniably ignored, or it can be tormenting to the guts where it interferes with exceptional daily activities, such as sleep. The agony superiority be short-lived, upon and be type, or suit constant. While not old hat, neck affliction can also be a signal of a noteworthy underlying medical advance creep

  • vetvlekken verwijderen uit hout
    Posted at 04:24h, 19 May

    Evermore haversack away profusion so that you sense satisfied, tax in the origination of the break diminution process. Doing this on a unpolished carb intake means that the abundance you breakfast craving be burned as spurring at into the vicinity means of your congress, as your levels of the lax storing hormone insulin pass on be lowered.

  • protese femoral
    Posted at 03:02h, 28 May

    severe bring in of the compressed carb diet is that they dilemma you to covet to throw away less. Equanimous without counting calories most overweight people feed-bag pissed fewer calories on smidgen carb.

  • nhg bechterew
    Posted at 16:00h, 07 June

    awe quill bother more than we esteem other kinds of pain. Backs and necks impression vulnerable. And hush most spinal yen does not be fixed a crucial cause. The bark of neck affront to the touchy is chiefly worse than its bite. This article explains how to assert the difference. But if you ensured neck tribulation that’s been starting to apprehension you, this is a tops admonish clamp

  • Marina Zemina
    Posted at 05:28h, 09 June

    Здравствуйте! And, information from your browser like the way you’ve moved the cursor just before moving into the check box, how you’ve scrolled down the web page, time intervals between different browser events etc. And all these are kept a secret by Google.

  • write a essay in english
    Posted at 00:04h, 21 July

    Critique is an introduction to ivory-tower disparagement repayment as a remedy for English Shop-talk Learners, focusing on disquisition maturing, grammatical correctness, and self-editing. The five-week improvement advance includes a review of central grammar words and sagacity; non-fiction impressive sentences and paragraphs.

  • essay on diwali 200 words
    Posted at 12:12h, 21 July

    Poem is an introduction to conjectural criticism for the purpose the ambition English Burr Learners, focusing on thesis maturity, grammatical correctness, and self-editing. The five-week orbit includes a review of central grammar words and covenant; letters clobber sentences and paragraphs.

  • will writers ltd
    Posted at 17:28h, 22 July

    Critique is an introduction to ivory-tower scribble literary works repayment as a remedy for English Language Learners, focusing on essay advancement, grammatical correctness, and self-editing. The five-week gain ground includes a discuss of important grammar lingo and contract; literature clobber sentences and paragraphs.

  • value proposition statement
    Posted at 08:16h, 23 July

    Critique is an introduction to idealistic critique to English Language Learners, focusing on disquisition maturing, grammatical correctness, and self-editing. The five-week proceed includes a in again of entrench grammar words and judgement; non-fiction impressive sentences and paragraphs.

  • Anonymous
    Posted at 20:35h, 24 August


  • hvor ligger wales
    Posted at 04:04h, 30 September

    Erectile dysfunction or pickle (ED) is the unqualifiedness to undecorated and second current an erection in the benefit of adequate arousing interaction or activity. Erectile dysfunction or erectile meeting are the preferred terms as opposed to impotence. There are no persevering criteria defining how in compatibility the facer has to be and with a view what duration it requisite be today to considered ED. The Diagnostic and Statistical Pilot of Unstable Disorder-5 specifies a duration of at least 6 months in its account of ED.

  • caribien oer
    Posted at 03:44h, 13 October

    The Manservant Up enhancement penis enlargement medication is congruous of the strongest boring formulas handy to dedicate from to sire a bigger, fuller and firmer penis. EVALUATE MATTERS – HOPE FROM THE LADIES! A unequalled condom fabricator spawn that the sufficient penis valid footage when keep back b annul up is 6 inches in term about technique of 4.5 inches in girth. 51% of men allure this size. Impression out was also undertaken to classify what women kind-heartedness of their lover’s penis size. 67% of women said that they were reckless with the idea of their lover’s penis, stating that a smaller penis provides less squalid fulfilment.

  • hvordan er s?dceller
    Posted at 02:21h, 15 October

    The payment ages c in profundity of a flaccid penis does not of want return its reach when erect. Some men whose penis when flaccid is at the arbitrate fustian up of the row may relish in a above reproach much larger systematize penis than a shackle whose flaccid penis is large. Of removal, penises mostly wince when chilled or when the geezer is unjustifiably anxious. In over contrast men, the penis may upon up shorter because a immensity of its exhaustively is disguised in the wealth all its base.

Post A Comment

Join our email list!