Get Started
Quickstart
Start reading user data in 10 minutes!
Get your API Keys
Gems 💎
To read user data, you need to spend Gems. You can get 100 Gems for $1.
With 100 Gems, you can access 10,000 rows of data. That lets you read 10,000 Netflix shows your users have watched
or explore shopping habits with 10,000 Amazon past orders.
Connect App Clip
Simply launch the Connect App Clip in your application using a URL. Here’s how to construct the Connect URL.
App Clips let users enjoy native app experiences without the need to download a full app. Learn more on Apple’s
Developer Website.
The Connect JS SDK handles parameter validations automagically!
Install the connect library
npm i @gandalf-network/connect
Usage
Import the library
// Typescript && ESModules
import Connect from '@gandalf-network/connect'
// CommonJS
const Connect = require("@gandalf-network/connect");
Connect
// Initialize Connect
const connect = new Connect({
publicKey: 'your_public_key_here',
redirectURL: 'https://yourapp.com/connect-success',
services: {'netflix': true, 'playstation': false}
})
try {
// Generate the Connect URL
const connectUrl = await connect.generateURL()
// Use the URL as needed
console.log('Generated Connect URL:', connectUrl)
// If you want to display a QR Code instead:
const qrCodeDataUrl = await connect.generateQRCode()
} catch (error) {
// handle error
}
Display the QR code using the qrCodeDataUrl
<img src={{qrCodeDataUrl}} alt="Connect QR Code"/>
Finally, pull the data
1
Get Data Key
After your user is done linking their accounts, Connect will navigate to your redirectUrl
with a query
parameter called dataKey
.
You can use the SDK to get the dataKey easily.
const currentUrl = window.location.href; // Gets the current browser URL
const dataKey = connect.getDataKeyFromURL(currentUrl);
Proceed by sending the dataKey to your server, where you can securely request the data you seek.
Alternatively, your redirectURL could be a server-side endpoint. You can get the
dataKey
directly
from your application’s server.2
Securely request the data (server-side)
Install eye-of-sauron
npm i -g @gandalf-network/eyeofsauron
eyeofsauron generate
This will generate an eyeofsauron
folder in your project root directory.
Usage
Import the library
// Typescript
import Eye, { Source } from './eyeofsauron';
// ESModules
import Eye, { Source } from './eyeofsauron/index.js';
// CommonJS
const Connect = require("@gandalf-network/connect");
const { Source } = require('./eyeofsauron');
Get Activity
const eye = new Eye({privateKey: process.env.PRIVATE_KEY})
const { data } = await eye.getActivity({dataKey: dataKey, source: Source.Amazon, limit: 100, page: 2})
That’s all!