Documentation

Integration

To start using Beetle Eye you need to send your data to our API endpoint. Here is an example with cURL

  
 curl -X POST \
  https://app.beetle-eye.com/api/v1/add-form \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -d '{  
   "api_key":"[YOUR_API_KEY]",
   "call_mode":"production",
   "form_key":"[FORM_KEY]",
   "source":"[SOURCE_ID]",
   "cookie_key":"[COOKIE_KEY]",
   "post_url":"[YOUR_URL]",
   "ip":"[SOURCE_IP]",
   "data":{  
     "form_field1": "value1",
     "form_field2": "value2", 
      .......................     
   }
 }'
 
 
curl -X POST \
  https://app.beetle-eye.com/api/v1/add-sale \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -d '{
  "api_key": "[YOUR_API_KEY]",
  "sale_id": "[UNIQUE SALE ID]",
  "call_mode": "production",
  "source": "[SOURCE_URL]",
  "cookie_key": "[COOKIE_KEY]",
  "lead": {
          "email": "[EMAIL]",
          "first_name": "[FNAME]",
          "last_name": "[LNAME]", 
          "county": "[COUNTY]",
          "fax": "[FAX]",
          "company_address": "[COMPANY_ADDRESS]",
          "company_phone": "[COMPANY_PHONE]",
          "company_city": "[COMPANY_CITY]",
          "company_state": "[COMPANY_STATE]",
          "company_email": "[COMPANY_EMAIL]",
          "company_country": "[COMPANY_COUNTRY]"
          ..................
          "[custom_field_id]": "[CUSTOM_DATA"]   
          /* You can find the ID's in the first column of the SDL Editor */
  },
  "data": [{
          "cc_name": "[CC_NAME]",
          "daily_rate": [9.999999999999999999999999999999999],
          "order_date": "[Y-m-d h:i:s]", 
          "custom_data": {
           /*list here all the custom fields you want to have available with sale record creation as key - value pairs. */
          }
        /* repeat this line as many items there are into a single sale. check eSDL list below*/
   ]
 }'

In conjunction with the API calls you must send to record your data and in order to use Beetle Eye tracking on your website you will need to embed the following piece of code above the closing body tag of all of your pages. Its important to note that the API calls you send and the JS lib work together and you must have them both working if you wish to receive all the data properly.

You will need 2 variables from your Beetle Eye account: your Api Key and your Source Id. The API key assocciated with your account can be located when you click on the top right-hand corner on your name and expand your profile menu, then click the "API" submenu and new screen will load with your account id. The Source Id can be located when you click on the left hand side navigation under Sources/All Sources. You will land on page that shows a list of all your available sources. The second column in this table is called "Key" and that is the value you need for your Source Id variable.


//BeetleEye Analytics : START

    var element = document.createElement("script");
    element.setAttribute('type', 'text/javascript');
    element.src = (document.location.protocol == "https:" ? "https:" : "http:") + "//app.beetle-eye.com/js/client-libs/beanalytics.min.js";
    element.async = true;

    var options = {
        apikey: "YOUR_API_KEY_HERE",
        source_id: "YOUR_SOURCE_ID_HERE",
        withEvents: true,
        debug: false
    }

   element.onload = function()
   {
       var _be = new beTracking();
       _be.setOptions(options);

   };

   var s = document.getElementsByTagName('script')[0];
   s.parentNode.insertBefore(element, s);
//BeetleEye Analytics : END


//BeetleEye Analytics : START

    var element = document.createElement("script");
    element.setAttribute('type', 'text/javascript');
    element.src = (document.location.protocol == "https:" ? "https:" : "http:") + "//app.beetle-eye.com/js/client-libs/beanalytics.min.js";
    element.async = true;

    var saleObj = {
        apikey: "YOUR_API_KEY_HERE",
        source_id: "YOUR_SOURCE_ID_HERE",
        sale_id: "UNIQUE_SALE_ID_NUMBER",
        debug: false,
        call_mode: "production",
        cookie_key: "random-cookie-key",
        order_date: "YYYY-MM-DD",
	lead: {
	  address_line: "",
          city: "",
          company_name: "",
          country: "",
          email: "",
          first_name: "",
          last_name: "",
          phone: "",
          state: "",
          zip: "" 		
        },
        data: [{
           total_cost: "", 
           total_cost_with_tax: ""
           /* list any of the eSDL fields here as key: 'value' pairs */
           /* every item sold must be in its own array */
        }]
    }

    element.onload = function() {
        var _be = new beTracking();
        _be.addSale(saleObj);
    };

    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(element, s);

