✈ī¸Migration from older SDK versions

This guide will show you how to migrate from older versions.

Migrating from 1.x to 2.x version

To migrate from 1.x to 2.x versions please follow this guide:

1. Initializing the object

v1.x

import Fuul from '@fuul/sdk';
const fuul = new Fuul('your-api-key');

v2.x

import { Fuul } from '@fuul/sdk';
Fuul.init({ apiKey: 'your-api-key' });

Initialization is good for the entire request lifecycle so doing it at the root of your app is probably best.

For usage in any other modules, you just import Fuul and use it like this:

import { Fuul } from '@fuul/sdk';

Fuul.sendPageview();

2. Start sending Pageview events manually

The most important upgrade relies on the pageview event. In SDK v1.x, pageview events were sent automatically when instancing the object. That led to some confusion as it was not very explicit.

Now on v2, pageview events have to be sent manually when the page is rendered. Please check how to send this event in this guide.

3. Change the sendConnectWallet method name

On v1, the method was called sendConnectWalletEvent, now it was changed to sendConnectWallet.

For more information on sending this event, check out this guide.

Migrating from 2.x to 3.x version

There is only a minor breaking change when upgrading the Fuul SDK to the 3.x versions:

The generateTrackingLink method now returns a Promise<string> instead of a string. It now also accounts for affiliate codes created by the affiliateAddress argument.

v1.x/v2.x

import { Fuul } from ('@fuul/sdk');

const trackingLinkUrl = Fuul.generateTrackingLink(
    baseURL, affiliateAddress)

// Returns
"http://yourwebsite.com?af=<affiliateAddress>"

v3.x

import { Fuul } from ('@fuul/sdk');

const trackingLinkUrl = await Fuul.generateTrackingLink(
    baseURL, affiliateAddress)

// Returns
"http://yourwebsite.com?af=<affiliateAddressOrCode>"

For more information on getting the affiliate link, check out this guide.

Last updated