Skip to content

Instantly share code, notes, and snippets.

View leadbi's full-sized avatar

LeadBI leadbi

View GitHub Profile
@leadbi
leadbi / token_example.php
Last active September 28, 2017 18:47
SwiftMTA Javacript Logs API
<?php
$username = 'dwtgroup';
$password = 'change_me';
$expire = date("c",strtotime("+1 day"));
$alg = 'sha256';
// generate authorization
$authorization = "$username;$expire;$alg";
$authorization = $authorization . ";" . hash_hmac($alg, $authorization, $password);
?>
@leadbi
leadbi / form_events.html
Created September 24, 2017 14:27
LeadBI Form Events Example
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>LeadBI Form Events </title>
</head>
<body onload="_load()" style="height: 2000px">
<h1>LeadBI Form Events</h1>
@leadbi
leadbi / SwiftMTA.php
Last active September 14, 2017 12:21
Swift MTA Simple Logs API
<?php // SwiftMTA.php
class SwiftMTALogsCursor {
/**
* Create result cursor
*/
public function __construct($api, $query, $result, $limit, $offset){
$this->api = $api;
$this->limit = $limit;
@leadbi
leadbi / api_calls.md
Created September 7, 2017 14:20
LeadBI API Calls
// account
'/api/v1/account': ['GET', 'PUT'],
'/api/v1/account/usage': ['GET'],
'/api/v1/account/invoices': ['GET'],
'/api/v1/account/invoices/([0-9]+)/download': ['GET'],

// integrations
'/app/integrations/mailchimp/authorize': ['GET'],
'/app/integrations/mailchimp/callback': ['GET'],
@leadbi
leadbi / leadbi_webhook_data.md
Last active May 23, 2017 07:51
LeadBI Automation Webhook Data

LeadBI Automation Webhook Data

When webhooks are used inside an automation, the engine will replace all email placeholders in the url and make a POST request with the content type application/json containing the following data:

// sample data
{
    // contact
    id: 121324,
@leadbi
leadbi / leadbi_tracking_fields.md
Created May 11, 2017 12:52
LeadBI Tracking Fields

LeadBI Tracking Fields

This is a list of fields that can be used to send data from email campaigns to leadbi.

Example

https://www.leadbi.com/?utm_email=hi@leadbi.com&utm_firstname=Andrei&utm_lastname=Example

Fields

Contact Fields:

@leadbi
leadbi / leadbi_native_form.html
Last active July 23, 2020 05:32 — forked from andrei-tofan/leadbi_native_form.js
LeadBI Native Form Integration
<!--
HTML Integration
Capture form data without javascript (html only)
More documentation: https://gist.github.com/leadbi/a458eb881007c800c045cabfd98ac8af
-->
<!-- the form id is used to capture data only from specific forms -->
<form id="optional-id">
<input type="text" name="firstname"><br>
<input type="text" name="lastname">
@leadbi
leadbi / ninja-forms.js
Created May 5, 2017 11:48 — forked from andrei-tofan/ninja-forms.js
Ninja Forms JavaScript Hook
var form_id = 3;
// listen to all ajax completed events
jQuery(document).ajaxComplete(function (event, jqXHR, ajaxOptions) {
// try to parse response
var data = JSON.parse(jqXHR.responseText || '{}');
// check if the ajax request is for our form
if (data.data.form_id == form_id) {
@leadbi
leadbi / leadbi_api.md
Created May 5, 2017 11:47 — forked from andrei-tofan/leadbi_api.md
LeadBI API access documentation

LeadBI API Access

In order to access the leadbi api you need to create a api key in the account section. After the api key is created you can make api calls using the following headers:

  • X-Access-Id - api key id
  • X-Access-Secret - api key secret

Request Example

GET /api/v1/websites
Host: app.leadbi.com
@leadbi
leadbi / private_area.js
Last active April 1, 2021 11:28 — forked from andrei-tofan/private_area.js
LeadBI user identification api
// check if $leadbi_website api is available
if(window.$leadbi_website){
// fetch user object of the current visitor
window.$leadbi_website.getCurrentUser(function (err, user) {
// call the identify api
// calling this method multiple times for the same email address will not create duplicate contacts
return user.identify({