// BeetleEye Analytics : END

The Standard Data List Editor is created to help you manipulate custom data key - value pairs. The fields created with the SDL Editor have 2 characteristics: numerical ID and text based name. The ID is unique and it's assigned automatically from the system. You only need to input a common name for your field. Once the field is created you will see it in your Forms editor underneath the "Assigned Field Name" section and you can start assigning incoming form data fields to it, also note that you can also use these fields for incoming sales data.

There are two types of standard data that Beetle Eye is capable of processing out of the box. Of course you can create custom fields and you are not restricted to the standard fields.

The SDL ( Standard Data List)

Field Name Field Accepted Data Explanation
first_name text (sdl_id = 1) First Name
last_name text (sdl_id = 2) Last Name
email text (sdl_id = 11) Email
address_line text (sdl_id = 3) Address Line
address_line_2 text (sdl_id = 19) Address Line 2
county text (sdl_id = 7) County
city text (sdl_id = 4) City
company_name text (sdl_id = 12) Company Name
company_address text (sdl_id = 13) Company Address
company_phone text (sdl_id = 14) Company Phone
company_city text (sdl_id = 15) Company City
company_state text (sdl_id = 16) Company State
company_email text (sdl_id = 17) Company Email
company_country text (sdl_id = 18) Company Country
country text (sdl_id = 8) Country
language text (sdl_id = 20) Language
phone text (sdl_id = 9) Phone Number
fax text (sdl_id = 10) Fax
state text (sdl_id = 6) State
zip text (sdl_id = 5) Zip

The e-commerce SDL is the standard list of fields accepted for sales.

Field Name Field Accepted Data Explanation
sale_id text Sale ID Beetle Eye sale identifier
cc_name text text Name on Credit Card
cc_type_code text Credit Card Type
cc_type_name text Credit Card Type Name
daily_rate 0 - 9999999999999.99 Daily Rate
daily_rate_with_tax 0 - 9999999999999.99 Daily Rate with Tax
taxes 0 - 9999999999999.99 Taxes
total_cost 0 - 9999999999999.99 Total Cost
total_cost_with_tax 0 - 9999999999999.99 Total Cost with Tax
chain_entity_id text Chain ID
chain_entity_name text Chain Name
entity_name text Business Name
entity_id text Business ID
rate_id text Rate ID
rate_name text Rate Name
rate_type_code text Rate Type Code
item_id text Item ID
item_name text Item Name
adult_quantity 0 - 999999999 Total number of adults in reservation.
arrival_date 2016-11-08 20:23:17 (Y-m-d H:i:s) Arrival date of reservation.
booking_date 2016-11-08 20:23:17 (Y-m-d H:i:s) Booking Date
booking_pace 0 - 999999999 Booking Pace: Number of days between booking date and check-in date.
cancelation_num text text Cancellation Number Assigned at cancellation.
reservation_cancelation_date 2016-11-08 20:23:17 (Y-m-d H:i:s) Date Reservation was Cancelled Date Reservation was Cancelled (hotel date).
children_quantity 0 - 999999999 Children Quantity: Total number of children in reservation as defined in Children field.
confirmation_number text Confirmation Number Confirmation number of the reservation.
currency_code text Currency Code: Currency in which reservation was booked, for example, USD or EURO.
currency_prefix text Currency Prefix Currency Prefix ($, £, €, etc.) for currency.
days_to_checkin 0 - 999999999 Days to Check-in: Number of days between search date and check-in date.
departure_date 2016-11-08 20:23:17 (Y-m-d H:i:s) Departure Date
group_code text Group Code: Code of group associated to reservation, when applicable.
group_name text Group Name: Name of group associated to the reservation, when applicable.
guest_quantity 0 - 999999999 Guest Quantity: Number of Total Guests = total of amounts in Adult and Children fields.
nights_quantity 0 - 999999999 Nights Quantity Total number of nights booked.
promo_code text Promo Code: Promotional Code of promotion applied at booking, when applicable.
promo_name text Promo Name: Name of the promotion applied at booking, when applicable.
reservation_status text Reservation Status: See Reservation Status for codes and descriptions.
reservation_type text Reservation Type
item_quantity 0 - 999999999 Room Quantity: Quantity of Items
item_nights_quantity 0 - 999999999 Room Nights Quantity
senior_quantity 0 - 999999999 Senior Quantity
canceled 1 \ 0 Canceled
order_date 2016-11-08 20:23:17 (Y-m-d H:i:s) Order Date
order_number text Order Number
custom_data object Object containing custom key-value pairs. List here all the custom fields you want to have available with sale record creation as key - value pairs.

