Skip to content

Commit 21d3b4f

Browse files
author
Elena Hristova
committed
update event logs in demos
1 parent a1f02db commit 21d3b4f

File tree

10 files changed

+36
-28
lines changed

10 files changed

+36
-28
lines changed

demo-angular/app/pages/home/home.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
<Button text="Get current access token" (tap)="getCurrentAccessToken()"></Button>
1313
</StackLayout>
1414
<StackLayout class="buttons">
15-
<Button text="log event" (tap)="logEvent()"></Button>
15+
<Button text="Log event" (tap)="logEvent()"></Button>
1616
</StackLayout>
1717
</StackLayout>

demo-angular/app/pages/home/home.component.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export class HomeComponent {
1616
userId: string;
1717
username: string;
1818
avatarUrl: string;
19+
eventCounter: number = 0;
1920

2021
constructor(private ref: ChangeDetectorRef, private navigationService: NavigationService) {
2122
// Get logged in user's info
@@ -34,8 +35,6 @@ export class HomeComponent {
3435
}, function (err) {
3536
alert("Error getting user info: " + err);
3637
});
37-
38-
Facebook.initAnalytics();
3938
}
4039

4140
onLogout(eventData: Facebook.LoginEventData) {
@@ -56,9 +55,10 @@ export class HomeComponent {
5655
}
5756

5857
logEvent() {
59-
Facebook.logEvent('Initial', [{
60-
key: 'number',
61-
value: '',
58+
this.eventCounter++;
59+
Facebook.logEvent('Home', [{
60+
key: 'counter',
61+
value: this.eventCounter.toString()
6262
}]);
6363
}
6464

demo-angular/app/pages/login/login.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
*ngIf = "canShowLinksMessageDialog"></Button>
1414
<Button (tap) = "onSendGenericDialog()" text = "Share Message Generic Template"
1515
*ngIf = "canShowGenericMessageDialog"></Button>
16-
<Button text="log event" (tap)="logEvent()"></Button>
16+
<Button (tap) = "logEvent()" text="Log event"></Button>
1717
</StackLayout>

demo-angular/app/pages/login/login.component.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export class LoginComponent {
1818
canShowPhotosShareDialog = false;
1919
canShowLinksMessageDialog = false;
2020
canShowGenericMessageDialog = false;
21+
eventCounter = 0;
2122

2223
constructor(private ref: ChangeDetectorRef, private navigationService: NavigationService) {
2324
// have to init after facebook sdk inited
@@ -34,7 +35,6 @@ export class LoginComponent {
3435
this.canShowPhotosShareDialog = Facebook.canShareDialogShow(this.photosContent);
3536
this.canShowLinksMessageDialog = Facebook.canMessageDialogShow(this.linkContent);
3637
this.canShowGenericMessageDialog = Facebook.canMessageDialogShow(this.genericContent);
37-
Facebook.initAnalytics();
3838
}
3939

4040
onLogin(eventData: Facebook.LoginEventData) {
@@ -122,9 +122,10 @@ export class LoginComponent {
122122
}
123123

124124
logEvent() {
125-
Facebook.logEvent('Initial', [{
126-
key: 'number',
127-
value: '',
125+
this.eventCounter++;
126+
Facebook.logEvent('Login', [{
127+
key: 'counter',
128+
value: this.eventCounter.toString()
128129
}]);
129130
}
130131
}

demo-vue/app/components/Home.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
return {
4949
userId: null,
5050
accessToken: appSettings.getString("access_token"),
51-
avatarUrl: null
51+
avatarUrl: null,
52+
eventCounter: 0
5253
}
5354
},
5455
methods: {
@@ -67,9 +68,10 @@
6768
alert("Current access token: " + JSON.stringify(accessToken, null, '\t'));
6869
},
6970
logEventAction() {
70-
logEvent('Initial', [{
71-
key: 'number',
72-
value: '',
71+
this.counter++;
72+
logEvent('Home', [{
73+
key: 'counter',
74+
value: this.eventCounter.toString()
7375
}]);
7476
}
7577
}

demo-vue/app/components/Login.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
canShowLinksShareDialog: false,
5656
canShowPhotosShareDialog: false,
5757
canShowLinksMessageDialog: false,
58-
canShowGenericMessageDialog: false
58+
canShowGenericMessageDialog: false,
59+
eventCounter: 0
5960
}
6061
},
6162
methods: {
@@ -143,9 +144,10 @@
143144
showMessageDialog(this.genericContent);
144145
},
145146
logEventAction() {
146-
logEvent('Initial', [{
147-
key: 'number',
148-
value: '',
147+
this.eventCounter++;
148+
logEvent('Login', [{
149+
key: 'counter',
150+
value: this.eventCounter.toString()
149151
}]);
150152
}
151153
}

demo/app/home-view-model.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ let config = require("./app.config").config;
1010
export class HomeViewModel extends Observable {
1111
userId: string;
1212
accessToken: string = appSettings.getString("access_token");
13+
eventCounter: 0;
1314

1415
constructor() {
1516
super();
@@ -58,9 +59,10 @@ export class HomeViewModel extends Observable {
5859
}
5960

6061
public logEventAction() {
61-
logEvent('Initial', [{
62-
key: 'number',
63-
value: '',
62+
this.eventCounter++;
63+
logEvent('Home', [{
64+
key: 'counter',
65+
value: this.eventCounter.toString()
6466
}]);
6567
}
6668
}

demo/app/login-view-model.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export class LoginViewModel extends Observable {
2626
public canShowPhotosShareDialog = canShareDialogShow(this.photosContent);
2727
public canShowLinksMessageDialog = canMessageDialogShow(this.linkContent);
2828
public canShowGenericMessageDialog = canMessageDialogShow(this.genericContent);
29+
public eventCounter = 0;
2930

3031

3132
private _navigate(path: string) {
@@ -121,9 +122,10 @@ export class LoginViewModel extends Observable {
121122
}
122123

123124
public logEventAction() {
124-
logEvent('Initial', [{
125-
key: 'number',
126-
value: '',
125+
this.eventCounter++;
126+
logEvent('Login', [{
127+
key: 'counter',
128+
value: this.eventCounter,
127129
}]);
128130
}
129131
}

src/app-events.android.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export function initAnalytics() {
88

99
export function logEvent(name: string, parameters?: any) {
1010
if (name === undefined) {
11-
throw ("Argument 'key' is missing");
11+
throw ("Argument 'name' is missing");
1212
}
1313

1414
const bundle = new android.os.Bundle();

src/app-events.ios.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export function initAnalytics() {
88

99
export function logEvent(name: string, parameters?: any) {
1010
if (name === undefined) {
11-
throw ("Argument 'key' is missing");
11+
throw ("Argument 'name' is missing");
1212
}
1313

1414
if (parameters === undefined) {
@@ -17,7 +17,6 @@ export function logEvent(name: string, parameters?: any) {
1717
const parametersDictionary = new (NSDictionary as any)(
1818
parameters.map(parameter => parameter.value),
1919
parameters.map(parameter => parameter.key));
20-
console.log(parametersDictionary);
2120

2221
FBSDKAppEvents.logEventParameters(name, parametersDictionary);
2322
}

0 commit comments

Comments
 (0)