Skip to content

Instantly share code, notes, and snippets.

Avatar

LeadBI leadbi

View GitHub Profile
@leadbi
leadbi / cart_abandonment.md
Created Aug 8, 2021
Cart abandonment workflow
View cart_abandonment.md

Cart abandonment workflow

LeadBI Automations allow you to send reminder to customers about open carts.

Requirements

  1. Your website needs to use the leadbi woocommerce integration or other custom ecommerce integration.
  2. The customer that adds products to cart needs to be identified by email.

How does it work?

A cart is created when a product is added using the Shop.Cart.addProduct(product, callback) call.

@leadbi
leadbi / cookie-consent-example.html
Last active Apr 28, 2021
LeadBI Cookie Consent integration
View cookie-consent-example.html
View JavaAPIExample.java
import java.io.IOException;
import java.io.Serializable;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpRequest.BodyPublishers;
import java.net.http.HttpResponse.BodyHandlers;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@leadbi
leadbi / node_send_form.js
Created Oct 18, 2020
LeadBI Form Webhook
View node_send_form.js
fetch("https://capi.leadbi.com/forms/{replace_with_form_id}/submit", {
"headers": {
"content-type": "application/json",
},
"body": "{\"first_name\":{\"value\":\"Andrei\",\"name\":\"first_name\",\"type\":\"first_name\"},\"last_name\":{\"value\":\"Tofan\",\"name\":\"last_name\",\"type\":\"last_name\"},\"email\":{\"value\":\"admin@leadbi.com\",\"name\":\"email\",\"type\":\"email\"},\"phone\":{\"value\":\"+00723232322132\",\"name\":\"phone\",\"type\":\"phone_number\"}}",
"method": "POST"
});
@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
Last active Mar 12, 2021
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: 'Andrei', // optional
last_name: 'Tofan', // optional
email: 'andrei@leadbi.com', // required
company: 'LeadBI', // optional
@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);
?>