Skip to content

Commit

Permalink
Add mixpanel tracker (#37)
Browse files Browse the repository at this point in the history
* fix: change secrets env target path

* feat(service): initializing mixpanel service

* feat(service): add mixpanels

---------

Co-authored-by: Veloraine <bivanderr@gmail.com>
Co-authored-by: Yudha Haris Purnama <yudha@clade.ventures>
Co-authored-by: Yudha Haris Purnama <70850815+yudha-haris@users.noreply.github.com>
  • Loading branch information
4 people authored Dec 9, 2023
1 parent 16877a8 commit 3bc5849
Show file tree
Hide file tree
Showing 29 changed files with 71 additions and 36 deletions.
2 changes: 0 additions & 2 deletions .env.example

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "interactive"
}
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if (localPropertiesFile.exists()) {

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
throw GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
Expand Down
2 changes: 1 addition & 1 deletion lib/app_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ A new version of this app available on the store, please update into the newer v
Text(
'by RISTEK Fasilkom UI',
style: FontTheme.poppins14w500white(),
)
),
],
),
),
Expand Down
1 change: 1 addition & 0 deletions lib/features/home/presentation/pages/_pages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import 'package:ulaskelas/features/home/presentation/widgets/_widgets.dart';
import 'package:ulaskelas/features/matkul/form/domain/entities/query_review.dart';
import 'package:ulaskelas/features/matkul/search/presentation/widgets/_widgets.dart';
import 'package:ulaskelas/features/matkul/search/presentation/widgets/skeleton_card_course.dart';
import 'package:ulaskelas/services/_services.dart';

part 'home_daftar_matkul_page.dart';
part 'home_daftar_ulasan_page.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class _HomeDaftarUlasanPageState extends BaseStateful<HomeDaftarUlasanPage> {
review.course!,
review.courseCode!,
);
MixpanelService.track('view_my_review');
},
);
},
Expand Down
24 changes: 16 additions & 8 deletions lib/features/home/presentation/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class _HomePageState extends BaseStateful<HomePage> {
Text(
'Lihat Semua Mata Kuliah',
style: FontTheme.poppins14w400purple(),
)
),
],
),
Icon(
Expand Down Expand Up @@ -141,7 +141,7 @@ class _HomePageState extends BaseStateful<HomePage> {
'Lihat Semua',
style: FontTheme.poppins13w400purple(),
),
)
),
],
),
),
Expand Down Expand Up @@ -219,12 +219,16 @@ class _HomePageState extends BaseStateful<HomePage> {
style: FontTheme.poppins14w700black(),
),
InkWell(
onTap: () => nav.goToHomeDaftarUlasan(),
onTap: () {
nav.goToHomeDaftarUlasan();

MixpanelService.track('view_all_reviews');
},
child: Text(
'Lihat Semua',
style: FontTheme.poppins13w400purple(),
),
)
),
],
),
),
Expand Down Expand Up @@ -260,10 +264,14 @@ class _HomePageState extends BaseStateful<HomePage> {
final review = data.summaries[i];
return CardMatkulReview(
review: review,
onTap: () => nav.goToDetailMatkulPage(
review.course!,
review.courseCode.toString(),
),
onTap: () {
nav.goToDetailMatkulPage(
review.course!,
review.courseCode.toString(),
);

MixpanelService.track('view_my_review');
},
);
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ class CardMatkulReview extends StatelessWidget {
: (review.hateSpeechStatus == 'WAITING')
? TagStatus.pending
: TagStatus.rejected,
)
),
],
)
),
],
)
),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class _EditComponentPageState extends BaseStateful<EditComponentPage> {
await onSubmitCallBack(context);
},
),
)
),
],
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class CardCompononent extends StatelessWidget {
style: FontTheme.poppins12w400black(),
textAlign: TextAlign.right,
),
)
),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SimpanButton extends StatelessWidget {
color: Color.fromRGBO(0, 0, 0, 0.05),
blurRadius: 4,
offset: Offset(0, -2),
)
),
],
),
child: AutoLayoutButton(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class TagLeaderboard extends StatelessWidget {
return [
BaseColors.purpleHearth,
BaseColors.purpleHearth,
BaseColors.white
BaseColors.white,
];
}else if(rank == 1){
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class SkeletonCardLeaderboard extends StatelessWidget {
),
),
),
)
),
],
),
title: Container(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class _AllReviewMatkulPageState extends BaseStateful<AllReviewMatkulPage> {
size: 28,
),
),
)
),
],
);
},
Expand All @@ -149,7 +149,7 @@ class _AllReviewMatkulPageState extends BaseStateful<AllReviewMatkulPage> {
color: Color.fromRGBO(0, 0, 0, 0.05),
blurRadius: 4,
offset: Offset(0, -2),
)
),
],
),
child: TulisUlasanButton(
Expand All @@ -161,7 +161,7 @@ class _AllReviewMatkulPageState extends BaseStateful<AllReviewMatkulPage> {
}
},
),
)
),
],
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class _DetailMatkulPageState extends BaseStateful<DetailMatkulPage> {
'${course.reviewCount} Ulasan',
style: FontTheme.poppins12w400black(),
),
)
),
],
),
const WidthSpace(32),
Expand Down Expand Up @@ -349,7 +349,7 @@ class _DetailMatkulPageState extends BaseStateful<DetailMatkulPage> {
);
}
},
)
),
],
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class _ReviewMatkulPageState extends BaseStateful<ReviewMatkulPage> {
children: [
TulisUlasanButton(
onTap: () {},
)
),
],
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ class ReviewCard extends StatelessWidget {
// color: likesCountColor,
),
),
)
),
],
)
),
],
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Pilih maksimal 3 kategori yang menurutmu dapat\nmerepresentasikan mata kuliah in
},
),
),
)
),
],
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class _SuccessFormPageState extends BaseStateful<SuccessFormPage> {
onPressed: () {
nav.pop();
},
)
),
],
),
),
Expand Down
1 change: 1 addition & 0 deletions lib/features/matkul/search/presentation/pages/_pages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:ulaskelas/core/theme/_theme.dart';
import 'package:ulaskelas/features/matkul/main/domain/entities/query_search_course.dart';
import 'package:ulaskelas/features/matkul/search/presentation/states/_states.dart';
import 'package:ulaskelas/features/matkul/search/presentation/widgets/_widgets.dart';
import 'package:ulaskelas/services/_services.dart';

