Example
1 min
below is an example code private readonly appid = '{add app id here from dashboard}'; private readonly accountid = '{add account id here from dashboard}''; private readonly screenname = '{add app screen name}'; private readonly userid = '{to be provided by the app in string format}'; private readonly attributes = \[{ key 'value', }]; error$ = new behaviorsubject\<string | null>(null); campaigndata$ = new behaviorsubject\<campaigndata | null>(null); constructor( private appstorysservice appstorysservice ) {} ngoninit() { this initializecampaigns(); } private async initializecampaigns() promise\<void> { try { const { accesstoken, userdata } = await this appstorysservice initialize(this appid, this accountid, this userid, this screenname, this attributes); this campaigndata$ next({ campaigns userdata campaigns, access token accesstoken!, user id this userid }); } catch (error) { console error('error initializing campaigns ', error); this error$ next('failed to initialize campaigns'); } }