RFG Offerwall API

Use this command to query if there are survey opportunities for a respondent.

Command

"offerwall/query/1"



Inputs

The following values are expected in the JSON body:

Name Type Required Description
command String

Must be "offerwall/query/1"

rid String

A string uniquely identifying the respondent. The same string must be sent on repeat visits, allowing us to target using previously collected data.

country String

The 2 character ISO country code

postalCode String

Australia, South Africa: 4 digits
US, France, Germany, Italy, Mexico, Saudi Arabia, Spain: 5 digits
South Korea, : 6 digits
Brazil: 8 digits
Canada: AnAnAn
Argentina: AnnnnAAA
UK: AAnAnAA, AnAnAA, AnnAA, AnnnAA, AAnnAA, AAnnnA
Other: anything

gender String

Accepted values:

  • 1, m or M for male
  • 2, f or F for female
birthday String

The respondent's birthday, formatted as yyyy-MM-dd

ip String

String value corresponding to the respondent's IP. If included, we will use it to consider only the surveys where a respondent with the same IP has not participated, thus reducing the probability of a term due to deduplication.

fingerprint String

The code to compute the fingerprint is available at https://hosting.researchforgood.com/js/df-fp.js
The fingerprint is computed using the following JavaScript:

function processDataForceFingerprint(fingerprint) {
        console.log("Please implement me!, fingerprint = " + fingerprint);
    }
    getDataForceFingerprint(processDataForceFingerprint);

If you are not able to generate the fingerprint, you can send fingerprint:0. In such cases, the rid value becomes mandatory. We will use the fingerprint value we have stored in our system for that respondent in order to determine if the respondent is likely to be ruled out because of deduplication. If the respondent has not started a session with us yet, then we will only consider the IP value. Please note that this is not the preferred option: if you are able to run javascript and generate a fingerprint, you should send the fingerprint value to us. Only use this workaround if you cannot run javascript on your site / app.

type Integer

Optional parameter that indicates the kind of projects that should be returned:

  1. All
  2. Surveys
  3. Offers
**See description for possible values *

Additional Datapoints

In addition to the above parameters, you may also send us any of the datapoints listed in the RFGdatapoints.json file.
That file contains a JSON document listing all of our basic profiling datapoints, including questions and answer translated into multiple languages. The structure of each datapoint is as follows:

{
    property: "propertyName",		 		//  This is the property to send us
    name: "Human readable name",			//  Ignore
    countries: ["US","CA"],				//  The countries this datapoint applies to
    type: 0, 						//  Indicates single or multi-valued
    question: {						//  The question in many languages
	en-US: "The question in US English",
	es-US: "The question in US Spanish",
	etc...
    }
    answers: [						//  The answers in many languages
        null,						//  Answer #0 is always null
        {						//  The first answer starts with 1
            en-US: "Answer #1 in US English",		//  Answers are provided in many languages
            es-US: "Answer #1 in US Spanish",
            etc...
        },
        {
            en-US: "Answer #2 in US English",
            es-US: "Answer #2 in US Spanish",
            etc...
        },
        {
            en-US: "Answer #3 in US English",
            es-US: "Answer #3 in US Spanish",
            etc...
        },
        etc...
    ]
}

Datapoint Types

Datapoint types may be:

  1. Radio Buttons (single selection). Please send us the property name followed by a single integer indicating the selected answer. E.g. householdIncome: 4
  2. Checkboxes (multiple selection). Please send us the property name followed by an array of integers indicating the selected answers. E.g. ethnicityUS: [1,2,4]
  3. Dropdown (single selection). Please send us the property name followed by a single integer indicating the selected answer. E.g. employmentIndustry: 2

For these optional datapoints, you may provide as few or as many as you wish. Any datapoints not provided will be profiled when the respondent begins to take surveys. Please note that some datapoints only apply to certain countries. If a datapoint does not list countries, then it applies to all countries.


Outputs

Name Type Description
countrySupported Boolean

Indicates if the specified country is supported.

surveys JSON[]

An array of JSON documents. Each document represents an available survey. The fields of each project are:

survey_id Internal survey id
title Survey title to display to respondent
payout Payout
payout_currency Currency used in the payout
ir The survey's estimated IR
loi The survey's estimated length in minutes
offer_icon An icon you can use for displaying the survey
offer_url URL that you have to use for redirecting the respondent to that survey
projectEPC EPC of the survey
projectCR CR of the survey
type Integer Indicates the type of the project. Possible values:
1 - Survey
2 - Offer
sourceStats JSON document containing your stats for this survey, the fields of this document are:
Name Description
starts Number of starts
completes Number of completes
terminates Number of terminates
quotas Number of quotas
cr CR
epc EPC

Example Command

{
    command: "offerwall/query/1", 
    rid: "4e882a9bc2748d24",
    country: "US",
    postalCode: "10025",
    gender: 1,
    birthday: "1977-02-25",
    ip: "201.78.52.21",
    fingerprint: "c042ac342900efdfceee4a2edb549f5c",
    ethnicityUS: [1,2,3],
    householdIncome: 4,
    language: 3,
    maritalStatus:2
}

Example Response

{ 
   "command" : "offerwall/query/1", 
   "response" : { 
   "countrySupported" : true, 
   "surveys" : [ 
{ 
"ir" : 90, 
"loi" : 12, 
"offer_icon" : "https%3A%2F%2Fsurvey.saysoforgood.com%2Fux%2Fimages%2FGeneral.svg", 
"offer_url" : "https://survey.saysoforgood.com/trop/survey/59974770e4b0cbdb4262c8fd?init=o6eovNpwhpU5R1S46Vf-LY6dmgo%7B%22tropPanelist%22%3A%225ebbf8f4e4b01c40f6ecdd6f%22%2C%22project%22%3A%225ea7e96de4b05b008da6fd6f%22%7D", 
"payout" : "$1.53", 
"payout_currency" : "USD", 
"projectCR" : 28, 
"projectEPC" : "$.44", 
"sourceStats" : { 
"completes" : 0, 
"cr" : 0, 
"epc" : 0, 
"quotas" : 0, 
"starts" : 0, 
"terminates" : 0
}, 
"survey_id" : "RFG3553903-044", 
"title" : "New survey opportunity for you!", 
"type" : 3
}, 
{ 
"ir" : 25, 
"loi" : 20, 
"offer_icon" : "https%3A%2F%2Fsurvey.saysoforgood.com%2Fux%2Fimages%2FHealth.svg", 
"offer_url" : "https://survey.saysoforgood.com/trop/survey/59974770e4b0cbdb4262c8fd?init=RFAQMvvcOcj3QK7wK6kmxoPXFpA%7B%22tropPanelist%22%3A%225ebbf8f4e4b01c40f6ecdd6f%22%2C%22project%22%3A%225ea7e96de4b05b008da6fd55%22%7D", 
"payout" : "$2.20", 
"payout_currency" : "USD", 
"projectCR" : 36, 
"projectEPC" : "$.80", 
"sourceStats" : { 
"completes" : 0, 
"cr" : 0, 
"epc" : 0, 
"quotas" : 0, 
"starts" : 0, 
"terminates" : 0
}, 
"survey_id" : "RFG3553903-041", 
"title" : "Take a look at this survey", 
"type" : 3
}, 

The response contains a list of surveys targeted to the specific respondent. As each respondent makes multiple attempts, our targeting will become more precise as we use additional collected information to target, and track the answers across multiple visits. The URLs provided must only be used for that specific respondent, as they contain information identifying the respondent and the selected survey.