part 'filter_page.dart';
part 'search_course_page.dart';
11 changes: 10 additions & 1 deletion lib/features/matkul/search/presentation/pages/filter_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,19 @@ class _FilterPageState extends BaseStateful<FilterPage> {
text: 'Terapkan Filter',
onTap: () {
nav.pop<bool>(true);
MixpanelService.track(
'apply_course_filter',
params: {
'jenis_matkul': filterRM.state.selectedType.toString(),
'jumlah_sks': filterRM.state.selectedSks.toString(),
'semester_wajib_ambil':
filterRM.state.selectedSemester.toString(),
},
);
},
),
),
)
),
],
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ class _SearchCoursePageState
},
onFieldSubmitted: (val) {
searchCourseRM.state.addToHistory(val);
MixpanelService.track(
'search_course',
params: {
'query': val,
},
);
},
onChange: onQueryChanged,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:ulaskelas/core/theme/_theme.dart';
import 'package:ulaskelas/features/matkul/search/data/models/_models.dart';
import 'package:ulaskelas/features/matkul/search/presentation/states/_states.dart';
import 'package:ulaskelas/features/matkul/search/presentation/widgets/skeleton_card_course.dart';
import 'package:ulaskelas/services/_services.dart';

part 'base_app_bar.dart';
part 'card_course.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ class SearchListView extends StatelessWidget {
text: 'Filter',
onPressed: () async {
await nav.goToFilterPage();

if (filterRM.state.hasFilter) {
await refreshIndicatorKey.currentState?.show();
}

MixpanelService.track('open_course_filter');
},
);
},
Expand Down
2 changes: 2 additions & 0 deletions lib/features/profile/presentation/pages/profile_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:ulaskelas/core/bases/states/_states.dart';
import 'package:ulaskelas/core/theme/_theme.dart';
import 'package:ulaskelas/features/matkul/search/presentation/widgets/_widgets.dart';
import 'package:ulaskelas/features/profile/presentation/widgets/profile_data.dart';
import 'package:ulaskelas/services/_services.dart';

class ProfilePage extends StatefulWidget {
const ProfilePage({
Expand Down Expand Up @@ -94,6 +95,7 @@ class _ProfilePageState extends BaseStateful<ProfilePage> {
child: InkWell(
onTap: () {
nav.goToHomeDaftarUlasan();
MixpanelService.track('view_all_reviews');
},
child: Text(
'Riwayat Ulasan',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ProfileData extends StatelessWidget {
data,
style: FontTheme.poppins12w400black(),
),
)
),
],
),
);
Expand Down
2 changes: 1 addition & 1 deletion lib/features/sso/presentation/pages/sso_web_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class _SSOWebPageState extends BaseStateful<SSOWebPage> {
}
return const SizedBox.shrink();
},
)
),
],
);
}
Expand Down
6 changes: 4 additions & 2 deletions lib/services/mixpanel_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ class MixpanelService {

static void track(String eventName, {Map<String, String>? params}) {
_mixpanel!.track(eventName, properties: params);
Logger().i('''
Logger().i(
'''
Track Events: $eventName,
Parameters: $params
''');
'''
);
}
}
2 changes: 1 addition & 1 deletion lib/services/pref_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Pref {
final token = getString(PreferencesKeys.ulasKelasCred);
return <String, String>{
'Authorization': 'Token $token',
'Content-Type': 'application/json'
'Content-Type': 'application/json',
};
}
}

0 comments on commit 3bc5849

Please sign in to comment.