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
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

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
@leadbi
leadbi / JavaAPIExample.java
Created April 1, 2021 18:35
LeadBI Java Example
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 / 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({
@leadbi
leadbi / leadbi_shop_api.js
Last active March 12, 2021 18:49
LeadBI ECommerce JavaScript API
// 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 / node_send_form.js
Created October 18, 2020 16:45
LeadBI Form Webhook
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 / 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 / dynamic_content.md
Last active August 28, 2018 07:28
LeadBI Dynamic Content

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 / remove_utm.js
Last active February 15, 2018 13:50
Remove UTM params from query
(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;
}