Developers
Our platform was built to be flexible and intuitive for developers like you. You own all the data you collect with Tradable Bits. Our API and SDK are designed to make it easy to access your fan data, tickets and campaigns at any time, on your terms Customize the front end of any of your campaigns with the help of our documentation, complete with examples. Our RESTful API helps you access, send or receive fan data from our system to your endpoints quickly and securely. Enrich your Fan CRM and Tickets Analytics with data from other CRM systems through our many integrations. Have any questions about our developers platform? Our support team is happy to help.
Tracker and Google Sheets Integration

You can easily integrate Generation of tracker urls into Google Sheets via custom Javascript function. For Excel integration, click here.

Step 1: Make a copy of the tracker sheet template linked here - https://docs.google.com/spreadsheets/d/1XZUQslhpVbPKT8ttFHhLEhDG3WjpBUCSvML57pnhOnQ/edit?usp=sharing

Step 2: Open the Spreadsheet and navigate to Tools -> Script Editor

Step 3: Add Function Definition for Tracker Integration. Make sure to add the public API key from your Tradable Bits account in place of the XXXX-XXXX values, and any virtual domain you'd like


/**
 * Tradable Bits Tracker
 * @customfunction
 */
function createTracker(name, group, marketing_group,url, network, tracker_key, purchase_event_wildcard, venue_id_wildcard) {
  // tracker_name, tracker_group_name and tracker_url are required
  // network and tracker_key are optional
  var tracker_name = name;
  var tracker_group_name = group;
  var tracker_marketing_group_name = tracker_marketing_group_name;
  var tracker_url = url;
  var network = network;
  var tracker_key = tracker_key;
  var purchase_event_wildcard = purchase_event_wildcard;
  var venue_id_wildcard = venue_id_wildcard;

  if (!(tracker_name && tracker_group_name && tracker_url)) {
    return null
  }
  // TradableBits Public API Key goes here
  var api_key = 'XXXXX-XXXX-XXXX-XXXX-XXXXXX';
  var data = {
    'api_key': api_key,
    'tracker_name': tracker_name,
    'tracker_group_name': tracker_group_name,
    'tracker_marketing_group_name': tracker_marketing_group_name,
    'tracker_url': tracker_url,
    'tracker_key': tracker_key,
    'network': network,
    'purchase_event_wildcard' : purchase_event_wildcard,
    'venue_id_wildcard': venue_id_wildcard,
    'virtual_domain': 'tradablebits.com'
  }
  var url = 'https://tradablebits.com/api/v1/trackers/';
  var options = {
    'method': 'post',
    'payload': data
  }
  var response = JSON.parse(UrlFetchApp.fetch(url, options).getContentText())
  return 'https://' + response.virtual_domain + '/trk/' + response.tracker_key
}

function onOpen() {
  // Checkbox column location
  var checkboxColumn = "I"
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var range = sheet.getRange(checkboxColumn + ":" + checkboxColumn);
  var values = range.getValues();

  for (var i = 0; i < values.length; i++) {
    if((values[i][0] == true))
    values[i][0] = false;
  }
  range.setValues(values);
}
    

Step 4: Click 'run' and save your script

Step 5: Navigate back to the tracker sheet and Navigate to File -> Settings -> Calculation tab -> Turn on Iterative calculation. Set Max number of iterations to 1

Step 6: Test tracker creation by entering values in the required fields and clicking 'generate'

Tracker and Excel Integration

Step 1: On the Home tab, select the Add-ins button and import Script Lab.

Step 2: Create a new Script Snippet and paste the following code


/**
 * Tradable Bits Tracker
 * @customfunction
 */
async function createTracker(tracker_name, tracker_group_name, tracker_url, marketing_group, network, tracker_key) {
  // tracker_name, tracker_group_name and tracker_url are required
  // tracker_marketing_group_name, network and tracker_key are optional

  if (!(tracker_name && tracker_group_name && tracker_url)) {
    return null;
  }
  // TradableBits Public API Key goes here
  var api_key = 'XXXX-XXXX-XXXXX-XXXXX';
  const apiUrl = "https://tradablebits.com/api/v1/trackers";

  var data = {
    api_key: api_key,
    tracker_name: tracker_name,
    tracker_group_name: tracker_group_name,
    tracker_url: tracker_url,
    tracker_marketing_group_name: marketing_group,
    tracker_key: tracker_key,
    network: network,
    virtual_domain: "tradablebits.com"
  };

  var formData = new FormData();
  Object.entries(data).forEach(([key, value]) => {
    if (value != null) {
      formData.append(key, value);
    }
  });

  try {
    const res = await fetch(apiUrl, {
      method: "POST",
      body: formData
    });

    if (res.ok) {
      const responseJson = await res.json();
      return "https://" + responseJson.virtual_domain + "/trk/" + responseJson.tracker_key;
    } else {
      return await res.text();
    }
  } catch (error) {
    return error;
  }
}
    

Step 3: Name the script TBITS and then click Register

Step 4: Make cell G1 a checkbox

Step 5: Enter the value in cell H1 as

=IF(G1=TRUE, SCRIPTLAB.TBITS.CREATETRACKER(A1,B1,C1,D1,E1,F1), H1)

Step 6: Assuming that values in A1,B1,C1,D1,E1,F1 are correct, you put the correct API KEY, and the script is named TBITS, tracker shortened url will show up in cell H1 after G1 is checked

NOTE: Script Lab stores the script locally on the browser so each user would need to import it. It is recommended to use Google Sheets if possible because the script is stored on the cloud.