UCC SDK
Installation
For Browser
<script src="https://unpkg.com/ucc-sdk"></script>
For Node or Webpack
npm install ucc-sdk
yarn add ucc-sdk
const uccSdk = require('ucc-sdk');
import * as uccSdk from 'ucc-sdk';
Usage
Initialize the UCC-SDK
uccSdk.track.initialize({
customerId: "your_customer_id", // Customer ObjectId from MongoDB, Required
projectId: 'your_project_id', // Defaults to App Host if Not Provided
apiKey: 'live_soon_to_be_deprecated', // Optional
pageId: 'your_landing_page_id', // Optional
stage: 'dev' // Defaults to dev but Possible Values are 'dev' or 'prod'
});
Submit Page Event
For Vannilla JS
window.addEventListener('load', () => {
uccSdk.track.pageEvent();
});
For VUE JS (Vue Router)
router.afterEach(() => {
uccSdk.track.pageEvent();
});
Submit Tracking Event
uccSdk.track.submitEvent({
event: 'BUTTON_CLICKED', // event name preferrable in caps and underscore for spaces
data: { code: true, ninja: false, assassin: true }, // event data is free object that accepts any properties
user: { name: 'code assassin' }, // if user is present else defaults to browser fingerprint result
type: 'track', // defaults to track if not supplied. eligible values are: track, engagement, interaction & experience
});
Access All Methods on the Global uccSdk
uccSdk.namespace.any(); // Scroll below for namespace and associated methods
Objects
Typedefs
- AssociatedAccount :
Object
AssociatedAccount Type.
- NewReferralMember :
Object
NewReferralMember Type.
- MemberSummary :
Object
MemberSummary Type.
- PayoutSettings :
Object
PayoutSettings Type.
- SocialMediaProfiles :
Object
SocialMediaProfiles Type.
- ReferralProgramMember :
Object
ReferralProgramMember Type.
- ReferralProgramMemberResult :
Object
ReferralProgramMember Type.
- PayoutSettings :
Object
PayoutSettings Type.
- SocialMediaProfiles :
Object
SocialMediaProfiles Type.
- ReferralProgramMember :
Object
ReferralProgramMember Type.
- ReferralProgramMemberResult :
Object
ReferralProgramMember Type.
- PayoutSettings :
Object
PayoutSettings Type.
- SocialMediaProfiles :
Object
SocialMediaProfiles Type.
- ReferralProgramMember :
Object
ReferralProgramMember Type.
- ReferralProgramMemberResult :
Object
ReferralProgramMember Type.
- ReferralProgram :
Object
ReferralProgram Type.
- ReferralMember :
Object
ReferralMember Type.
- ReferralFriend :
Object
ReferralFriend Type.
- Referral :
Object
Referral Type.
- ReferralDetails :
Object
ReferralDetails Type.
- Initialization :
Object
Initialization Type.
- TrackingEvent :
Object
Tracking Event Type.
- NewStoreCard :
Object
NewStoreCard Type.
- NewStoreCardResult :
Object
NewStoreCard Result Type.
- NewUserProfile :
Object
NewUserProfile Type.
- NewUserProfileResult :
Object
NewUserProfileResult Type.
- NewEngagement :
Object
NewEngagement Type.
- SocialMediaProfiles :
Object
SocialMediaProfiles Type.
- PhoneInfo :
Object
PhoneInfo Type.
- BrowserInfo :
Object
BrowserInfo Type.
- PersonalData :
Object
PersonalData Type.
- UserProfile :
Object
UserProfile Type.
- UserProfileResult :
Object
UserProfileResult Type.
- NewOptIn :
Object
NewOptIn Type.
- NewOptOut :
Object
NewOptOut Type.
rfbm : object
Kind: global namespace
- rfbm :
object
- .associateFriend(referralId, userId) ⇒
Promise.<any>
- .confirmReferral(referralId) ⇒
Promise.<any>
- .createNewReferralMember(newReferralMember) ⇒
Promise.<MemberSummary>
- .findReferralProgramMember(programId, application, userId) ⇒
Promise.<ReferralProgramMember>
- .getMemberByAssociatedAccount(externalSystem, externalUserId, programId) ⇒
Promise.<ReferralProgramMemberResult>
- .getMemberByFriend(userId, programId) ⇒
Promise.<ReferralProgramMemberResult>
- .getMemberByUserId(programId, userId) ⇒
Promise.<ReferralProgramMemberResult>
- .getMemberReferralStatistics(programId, memberId) ⇒
Promise.<any>
- .getReferralDetails(referralId) ⇒
Promise.<ReferralDetails>
- .associateFriend(referralId, userId) ⇒
rfbm.associateFriend(referralId, userId) ⇒ Promise.<any>
Associate Friend.
Kind: static method of rfbm
Returns: Promise.<any>
- Associate Friend Result
Param | Type | Description |
---|---|---|
referralId | string |
Referral Id. |
userId | string |
User Id. |
rfbm.confirmReferral(referralId) ⇒ Promise.<any>
Confirm Referral.
Kind: static method of rfbm
Returns: Promise.<any>
- Confirm Referral Result
Param | Type | Description |
---|---|---|
referralId | string |
Referral Id. |
rfbm.createNewReferralMember(newReferralMember) ⇒ Promise.<MemberSummary>
Create A New Referral Member.
Kind: static method of rfbm
Returns: Promise.<MemberSummary>
- New Referral Result
Param | Type | Description |
---|---|---|
newReferralMember | NewReferralMember |
New Referral Member. |
rfbm.findReferralProgramMember(programId, application, userId) ⇒ Promise.<ReferralProgramMember>
Find Referral Program Member.
Kind: static method of rfbm
Returns: Promise.<ReferralProgramMember>
- Get Referral Program Member Result
Param | Type | Description |
---|---|---|
programId | string |
Referral Program Id. |
application | string |
Application or External System. |
userId | string |
Referral Program User Id. |
rfbm.getMemberByAssociatedAccount(externalSystem, externalUserId, programId) ⇒ Promise.<ReferralProgramMemberResult>
Get Member By Associated Account
Kind: static method of rfbm
Returns: Promise.<ReferralProgramMemberResult>
- Get Member By Associated Account Result
Param | Type | Description |
---|---|---|
externalSystem | string |
External System. |
externalUserId | string |
External User Id. |
programId | string |
Referral Program Id. |
rfbm.getMemberByFriend(userId, programId) ⇒ Promise.<ReferralProgramMemberResult>
Get Member By Friend.
Kind: static method of rfbm
Returns: Promise.<ReferralProgramMemberResult>
- Get Member By Friend Result
Param | Type | Description |
---|---|---|
userId | string |
user objectId. |
programId | string |
Referral Program Id. |
rfbm.getMemberByUserId(programId, userId) ⇒ Promise.<ReferralProgramMemberResult>
Get Member By User Id.
Kind: static method of rfbm
Returns: Promise.<ReferralProgramMemberResult>
- Get Member By User Id Result
Param | Type | Description |
---|---|---|
programId | string |
Referral Program Id. |
userId | string |
auth0 ID. |
rfbm.getMemberReferralStatistics(programId, memberId) ⇒ Promise.<any>
Get Member Referral Statistics
Kind: static method of rfbm
Returns: Promise.<any>
- Get Member Referral Statistics Result
Param | Type | Description |
---|---|---|
programId | string |
Referral Program Id. |
memberId | string |
Referral Program Member Id. |
rfbm.getReferralDetails(referralId) ⇒ Promise.<ReferralDetails>
Get Referral Details
Kind: static method of rfbm
Returns: Promise.<ReferralDetails>
- Get Referral Details Result
Param | Type | Description |
---|---|---|
referralId | string |
Referral Id. |
user : object
Kind: global namespace
- user :
object
- .createStoreCard(newStoreCard) ⇒
Promise.<NewStoreCardResult>
- .create(newUserProfile) ⇒
Promise.<NewUserProfileResult>
- .engagedWith(userId, newEngagement) ⇒
Promise.<any>
- .getUserByAssociatedAccount(externalSystem, externalUserId) ⇒
Promise.<UserProfileResult>
- .optIn(userId, customerId, newOptIn) ⇒
Promise.<any>
- .optOut(userId, customerId, newOptOut) ⇒
Promise.<any>
- .createStoreCard(newStoreCard) ⇒
user.createStoreCard(newStoreCard) ⇒ Promise.<NewStoreCardResult>
Create Store Card.
Kind: static method of user
Returns: Promise.<NewStoreCardResult>
- New Store Card Result
Param | Type | Description |
---|---|---|
newStoreCard | NewStoreCard |
New Store Card |
user.create(newUserProfile) ⇒ Promise.<NewUserProfileResult>
Create A New User Profile.
Kind: static method of user
Returns: Promise.<NewUserProfileResult>
- New User Profile Result
Param | Type | Description |
---|---|---|
newUserProfile | NewUserProfile |
New User Profile. |
user.engagedWith(userId, newEngagement) ⇒ Promise.<any>
Add A New Engagement.
Kind: static method of user
Returns: Promise.<any>
- New Engagement Result
Param | Type | Description |
---|---|---|
userId | string |
User ObjectID |
newEngagement | NewEngagement |
New Engagement. |
user.getUserByAssociatedAccount(externalSystem, externalUserId) ⇒ Promise.<UserProfileResult>
Get User By Associated Account
Kind: static method of user
Returns: Promise.<UserProfileResult>
- Get User By Associated Account Result
Param | Type | Description |
---|---|---|
externalSystem | string |
External System. |
externalUserId | string |
External User Id. |
user.optIn(userId, customerId, newOptIn) ⇒ Promise.<any>
Add A New Opt In.
Kind: static method of user
Returns: Promise.<any>
- New Opt In Result
Param | Type | Description |
---|---|---|
userId | string |
User ObjectID |
customerId | string |
Customer ObjectID |
newOptIn | NewOptIn |
New Opt In. |
user.optOut(userId, customerId, newOptOut) ⇒ Promise.<any>
Add A New Opt In.
Kind: static method of user
Returns: Promise.<any>
- New Opt In Result
Param | Type | Description |
---|---|---|
userId | string |
User ObjectID |
customerId | string |
Customer ObjectID |
newOptOut | NewOptOut |
New Opt In. |
track : object
Kind: global namespace
- track :
object
- .invokeWebhook(webhookUrl, data) ⇒
Promise.<any>
- .pageEvent() ⇒
Promise.<any>
- .initialize(initialization) ⇒
boolean
- .submitEvent(trackingEvent) ⇒
Promise.<any>
- .invokeWebhook(webhookUrl, data) ⇒
track.invokeWebhook(webhookUrl, data) ⇒ Promise.<any>
Invoke Webhook
Kind: static method of track
Returns: Promise.<any>
- Web Tracking Response
Param | Type | Description |
---|---|---|
webhookUrl | string |
webhookUrl |
data | object |
data |
track.pageEvent() ⇒ Promise.<any>
Send UCC Web Page Event.
Kind: static method of track
Returns: Promise.<any>
- Web Tracking Response
track.initialize(initialization) ⇒ boolean
Initialize UCC Web Tracking.
Kind: static method of track
Returns: boolean
- Web Tracking Init Response
Param | Type | Description |
---|---|---|
initialization | Initialization |
initialization. |
track.submitEvent(trackingEvent) ⇒ Promise.<any>
Send UCC Web Tracking Event.
Kind: static method of track
Returns: Promise.<any>
- Web Tracking Response
Param | Type | Description |
---|---|---|
trackingEvent | TrackingEvent |
trackingEvent. |
payments : object
Kind: global namespace
- payments :
object
- .cancelDeposit(customerId, depositId) ⇒
Promise.<any>
- .createDeposit(customerId, chainName, userId, currency, amount, tokenSymbol, events) ⇒
Promise.<any>
- .getDeposit(customerId, depositId) ⇒
Promise.<any>
- .getHotWallets(customerId, usage) ⇒
Promise.<any>
- .updateDeposit(customerId, depositId, txHash) ⇒
Promise.<any>
- .cancelDeposit(customerId, depositId) ⇒
payments.cancelDeposit(customerId, depositId) ⇒ Promise.<any>
Cancel Crypto Deposit
Kind: static method of payments
Returns: Promise.<any>
- Cancel Crypto Deposit Response
Param | Type | Description |
---|---|---|
customerId | string |
customerId |
depositId | string |
depositId |
payments.createDeposit(customerId, chainName, userId, currency, amount, tokenSymbol, events) ⇒ Promise.<any>
Create Crypto Deposit
Kind: static method of payments
Returns: Promise.<any>
- Create Crypto Deposit Response
Param | Type | Description |
---|---|---|
customerId | string |
customerId |
chainName | string |
chainName |
userId | string |
userId |
currency | string |
currency |
amount | string |
amount |
tokenSymbol | string |
tokenSymbol |
events | Array.<Object> |
events |
payments.getDeposit(customerId, depositId) ⇒ Promise.<any>
Get Crypto Deposit
Kind: static method of payments
Returns: Promise.<any>
- Get Crypto Deposit Response
Param | Type | Description |
---|---|---|
customerId | string |
customerId |
depositId | string |
depositId |
payments.getHotWallets(customerId, usage) ⇒ Promise.<any>
Get Customer Hot Wallets
Kind: static method of payments
Returns: Promise.<any>
- Get Customer Hot Wallets Response
Param | Type | Default | Description |
---|---|---|---|
customerId | string |
| customerId | |
usage | string |
"ANY" |
usage |
payments.updateDeposit(customerId, depositId, txHash) ⇒ Promise.<any>
Update Crypto Deposit
Kind: static method of payments
Returns: Promise.<any>
- Update Crypto Deposit Response
Param | Type | Description |
---|---|---|
customerId | string |
customerId |
depositId | string |
depositId |
txHash | string |
txHash |
AssociatedAccount : Object
AssociatedAccount Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
application | string |
ucc application or external system. |
userId | string |
ucc application or external system userId. |
NewReferralMember : Object
NewReferralMember Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
firstName | string |
firstName. |
lastName | string |
lastName. |
string |
email. | |
phone | string |
phone. |
country | string |
country. |
password | string |
password. |
associatedAccount | AssociatedAccount |
associatedAccount. |
referralCode | string |
referralCode. |
referralProgramId | string |
referralProgramId. |
MemberSummary : Object
MemberSummary Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
userProfileId | string |
userProfileId. |
auth0Id | string |
auth0Id. |
memberId | string |
memberId. |
referralLink | string |
referralLink. |
PayoutSettings : Object
PayoutSettings Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
blockchain | string |
blockchain. |
address | string |
address. |
SocialMediaProfiles : Object
SocialMediaProfiles Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
username | string |
username. |
provider | string |
provider. |
ReferralProgramMember : Object
ReferralProgramMember Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
firstName | string |
firstName. |
lastName | string |
lastName. |
phone | string |
phone. |
country | string |
country. |
payoutSettings | Array.<PayoutSettings> |
payoutSettings. |
socialMediaProfiles | Array.<SocialMediaProfiles> |
socialMediaProfiles. |
string |
email. |
ReferralProgramMemberResult : Object
ReferralProgramMember Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
result | ReferralProgramMember |
referral member. |
PayoutSettings : Object
PayoutSettings Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
blockchain | string |
blockchain. |
address | string |
address. |
SocialMediaProfiles : Object
SocialMediaProfiles Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
username | string |
username. |
provider | string |
provider. |
ReferralProgramMember : Object
ReferralProgramMember Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
firstName | string |
firstName. |
lastName | string |
lastName. |
phone | string |
phone. |
country | string |
country. |
payoutSettings | Array.<PayoutSettings> |
payoutSettings. |
socialMediaProfiles | Array.<SocialMediaProfiles> |
socialMediaProfiles. |
string |
email. |
ReferralProgramMemberResult : Object
ReferralProgramMember Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
result | ReferralProgramMember |
referral member. |
PayoutSettings : Object
PayoutSettings Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
blockchain | string |
blockchain. |
address | string |
address. |
SocialMediaProfiles : Object
SocialMediaProfiles Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
username | string |
username. |
provider | string |
provider. |
ReferralProgramMember : Object
ReferralProgramMember Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
firstName | string |
firstName. |
lastName | string |
lastName. |
phone | string |
phone. |
country | string |
country. |
payoutSettings | Array.<PayoutSettings> |
payoutSettings. |
socialMediaProfiles | Array.<SocialMediaProfiles> |
socialMediaProfiles. |
string |
email. |
ReferralProgramMemberResult : Object
ReferralProgramMember Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
result | ReferralProgramMember |
referral member. |
ReferralProgram : Object
ReferralProgram Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
title | string |
referral program title |
description | string |
referral program description |
ReferralMember : Object
ReferralMember Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
firstName | string |
referral member firstName |
lastName | string |
referral member lastName |
ReferralFriend : Object
ReferralFriend Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
firstName | string |
referred friend firstName |
lastName | string |
referred friend lastName |
Referral : Object
Referral Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
program | ReferralProgram |
referral program |
member | ReferralMember |
referral member |
friend- | ReferralFriend |
referred friend |
ReferralDetails : Object
ReferralDetails Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
message | string |
message |
result | Referral |
result |
Initialization : Object
Initialization Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
customerId | string |
UCC Customer ID. |
projectId | string |
UCC Project/Source ID. |
apiKey | string |
UCC Customer Api Key. |
pageId | string |
UCC Landing Page Object Id. |
stage | string |
UCC Stage. |
TrackingEvent : Object
Tracking Event Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
customerId | string |
UCC Customer ID. |
projectId | string |
UCC Project/Source ID. |
event | string |
Event Name - Find out from Project Manager. |
data | object |
Event Data - Find out from Project Manager. |
user | object |
User Data If Applicable. |
type | string |
Event Type If Applicable. Defaults to track |
NewStoreCard : Object
NewStoreCard Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
walletProvider | string |
walletProvider. |
templateId | string |
templateId. |
customerId | string |
customerId. |
userId | string |
userId. |
NewStoreCardResult : Object
NewStoreCard Result Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
passTypeIdentifier | string |
passTypeIdentifier. |
serialNumber | string |
serialNumber. |
description | string |
description. |
NewUserProfile : Object
NewUserProfile Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
firstName | string |
firstName. |
lastName | string |
lastName. |
string |
email. | |
phone | string |
phone. |
country | string |
country. |
password | string |
password. |
associatedAccount | AssociatedAccount |
associatedAccount. |
NewUserProfileResult : Object
NewUserProfileResult Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
userProfileId | string |
userProfileId. |
auth0Id | string |
auth0Id. |
NewEngagement : Object
NewEngagement Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
customerId | string |
customerId. |
firstTimeOn | string |
firstTimeOn. |
SocialMediaProfiles : Object
SocialMediaProfiles Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
username | string |
username. |
provider | string |
provider. |
PhoneInfo : Object
PhoneInfo Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
_id | string |
_id |
brand | string |
brand |
deviceId | string |
deviceId |
deviceLocale | string |
deviceLocale |
timeZone | string |
timeZone |
timeStamp | string |
timeStamp |
isTablet | boolean |
isTablet |
BrowserInfo : Object
BrowserInfo Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
_id | string |
_id |
timeStamp | string |
timeStamp |
userAgent | string |
userAgent |
PersonalData : Object
PersonalData Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
firstName | string |
firstName |
lastName | string |
lastName |
gender | string |
gender |
yearOfBirth | string |
yearOfBirth |
countryOfResidence | string |
countryOfResidence |
nationality | string |
nationality |
socialMedia | Array.<SocialMediaProfiles> |
socialMedia |
UserProfile : Object
UserProfile Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
_id | string |
_id |
blockchainAddress | string |
blockchainAddress |
personalData | PersonalData |
personalData |
phoneInfo | Array.<PhoneInfo> |
phoneInfo |
browserInfo | Array.<BrowserInfo> |
browserInfo |
UserProfileResult : Object
UserProfileResult Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
count | number |
count |
result | Array.<UserProfile> |
result |
NewOptIn : Object
NewOptIn Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
productOrService | string |
productOrService. |
optedInOn | string |
optedInOn. |
optedInIpAddress | string |
optedInIpAddress. |
optedInUserAgent | string |
optedInUserAgent. |
optedInFormUrl | string |
optedInFormUrl. |
NewOptOut : Object
NewOptOut Type.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
productOrService | string |
productOrService. |
optedOutOn | string |
optedOutOn. |
optedOutIpAddress | string |
optedOutIpAddress. |