Metric Methods

Use Cases

Clicks

Get all clicks.

GET https://api.bananatag.com/clicks
Query Parameters
Parameter Type Default Description
start string Return tags sent to contact after this date.
end string Return tags sent to contact before this date.
rtn string json The format of the response "json", "text" or "html"
Response Parameters
Parameter Type Description
tagID string A tag id hash.
clicks Array An array of click objects
click . recipient object An object of recipient data.
click . recipient . recipientID string A recipient id hash.
click . recipient . name string The recipient name.
click . recipient . email string The recipient email address.
click . details object An object of click details.
click . details . clickDate timestamp The date time of the click.
click . details . counry string Country click occurred in.
click . details . region string Region click occurred in.
click . details . city string City click occurred in.
click . details . latitude string Latitude coordinate where click occurred.
click . details . longitude string Longitude coordinate where click occurred.
click . details . device string Device click occurred on.
click . details . os string Operating system click occurred on.
click . details . browser string Browser click occurred on.
Examples
                                        
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
import org.json.simple.JSONObject;

// create BtagAPI class object using your AuthID and Access Key
BtagAPI btag = new BtagAPI("AuthID", "Access Key");
HashMap<String, Object> params = new HashMap<String, Object>();
JSONObject result = new JSONObject();

// build parameters to map
params.put("start", "2013-10-30");
params.put("end", "2013-11-30");

do {
    result = btag.request("clicks", params);
    System.out.println(result);
    TimeUnit.SECONDS.sleep(1);
} while (!result.isEmpty());
                                        
                                    
                                        
var BtagAPI = require('bananatag-api.js');

// create BtagAPI object using your AuthID and Access Key
var btag = new BTagAPI('AuthID', 'Access Key');

