GithubHelp home page GithubHelp logo

lefty-affiliation's Introduction

lefty-affiliation

Usage

Installation

Copy/Paste this at the end of you head tag

(function(t,e,i,n){t._lefty=t._lefty||[];function s(){_lefty.push(arguments)}var
c=e.createElement("script");c.setAttribute("src","https://cdn.jsdelivr.net/gh/leftyio/lefty-affiliation@"+i+"/dist/index.min.js");c.setAttribute("async","");e.head.appendChild(c)})(window,document,"0");

Then init lefty pixel

lefty("init", "<PIXEL_ID>", {
  debug: true, // must be false in production
});

Trigger conversion

Starts building the order

var product = Lefty.createProduct(PRODUCT_ID, name);

var productItem = Lefty.createProductItem(
  ITEM_ID,
  product,
  20, // total amount
  2 // quantitiy
);

var order = Lefty.createOrder(
  ORDER_ID,
  [
    product,
    // Add more product item
  ],
  "USD"
);

lefty("conversion", order);

Shopify Web Pixels API

https://shopify.dev/docs/api/web-pixels-api

For Shopify Web Pixel API, installation is different. Initialize your pixel with the following script.

window._lefty = window._lefty || [];
function lefty() {
  _lefty.push(arguments);
}

var script = document.createElement("script");
script.setAttribute(
  "src",
  "https://cdn.jsdelivr.net/gh/leftyio/lefty-affiliation@0/dist/index.min.js"
);
script.setAttribute("async", "");
document.head.appendChild(script);

Then subscribe to shopify events you want and trigger lefty conversion.

analytics.subscribe("checkout_completed", (event) => {
  let checkout = event.data.checkout;

  // build lefty order using shopify checkout data

  lefty("conversion", order);
});

lefty-affiliation's People

Contributors

lejard-h avatar

Stargazers

 avatar

Watchers

Roman Berenstein avatar  avatar christian rivasseau avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.