If you want to do e-commerce tracking on your site or with a 3rd party vendor that allows your to put tracking code on their site you will need this code. Please check above on how to locate your api and source id keys.

API

Beetle Eye has a RESTful API you can make calls to. Below you can find endpoints, requests and responses information. All the requests are POST, any other method will be returning an error.

https://app.beetle-eye.com/api/v1/add-form
Use this request when you want to submit a form directly to the API.
Request Example:
  
  
  {
   "api_key":"YOUR_KEY",
   "call_mode":"production", 
   "form_key":"FORM_KEY",
   "group":"GROUP_KEY",
   "source":"SOURCE_KEY",
   "cookie_key":"RANDOM_COOKIE_KEY",
   "post_url":"SOURCE_URL",
   "ip":"SOURCE_IP",
   "data":{  
      "first_name":"[FIRST_NAME]",
      "last_name":"[LAST_NAME]",
      "email":"[EMAIL]",
      "subscribe_me":1
      /* This list accepts all the values from the SDL list also custom values as well */
    }
  } 
  
Parameters:
  • YOUR_KEY (required): This is your api key that can be obtained from the user menu on the top right hand side in the Beetle Eye App.
  • Call Mode (production/development): This variable can be either one of the development or production. While in production the call is significantly faster and does not report directly errors but rather puts them in the log. Please always use production for live code. If in development mode, the request is being processed in real time and returns errors immediately.
  • FORM_KEY (required): Form Key is arbitrary alphanumeric key that you need to pass in order to have all the data recorded in one place for the form your are sending. Please do not use spaces or special symbols for that key.
  • GROUP_KEY: This key is generated from Beetle Eye. You can obtain it under "Sources / Sources Groups". You need to pas this key if you want the incoming leads to be splitted into your predefined groups.
  • SOURCE_KEY (required): This is the key of the source you are submitting the form to. It can be found in the Beetle Eye Application under "Sources / All Sources". The second column in that table states "Key". That will be the automatically assigned key for your source.
  • RANDOM_COOKIE_KEY: If your site has the Beetle Eye JS library installed you need to check for the value of the cookie named "_beTracking". You need to obtain its value and pass it under RANDOM_COOKIE_KEY. If there is no cookie set or you are just making a direct API callm please leave this value empty.
  • SOURCE_IP (required): The IP address from which the form originates.
Sucessful Response:

  {
    "success": [
    	 "Form was added."
    ]
  }

Failed Response ( will contain different messages depending on the error) :
  
  {
    "error": [
        "Invalid Api Key.[2]"
    ]
  }
  
https://app.beetle-eye.com/api/v1/add-sale
Use this request when you want to submit sale information to the API.
Request Example:
  

  {
    "api_key": "YOUR_API_KEY",
    "sale_id": "SALE_ID",
    "call_mode": "production",
    "source": "SOURCE_ID",
    "cookie_key": "YOUR_COOKIE_KEY",
    "lead": {
            "email": "CUSTOMER_EMAIL", (required)
            "first_name": "CUSTOMER_FIRST_NAME",
            "last_name": "CUSTOMER_LAST_NAME"
    },
    "data": [
          {
            "cc_name": "......",
            "order_date": "2017-02-11 21:50:48"
          },
          //  Repeat this block for each item in your sale using the eSDL list values 
        ]
  }

Parameters:
  • YOUR_KEY (required): This is your api key that can be obtained from the user menu on the top right hand side in the Beetle Eye App.
  • Call Mode (production/development): This variable can be either one of the development or production. While in production the call is significantly faster and does not report directly errors but rather puts them in the log. Please always use production for live code. If in development mode, the request is being processed in real time and returns errors immediately.
  • SALE_ID (required): Uniquely assigned alphanumeric sale id.
  • SOURCE_KEY (required): This is the key of the source you are submitting the form to. It can be found in the Beetle Eye Application under "Sources / All Sources". The second column in that table states "Key". That will be the automatically assigned key for your source.
  • RANDOM_COOKIE_KEY: If your site has the Beetle Eye JS library installed you need to check for the value of the cookie named "_beTracking". You need to obtain its value and pass it under RANDOM_COOKIE_KEY. If there is no cookie set or you are just making a direct API callm please leave this value empty.
Sucessful Response:

  {
  "success": [
    "Form was added."
    ]
  }

Failed Response ( will contain different messages depending on the error) :
  
    {
    "error": [
      "Invalid Api Key.[2]"
      ]
    }
  

User Documentation

You can download the entire Beetle Eye documentation from here.