Skip to content

Instantly share code, notes, and snippets.

View leadbi's full-sized avatar

LeadBI leadbi

View GitHub Profile
@leadbi
leadbi / import.csv
Created October 4, 2021 20:51
LeadBI Import API
View import.csv
csv_email csv_first_name csv_last_name csv_custom1
demo@example.com John Doe custom1
tes@example.com Jane Doe custom1
hi@leadbi.com Hi LeadBI custom1
@leadbi
leadbi / cart_abandonment.md
Created August 8, 2021 07:55
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 April 28, 2021 20:04
LeadBI Cookie Consent integration
View cookie-consent-example.html
@leadbi
leadbi / JavaAPIExample.java
Created April 1, 2021 18:35
LeadBI Java Example
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 October 18, 2020 16:45
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 August 28, 2018 07:28
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 March 12, 2021 18:49
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 February 15, 2018 13:50
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 January 19, 2018 16:19
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 December 13, 2017 10:18
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
#