Skip to content
Retreaver Javascript API
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
config add Retreaver.configure, update jsdocs, bump verison Jul 25, 2015
dist Fix clkg Unbounce conversion goals. Apr 30, 2019
examples Added ability to dynamically find and replace all occurrences of a ph… Oct 18, 2016
lib/retreaverjs Fix clkg Unbounce conversion goals. Apr 30, 2019
src Fix clkg Unbounce conversion goals. Apr 30, 2019
.gitignore Fixed Retreaver.Vendor not existing Oct 28, 2016
Gemfile init May 27, 2015
LICENSE init May 27, 2015 init May 27, 2015
Rakefile init May 27, 2015
package.json Fix clkg Unbounce conversion goals. Apr 30, 2019
retreaverjs-rails.gemspec Fix unhanded GA errors. May 26, 2016



Include the retreaver.js script on the page.

<script src="/path/to/retreaver.js" type="text/javascript"></script>



Initialize a campaign that will return numbers matching home_value:50000

var campaign = new Retreaver.Campaign({ campaign_key: 'the_key_example' });

Request a number from the campaign matching tags, and use jQuery to display it on the page.

var tags = { 
  home_value: '50000' 
campaign.request_number(tags, function (number) {
  $('#number_on_page').html( number.get('formatted_number') );



Display the tags currently attached to this number.


Add / Remove / Clear Tags

number.add_tags({'date_of_birth': '1980/01/01'});
number.remove_tags({'date_of_birth': '1980/01/01'});

When you are finished with a number you can release it back to the campaign.

Initiate Call

You can initiate a call with the user.

number.initiate_call('1112224444', {}, function(call){
  // Call initiated

Numbers have attributes that can be retrieved.

Attribute Type Description
id numeric number id
campaign_key alpha-numeric campaign key
formatted_number string formatted number according to national style (866) 898-7878
number string E.164 formatted number +18668987878
plain_number string unformatted phone number digits 8668987878
target_open boolean does this number have targets that are available to take calls?
is_per_visitor boolean does this number track unique visitors?
tag_values object the tags currently assigned to this number
You can’t perform that action at this time.