// make request to get data
btag.request('clicks', {start : '2013-10-30', end : '2013-11-30'}, function (err, results) {
    console.log(results);
}
                                        
                                    
                                        
use Bananatag\Api;

// Create Api class instance
$btag = new Api('AuthID', 'Access Key');

// make request to get data
$results = $btag->request('clicks', [start => '2013-10-30', end => '2013-11-30']);

// print data
print_r($results);
                                        
                                    
                                         
# import BTagAPI class
from btapi.btapi import BTagAPI

# create BTagAPI object using your AuthID and Access Key
btag = BTagAPI('AuthID', 'Access Key')

# make request to get data
data = btag.request('clicks', {start : '2013-10-30', end : '2013-11-30'})

print data
                                         
                                     

Tag Clicks

Get clicks for tag with the given id.

GET https://api.bananatag.com/clicks/tag/tagID
Query Parameters
Parameter Type Default Description
rtn string json The format of the response "json", "text" or "html"
Response Parameters
Parameter Type Description
clicks Array An array of click objects
click . clickDate timestamp The date time of the click.
click . counry string Country click occurred in.
click . region string Region click occurred in.
click . city string City click occurred in.
click . latitude string Latitude coordinate where click occurred.
click . longitude string Longitude coordinate where click occurred.
click . device string Device click occurred on.
click . os string Operating system click occurred on.
click . browser string Browser click occurred on.
click . tagID string Tag id of the opened message.
Examples
                                        
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
import org.json.simple.JSONObject;

// create BtagAPI class object using your AuthID and Access Key
BtagAPI btag = new BtagAPI("AuthID", "Access Key");
HashMap<String, Object> params = new HashMap<String, Object>();
JSONObject result = new JSONObject();

do {
    result = btag.request("clicks/tag/5tH4pq", params);
    System.out.println(result);
    TimeUnit.SECONDS.sleep(1);
} while (!result.isEmpty());
                                        
                                    
                                    
var BtagAPI = require('bananatag-api.js');

// create BtagAPI object using your AuthID and Access Key
var btag = new BTagAPI('AuthID', 'Access Key');

// make request to get data
btag.request('clicks/tag/5tH4pq', {}, function (err, results) {
    console.log(results);
}
                                    
                                
                                    
use Bananatag\Api;

// Create Api class instance
$btag = new Api('AuthID', 'Access Key');

// make request to get data
$results = $btag->request('clicks/tag/5tH4pq', []);

// print data
print_r($results);
                                    
                                
                                     
# import BTagAPI class
from btapi.btapi import BTagAPI

# create BTagAPI object using your AuthID and Access Key
btag = BTagAPI('AuthID', 'Access Key')

# make request to get data
data = btag.request('clicks/tag/5tH4pq')

print data
                                     
                                 

Opens

Get all opens.

GET https://api.bananatag.com/opens
Query Parameters
Parameter Type Default Description
start string Return tags sent to contact after this date.
end string Return tags sent to contact before this date.
rtn string json The format of the response "json", "text" or "html"
Response Parameters
Parameter Type Description
tagID string A tag id hash.
opens Array An array of open objects.
open . recipient object An object of recipient data.
open . recipient . recipientID string A recipient id hash.
open . recipient . name string The recipient name.
open . recipient . email string The recipient email address.
open . details object An object of open details.
open . details . openDate timestamp The date time of the open.
open . details . counry string Country open occurred in.
open . details . region string Region open occurred in.
open . details . city string City open occurred in.
open . details . latitude string Latitude coordinate where open occurred.
open . details . longitude string Longitude coordinate where open occurred.
open . details . device string Device open occurred on.
open . details . os string Operating system open occurred on.
open . details . browser string Browser open occurred on.
Examples
                                        
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
import org.json.simple.JSONObject;

// create BtagAPI class object using your AuthID and Access Key
BtagAPI btag = new BtagAPI("AuthID", "Access Key");
HashMap<String, Object> params = new HashMap<String, Object>();
JSONObject result = new JSONObject();

// build parameters to map
params.put("start", "2013-10-30");
params.put("end", "2013-11-30");

do {
    result = btag.request("opens", params);
    System.out.println(result);
    TimeUnit.SECONDS.sleep(1);
} while (!result.isEmpty());
                                        
                                    
                                    
var BtagAPI = require('bananatag-api.js');

// create BtagAPI object using your AuthID and Access Key
var btag = new BTagAPI('AuthID', 'Access Key');

// make request to get data
btag.request('opens', {start : '2013-10-30', end : '2013-11-30'}, function (err, results) {
    console.log(results);
}
                                    
                                
                                    
use Bananatag\Api;

// Create Api class instance
$btag = new Api('AuthID', 'Access Key');

// make request to get data
$results = $btag->request('opens', [start => '2013-10-30', end => '2013-11-30']);

// print data
print_r($results);
                                    
                                
                                     
# import BTagAPI class
from btapi.btapi import BTagAPI

# create BTagAPI object using your AuthID and Access Key
btag = BTagAPI('AuthID', 'Access Key')

# make request to get data
data = btag.request('opens', {start : '2013-10-30', end : '2013-11-30'})

print data
                                     
                                 

Tag Opens

Get opens for tag with the given id.

GET https://api.bananatag.com/opens/tag/tagID
Query Parameters
Parameter Type Default Description
rtn string json The format of the response "json", "text" or "html"
Response Parameters
Parameter Type Description
opens Array An array of open objects.
open . openDate timestamp The date time of the open.
open . counry string Country open occurred in.
open . region string Region open occurred in.
open . city string City open occurred in.
open . latitude string Latitude coordinate where open occurred.
open . longitude string Longitude coordinate where open occurred.
open . device string Device open occurred on.
open . os string Operating system open occurred on.
open . browser string Browser open occurred on.
open . tagID string Tag id of the opened message.
Examples
                                            
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
import org.json.simple.JSONObject;

// create BtagAPI class object using your AuthID and Access Key
BtagAPI btag = new BtagAPI("AuthID", "Access Key");
HashMap<String, Object> params = new HashMap<String, Object>();
JSONObject result = new JSONObject();

do {
    result = btag.request("opens/tag/5tH4pq", params);
    System.out.println(result);
    TimeUnit.SECONDS.sleep(1);
} while (!result.isEmpty());
                                            
                                        
                                        
var BtagAPI = require('bananatag-api.js');

// create BtagAPI object using your AuthID and Access Key
var btag = new BTagAPI('AuthID', 'Access Key');

// make request to get data
btag.request('opens/tag/5tH4pq', {}, function (err, results) {
    console.log(results);
}
                                        
                                    
                                        
use Bananatag\Api;

// Create Api class instance
$btag = new Api('AuthID', 'Access Key');

// make request to get data
$results = $btag->request('opens/tag/5tH4pq', []);

// print data
print_r($results);
                                        
                                    
                                         
# import BTagAPI class
from btapi.btapi import BTagAPI

# create BTagAPI object using your AuthID and Access Key
btag = BTagAPI('AuthID', 'Access Key')

# make request to get data
data = btag.request('opens/tag/5tH4pq')

print data
                                         
                                     

Stats

Get all stats.

GET https://api.bananatag.com/stats
Query Parameters
Parameter Type Default Description
start string Return tags sent to contact after this date.
end string Return tags sent to contact before this date.
aggregateData boolean false Combine all stats records into one.
rtn string json The format of the response "json", "text" or "html"
Response Parameters
Parameter Type Description
totalSent integer The total number of tracked tags.
totalOpens integer The total number of tag opens.
totalClicks integer The total number of tag clicks.
uniqueOpens integer The total number of unique tag opens.
uniqueClicks integer The total number unique tag clicks.
dateLastSent timestamp The date of the last tracked tag.
Examples
                                        
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
import org.json.simple.JSONObject;

// create BtagAPI class object using your AuthID and Access Key
BtagAPI btag = new BtagAPI("AuthID", "Access Key");
HashMap<String, Object> params = new HashMap<String, Object>();
JSONObject result = new JSONObject();

// build parameters to map
params.put("aggregateData", true);

do {
    result = btag.request("stats", params);
    System.out.println(result);
    TimeUnit.SECONDS.sleep(1);
} while (!result.isEmpty());
                                        
                                    
                                    
var BtagAPI = require('bananatag-api.js');

// create BtagAPI object using your AuthID and Access Key
var btag = new BTagAPI('AuthID', 'Access Key');

// make request to get data
btag.request('stats', {aggregateData : true}, function (err, results) {
    console.log(results);
}
                                    
                                
                                    
use Bananatag\Api;

// Create Api class instance
$btag = new Api('AuthID', 'Access Key');

// make request to get data
$results = $btag->request('stats', [aggregateData => True]);

// print data
print_r($results);
                                    
                                
                                     
# import BTagAPI class
from btapi.btapi import BTagAPI

# create BTagAPI object using your AuthID and Access Key
btag = BTagAPI('AuthID', 'Access Key')

# make request to get data
data = btag.request('stats', {aggregateData : True})

print data
                                     
                                 

Tag Daily Stats

Get number of unique opens and unique clicks that occurred on the provided date for the provided tag.

GET https://api.bananatag.com/tags/daily/tagID
Query Parameters
Parameter Type Default Description
date string Return opens and clicks on this date for tag.
rtn string json The format of the response "json", "text" or "html"
Response Parameters
Parameter Type Description
opens integer The total number of unique opens that occurred on the provided date.
clicks integer The total number of unique clicks that occurred on the provided date.
Examples
                                        
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
import org.json.simple.JSONObject;

// create BtagAPI class object using your AuthID and Access Key
BtagAPI btag = new BtagAPI("AuthID", "Access Key");
HashMap<String, Object> params = new HashMap<String, Object>();
JSONObject result = new JSONObject();

// build parameters to map
params.put("date", "2015-02-11");

do {
    result = btag.request("tags/daily/5tH4pq", params);
    System.out.println(result);
    TimeUnit.SECONDS.sleep(1);
} while (!result.isEmpty());
                                        
                                    
                                    
var BtagAPI = require('bananatag-api.js');

// create BtagAPI object using your AuthID and Access Key
var btag = new BTagAPI('AuthID', 'Access Key');

// make request to get data
btag.request('tags/daily/5tH4pq', {date : '2015-02-11'}, function (err, results) {
    console.log(results);
}
                                    
                                
                                    
use Bananatag\Api;

// Create Api class instance
$btag = new Api('AuthID', 'Access Key');

// make request to get data
$results = $btag->request('tags/daily/5tH4pq', [date => '2015-02-11']);

// print data
print_r($results);
                                    
                                
                                     
 # import BTagAPI class
 from btapi.btapi import BTagAPI

 # create BTagAPI object using your AuthID and Access Key
 btag = BTagAPI('AuthID', 'Access Key')

 # make request to get data
 data = btag.request('tags/daily/5tH4pq', {date : '2015-02-11'})

 print data