Skip to content

Instantly share code, notes, and snippets.

LeadBI leadbi

View GitHub Profile
@leadbi
leadbi / dynamic_content.md
Last active Aug 28, 2018
LeadBI Dynamic Content
View dynamic_content.md

LeadBI Dynamic Content

This feature allows you to pull data from LeadBI into your website pages. Example:

Hello <{{ first_name | Dear Visitor }}>, welcome to our website.

The snippet from above will try to use the first name from LeadBI, if the user is not identified will use "Dear Visitor".

@leadbi
leadbi / leadbi_shop_api.js
Created Mar 5, 2018
LeadBI ECommerce JavaScript API
View leadbi_shop_api.js
// LeadBI Shop API
// Shop.identify(user, callback)
window.$leadbi_website.getCurrentUser(function (err, user) {
return user.getShop(function (err, shop) {
return shop.identify({
first_name: '', // optional
last_name: '', // optional
email: '', // required
@leadbi
leadbi / remove_utm.js
Last active Feb 15, 2018
Remove UTM params from query
View remove_utm.js
(function () {
// remove url param
function removeUrlParam(url, paramName) {
var pattern = new RegExp('\\b(' + paramName + '=).*?(&|$)');
if (url.search(pattern) >= 0) {
return url.replace(pattern, '');
}
return url;
}
@leadbi
leadbi / LeadBiAPI.php
Last active Jan 19, 2018
LeadBI API PHP Example
View LeadBiAPI.php
<?php
/**
* LeadBI API PHP Wrapper
*/
class LeadBiAPI {
/**
* API access id (can be created in Account -> API Keys)
*/
@leadbi
leadbi / leadbi_api.py
Created Dec 13, 2017
LeadBI Python API Call Example
View leadbi_api.py
# LeadBI Python Api call example
import requests
import json
# Examples
# https://gist.github.com/leadbi/82235eedc9619d33a7c7e0ba71e41985
#
# API Calls
# https://gist.github.com/leadbi/4c46c91d4f2d6fb5a3ef431c1414564b
#
@leadbi
leadbi / token_example.php
Last active Sep 28, 2017
SwiftMTA Javacript Logs API
View token_example.php
<?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 Sep 24, 2017
LeadBI Form Events Example
View form_events.html
<!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 Sep 14, 2017
Swift MTA Simple Logs API
View SwiftMTA.php
<?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 Sep 7, 2017
LeadBI API Calls
View api_calls.md
// 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
LeadBI Automation Webhook Data
View leadbi_webhook_data.md

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,
You can’t perform that action at this time.