Offer18 Knowledge Base
  • Welcome!
  • Network
    • Offers
      • Create New Offer
      • Advertiser URL Builder
      • Tracking URL Macros
      • Offer - General
      • Offer - Targeting
      • Offer - Targeting Rules
      • Offer - Creatives
      • Offer - Assign Affiliates
      • Offer - Capping Rules
      • Offer - Events
      • Offer - Payout Rules
      • Offer - Anti-Fraud
      • Offer - Fallback / JS Integration
      • Create CPS offer
      • Revenue Share Offer
      • Smart Offer
      • Deep Link
      • Pre-landing Page
      • Offer Categories
      • Coupons
      • Suppression List
      • Retargeting Tag
    • Affiliates
      • Create Affiliate
      • Affiliate Profile
      • Affiliate Employee
      • Manage Affiliates
      • Manage Offers
      • Generate Tracking URL
      • Affiliate Global Postback
      • Affiliate Postback Test
      • API Access Manage
      • Log in Affiliate Account
      • Reset Password
      • Affiliate Referrals
    • Advertisers
      • Create Advertiser
      • Advertiser Profile
      • Advertiser's Offers
      • Advertiser Test Link
      • Login as Advertiser
      • Password Reset
    • Postback Integration
    • Integration
      • Shopify
      • Cookieless integration with Shopify
      • WooCommerce
      • Cookieless integration with WooCommerce
    • Mobile Attribution Integration
      • AppsFlyer
        • Global Attribution URL
        • AppsFlyer Normal Postback
        • Advanced Privacy Postback
        • AppsFlyer - Click Signing
      • Adjust
      • Branch
      • Singular
      • Kochava
    • Reports
      • Reports
      • Reports - KPI
      • Reports - Templates
      • Conversion Logs
      • Affiliate Postback Logs
      • Advertiser Postback Logs
      • Capping Logs
    • Account Configuration
      • General Settings
      • Tracking Settings
      • Custom Appearance
      • SMTP Settings
      • Affiliate Settings
      • Advertiser Settings
    • Employees
      • Create Employee Account
      • Custom - Permissions
      • Clone Permissions
      • Additional Access
    • Tools
      • Mailer
      • Import Data
        • Import Affiliates
        • Import Affiliate Postback
        • Import Advertisers
        • Import Offers
        • Import Conversions
      • Offer Sync
        • Offer Sync Guide
        • Sync Logs
      • Product Feed
      • Automation
      • Link Tester
      • Fraud Detection
        • Fraud Fender
        • Conversion Risk Monitor
        • 3rd Party Integrations
    • Network API
      • Offers API
      • Offer Create API
      • Conversion API
      • Reports API
      • Affiliate & Advertiser Login API
      • Affiliate & Advertiser Create API
      • Affiliate & Advertiser Password Reset
      • OTP API
    • FAQ's
      • How to define event price in Payout Rule?
      • How to define affiliate specific payout in Payout Rules?
      • How to view Click logs?
      • What are different status in Advertiser Postback logs?
      • Why Domain have been flagged for SPAM?
      • What are different Affiliate Tracking URL Parameters?
    • SDK
      • Web SDK
      • Cookieless Tracking
      • Android SDK
      • Node SDK
    • Probabilistic Attribution
  • Universal
    • IPs Whitelist
    • Common Values
  • Affiliate
    • Affiliate API's
      • Offers API
      • Request Offer API
      • Reports API
      • Coupon API
      • SDK - Affiliate Offer Table
    • Integration
      • Google Ads Integration
      • Google Ads Integration - Web SDK
      • Offer18 - Zapier - Google Ads
      • Facebook Ads Integration
      • Facebook Conversion API
      • TikTok Event API
      • Snapchat Conversion API
    • Deep Link
    • Referral Program
  • iGaming
    • iGaming - Create Offer
    • iGaming - Events
    • iGaming - Reports
    • iGaming - Postback
    • iGaming - API
      • User API
      • Activity API
    • iGaming - SDK
      • WebSDK
Powered by GitBook
On this page
  • Get started
  • Installation
  • Usage
  • Conversion flow
  • SDK flow
  • Method Overview
  • Node SDK Compatibility with Frontend Frameworks and Libraries

Was this helpful?

  1. Network
  2. SDK

Node SDK

This Node.js SDK is designed to track user interactions, such as clicks, impressions, conversions and other events, on your web applications

PreviousAndroid SDKNextProbabilistic Attribution

Last updated 1 month ago

Was this helpful?

Get started

To start tracking using Offer18's Node SDK, you'll need to integrate the SDK into your web application as a node module.

Find out latest stable version of Node Package


Installation

You can install the package using npm:

npm install offer18-sdk

or

npm i offer18-sdk


Usage

Import

import Offer18SDK from 'offer18-sdk';

Initialize

const Offer18WebSDK = new Offer18SDK();

Available Methods

// Initialize Conversion
Offer18WebSDK.initializeConversion('YOUR-CLICK-ID-PARAMETER');

// Register Click
Offer18WebSDK.trackClick(options);

// Register Impression
Offer18WebSDK.trackImpression(options);

// Register Conversion
Offer18WebSDK.trackConversion(options);

// Reset Cookies
Offer18WebSDK.clearCookies();

// Enable Logger
Offer18WebSDK.activateDebugMode();


Conversion flow

The conversion flow is the sequence in which only conversions will be tracked by the Node SDK. To implement the conversion flow, After initializing the SDK, you need to add methods in the following order::

