are you a human for
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Add are you a human to visualforce pages. You can check out a live demo here.


  1. Install Ayah.cls into your Salesforce Org
  2. Under Setup->Remote Site Settings, add


Initialize an Ayah object with your publisher key and your scoring key

Ayah myAyah = new Ayah('mypublisherkey', 'myscoringkey');

Calling getPublisherHtml will generate the html you need to drop into a page. You can do this in an apex:outputText with escape="false"

<apex:outputText value="{!myAyah.publisherHtml}" escape="false" />

Then, in your controller, get the session_secret parameter value. This is what we need to send to the service to check if the PlayThru was successful. Call the getScore method with the session_secret to see if we are successful or not.

public PageReference checkUserScore() {

  String sessionSecret = ApexPages.currentPage().getParameters().get('session_secret');

  if(sessionSecret == null) {
    addError('No session secret found');
    return null;

  // call the getScore method to see if the PlayThru was successful
  if(ayah.getScore(sessionSecret)) {
    addInfo('Congrats! You are a human!');
  } else {
    addError('Sorry, you are not a human!');

  return null;



Check out this demo page

The demo files used are also included in this repo.