/Documentation

Stape Node.js SDK

Updated Jan 28, 2026

Overview of Stape Node.js SDK

How to set up Stape Node.js SDK

Configuration

import StapeSGTM, { transformations, EventData } from 'stape-sgtm-nodejs'; const sgtm = new StapeSGTM({ gtm_server_domain: 'https://gtm.stape.io', request_path: '/data', });
VariableDescription

Sending Event Data

sgtm.sendEventData(<eventName>, <eventData>);
VariableDescription
const eventData = [{ page_hostname: 'Stape', page_location: 'http://stape.io', }]
OptionDescription

Transformations

OptionDescription

Full Example

import StapeSGTM, { transformations, EventData } from 'stape-sgtm-nodejs'; const sgtm = new StapeSGTM({ gtm_server_domain: 'https://gtm.stape.io', request_path: '/data', preview_header: 'ZW52LTV8VTc5TlhtZkx3SHpIU004bEpyQWtRZ3wxOTRlMjZlOGJjZTViNTQ2OWI3NzM=', }); const eventData: EventData = { client_id: '123456', currency: 'USD', ip_override: '79.144.123.69', language: 'en', page_encoding: 'UTF-8', page_hostname: 'Stape', page_location: 'http://stape.io', page_path: '/', user_data: { sha256_email_address: transformations.sha256hex('jhonn@doe.com'), phone_number: '123456769', address: { first_name: 'Jhon', }, }, }; sgtm .sendEventData('page_view', eventData) .then((result) => console.log('šŸš€ ~ file: simple.ts:19 ~ result:', result)) .catch((error) => console.log('šŸš€ ~ file: simple.ts:21 ~ error:', error));

Stape Data Client in server GTM

How to add Stape Node.js SDK to your project

npm install stape-sgtm-nodejs
import StapeSGTM, { transformations, EventData } from 'stape-sgtm-nodejs'; const sgtm = new StapeSGTM({ Ā Ā gtm_server_domain: 'https://gtm.example.com', Ā Ā request_path: '/data', }); const eventData = { Ā Ā value: 68, Ā Ā currency: 'USD', Ā Ā page_hostname: 'stape.io', Ā Ā page_location: 'http://stape.io', Ā Ā user_data: { Ā Ā Ā Ā email: transformations.sha256hex('jhonn@doe.com'), Ā Ā }, }; sgtm.sendEventData('add_to_cart', eventData) Ā Ā .then((result) => console.log('āœ… Event Sent:', result)) Ā Ā .catch((error) => console.log('āŒ Error:', error));

How to test the setup

The most common problem when using the SDK is getting a 400 error

Was this article helpful?

Comments

Can’t find what you are looking for?