Placement : Page load or after the component mounts

Offer18WebSDK.initializeConversion('YOUR-CLICK-ID-PARAMETER');

then

Placement : Thank you Page/Order Success Page

Offer18WebSDK.trackConversion(options);


SDK flow

The SDK flow is the sequence that allows users to track the entire conversion process in the Node SDK, including tracking impressions, clicks, and conversions. After initializing the SDK, you need to add methods in the following order:

Placement : Page load or after the component mounts

Offer18WebSDK.trackImpression(options)

then

Placement: Can be placed on all pages (on page load or after the component mounts)

Offer18WebSDK.trackClick(options);

then

Placement : Thank you Page/Order Success Page

Offer18WebSDK.trackConversion(options);


Method Overview

initializeConversion('YOUR-CLICK-ID-PARAMETER')

This method is used to initialize the conversion. You need to add this method either on page load or after the component mounts.

Replace YOUR-CLICK-ID-PARAMETER with the parameter key that is used to accept the value from the {tid} token in the offer URL.

trackClick(options)

This method is utilized for tracking clicks.

  • Parameters:

    • options (object): Configuration options.

Parameter
Type
Description

trackingURL

string

Mandatory: Tracking URL which can be extracted from Offer18 dashboard

keymapping

array

An array of Offer18 parameters and Native parameters in the format <OFFER18-PARAMETER>:<YOUR-PARAMETER>. User can replace <OFFER18-PARAMETER> with Offer18 Parameters like aff_sub1, aff_sub2 and <YOUR-PARAMETER> with their parameters in which user is getting values from their network.

Example code

Offer18WebSDK.trackClick({
    trackingURL: 'https://example.o18.click/c?o=0000000&m=0000',
    keymapping: ['a:<YOUR-PARAMETER>']
});

trackImpression(options)

This method is utilized for tracking impressions.

  • Parameters:

    • options (object): Configuration options.

Parameter
Type
Description

impressionURL

string

Mandatory: Tracking URL which can be extracted from Offer18 dashboard

keymapping

array

An array of Offer18 parameters and Native parameters in the format <OFFER18-PARAMETER>:<YOUR-PARAMETER>. User can replace <OFFER18-PARAMETER> with Offer18 Parameters like aff_sub1, aff_sub2 and <YOUR-PARAMETER> with their parameters in which user is getting values from their network.

Example code

Offer18WebSDK.trackImpression({
    impressionURL: 'https://example.o18.click/i?o=0000000&m=0000',
    keymapping: ['a:<YOUR-PARAMETER>']
});

trackConversion(options)

This method is utilized for tracking conversions.

  • Parameters:

    • options (object): Configuration options.

Parameter
Type
Description

domain

string

Mandatory: Postback domain of the user.

accountId

string

Mandatory: Offer18 account id of the user.

offerId

string

Mandatory: Id of the campaign.

coupon

string

Coupon code can be used here.

postbackType

string

It can be either 'iframe' or 'pixel', default value is 'iframe'.

isGlobalPixel

boolean

User can configure global pixel by setting this true, default value is false.

allowMultiConversion

boolean

User can allow MultiConversion by setting this true, default value is false.

conversionData

object

This object contains the parameters which can be used to get values from the network.

conversionData Object

Parameter
Type
Description

event

string

Event Name (Please specify the event)

payout

string

Payout Amount (Please specify the payout amount)

sale

string

Sale Amount (Please specify the sale amount)

currency

string

Currency code

adv_sub1

string

Advertiser sub parameter 1

adv_sub2

string

Advertiser sub parameter 2

adv_sub3

string

Advertiser sub parameter 3

adv_sub4

string

Advertiser sub parameter 4

adv_sub5

string

Advertiser sub parameter 5

Example code

Offer18WebSDK.trackConversion({
        domain: '',
        accountId: '',
        offerId: '',
        coupon:'',
        postbackType: '', // 'iframe' or 'pixel'
        isGlobalPixel: false, // true or false
        allowMultiConversion: false, // true or false
        conversionData: {
            event: '', // Event Name (Please specify the event)
            payout: '', // Payout Amount (Please specify the payout amount)
            sale: '', // Sale Amount (Please specify the sale amount)
            currency: '',
            adv_sub1: '',
            adv_sub2: '',
            adv_sub3: '',
            adv_sub4: '',
            adv_sub5: '',
        }
    });

clearCookies()

This method is utilized for removing all first-party cookies added by this package.

activateDebugMode()

This method is utilized for enabling the logger. Logs of every action performed by this package will be visible in the browser's developer tools console. You need to add this method immediately after initializing the SDK

Node SDK Compatibility with Frontend Frameworks and Libraries

The following frontend frameworks and libraries are compatible with Node SDKs and can use them seamlessly via npm:

Next.js, Nuxt.js, SvelteKit, Gatsby, Remix, RedwoodJS, Blitz.js, Astro, Eleventy (11ty), React Static, Gridsome, VuePress, Quasar Framework, Razzle, Preact CLI, NestLand, Hydrogen, Marko, Inferno, Vite, React, Vue.js, Svelte, Preact, SolidJS, Alpine.js, Lit, Stencil.js, Hyperapp, Riot.js, Mithril.js

Know more about YOUR-CLICK-ID-PARAMETER & options in

Know more about options in

Method Overview
Method Overview
Logonpm: offer18-sdknpm