anujtenani / goaffpro

Issues Tracker and Discussion Forum for GoAffPro Affiliate Marketing App
13 stars 4 forks source link

Goaffpro - Affiliate marketing app for your ecommerce store

Roadmap

Issue Tracker

Wiki

API Documentation

Client SDK

To integrate with your ecommerce store

Step 1

To load client SDK on your pages. Must be added to all the pages. Replace public-api-key with the given api key from the admin interface

 (function () {
      let q = [];
      if(!window.Goaffpro){
          window.Goaffpro = function(){
             q.push(arguments);
          }
      }
      var s = document.createElement('script');
      s.type = 'text/javascript';
      s.async = true;
      s.src = 'https://static.goaffpro.com/client_sdk.js';
      s.onload = ()=>q.forEach((item)=> Goaffpro.apply(null, item))
      var x = document.getElementsByTagName('script')[0];
      x.parentNode.insertBefore(s, x);
  })();
   // execute your script immediately here
    Goaffpro('init', 'public-api-key');
    Goaffpro('track-visit');

Step 2

To track conversion from the order thank you page. The data object to pass must conform to the schem described below

Goaffpro('track-conversion', { 
  id:42
  total: 99,
  ...
});

Schema

Example

{
  "id":"string"
   ""
}
Details Name Type Description Required
id String The internal ORDER ID
number String The ORDER number
subtotal_price Number The Order Subtotal (i.e after discounts but before shipping and taxes
total_price Number The Order total (i.e. after discounts, shipping and taxes
total_discounts Number The total discount given on the order
email String The email address of the customer