@@ -10,7 +10,7 @@ const usabilla = new Usabilla(args[0], args[1]);
1010// Get all buttons for this account. 
1111usabilla . websites . buttons . get ( ) . then ( ( buttons )  =>  { 
1212
13-   const  button  =  buttons [ 1 ] ; 
13+   const  button  =  buttons [ 0 ] ; 
1414
1515  if  ( ! button )  { 
1616    return ; 
@@ -25,6 +25,8 @@ usabilla.websites.buttons.get().then((buttons) => {
2525  } ; 
2626  usabilla . websites . buttons . feedback . get ( buttonFeedbackQuery ) . then ( ( feedback )  =>  { 
2727    console . log ( '# button feedback' ,  feedback . length ) ; 
28+   } ) . catch ( ( reason )  =>  { 
29+     console . error ( reason ) ; 
2830  } ) ; 
2931
3032} ) . catch ( ( reason )  =>  { 
@@ -49,12 +51,16 @@ usabilla.websites.campaigns.get().then((campaigns) => {
4951
5052  // Get the responses of the first campaign 
5153  usabilla . websites . campaigns . results . get ( campaignQuery ) . then ( ( responses )  =>  { 
52-     console . log ( '# campaign responses' ,  responses . length ) ; 
54+     console . log ( '# web campaign responses' ,  responses . length ) ; 
55+   } ) . catch ( ( reason )  =>  { 
56+     console . error ( reason ) ; 
5357  } ) ; 
5458
5559  // Get the stats of the first campaign 
5660  usabilla . websites . campaigns . stats . get ( campaignQuery ) . then ( ( stats )  =>  { 
57-     console . log ( 'campaign stats' ,  stats ) ; 
61+     console . log ( 'web campaign stats' ,  stats ) ; 
62+   } ) . catch ( ( reason )  =>  { 
63+     console . error ( reason ) ; 
5864  } ) ; 
5965} ) . catch ( ( reason )  =>  { 
6066  // If the usabilla call fails, we want to see the error message 
@@ -72,6 +78,8 @@ usabilla.websites.inpage.get().then((inPageWidgets) => {
7278  // Get the feedback of the first inpage widget 
7379  usabilla . websites . inpage . feedback . get ( inPageQuery ) . then ( ( feedback )  =>  { 
7480    console . log ( '# inpage feedback' ,  feedback . length ) ; 
81+   } ) . catch ( ( reason )  =>  { 
82+     console . error ( reason ) ; 
7583  } ) ; 
7684} ) . catch ( ( reason )  =>  { 
7785  // If the usabilla call fails, we want to see the error message 
@@ -98,7 +106,7 @@ usabilla.email.widgets.get().then((emailWidgets) => {
98106// Get all apps forms for this account. 
99107usabilla . apps . forms . get ( ) . then ( ( appsForms )  =>  { 
100108
101-   const  appsForm  =  appsForms [ 1 ] ; 
109+   const  appsForm  =  appsForms [ 0 ] ; 
102110
103111  if  ( ! appsForm )  { 
104112    return ; 
@@ -117,3 +125,28 @@ usabilla.apps.forms.get().then((appsForms) => {
117125  // If the usabilla call fails, we want to see the error message 
118126  console . error ( reason ) ; 
119127} ) ; 
128+ 
129+ // Get all apps campaigns for this account. 
130+ usabilla . apps . campaigns . get ( ) . then ( ( appsCampaigns )  =>  { 
131+   
132+   // Use the first campaign found 
133+   const  appsCampaign  =  appsCampaigns [ 0 ] ; 
134+   if  ( ! appsCampaign )  { 
135+     return ; 
136+   } 
137+ 
138+   // Get the feedback for a apps form with id. 
139+   let  appsCampaignQuery  =  { 
140+     id : appsCampaign . id 
141+   } ; 
142+ 
143+   // Get the feedback of the second app form 
144+   usabilla . apps . campaigns . results . get ( appsCampaignQuery ) . then ( ( responses )  =>  { 
145+     console . log ( '# apps campaign responses' ,  responses . length ) ; 
146+   } ) . catch ( ( reason )  =>  { 
147+     console . error ( reason ) ; 
148+   } ) ; 
149+ 
150+ } ) . catch ( ( reason )  =>  { 
151+   console . error ( reason ) ; 
152+ } ) ; 
0 commit comments