Skip to content

ShopGun SDK for JavaScript in the browser and Node.js.

Notifications You must be signed in to change notification settings

izotos/shopgun-js-sdk

 
 

Repository files navigation

ShopGun JavaScript SDK Build Status

This SDK works both client-side in your browser but also server-side in a Node.js environment.

Creating an App

First, you need to create a ShopGun app allowing you to make API requests. You will be prompted to create a new user first.

When you've created the app please email us at [email protected] to get your app approved so that it doesn't get rate limited. Remember to include your app key.

We recommend you creating 2 apps: 1 for production and another for development. This ensures environments aren't mixed.

Setup

In the Browser

The SDK makes use of both JavaScript and CSS so you need to load two resources in the browser:

<link href="https://d21oefkcnoen8i.cloudfront.net/sgn-sdk-1.1.24.min.css" rel="stylesheet" type="text/css">
<script src="https://d21oefkcnoen8i.cloudfront.net/sgn-sdk-1.1.24.min.js" id="sgn-sdk" data-app-key="YOUR_APP_KEY" data-track-id="YOUR_TRACK_ID"></script>

By defining your app key and track identifier as data attributes when including the JavaScript file the SDK auto-configures itself.

In Node.js

We recommend you use npm to install the SDK. To install, simply type the following into a terminal window:

npm install shopgun-sdk

When installed you can require and configure the SDK:

SGN = require('sgn-sdk');

SGN.config.set({
    appKey: 'YOUR_APP_KEY',
    appSecret: 'YOUR_APP_SECRET'
});

PDF Viewer

To provide your users with a PDF viewing experience you need to use our PagedPublicationKit. We've built an example that shows how it works where you can inspect the source code.

Multiplatform

To learn more about integrating the same experience on iOS and Android be sure to check out the respective SDK's:

About

ShopGun SDK for JavaScript in the browser and Node.js.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CoffeeScript 88.3%
  • CSS 7.4%
  • JavaScript 4.3%