Skip to content

Commit c391a0a

Browse files
authored
Update README.md
1 parent b81bec6 commit c391a0a

File tree

1 file changed

+87
-1
lines changed

1 file changed

+87
-1
lines changed

README.md

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,95 @@
11
# analytix
22

3-
A Flutter library for custom analytics manager
3+
A Flutter library for custom analytics management, designed to streamline integration and usage for efficient event tracking and reporting in Dart applications.
4+
5+
## Features
6+
7+
- **Custom Event Tracking**: Easily log and manage events in your application.
8+
- **Screen View Logging**: Track screen views to gain insights into user navigation.
9+
- **Robust Reporting**: Access detailed reports on user interactions and events.
410

511
## Getting Started
612

13+
### Installation
14+
15+
To use the Analytix library, add the following dependency to your `pubspec.yaml` file:
16+
17+
```yaml
18+
dependencies:
19+
analytix: ^1.0.0 # Replace with the latest version
20+
```
21+
22+
### Importing the Library
23+
Import the library in your Dart files:
24+
25+
```dart
26+
import 'package:analitix/analitix.dart';
27+
```
28+
29+
### Basic Usage
30+
Here’s a quick example of how to integrate Analytix into your Flutter application:
31+
32+
```dart
33+
import 'package:flutter/material.dart';
34+
import 'package:analitix/analitix/abstract/analytix_manager.dart';
35+
36+
void main() {
37+
runApp(MyApp());
38+
}
39+
40+
class MyApp extends StatelessWidget {
41+
@override
42+
Widget build(BuildContext context) {
43+
return MaterialApp(
44+
home: SimpleEventExampleScreen(),
45+
);
46+
}
47+
}
48+
49+
class SimpleEventExampleScreen extends StatefulWidget {
50+
@override
51+
State<SimpleEventExampleScreen> createState() => _SimpleEventExampleScreenState();
52+
}
53+
54+
class _SimpleEventExampleScreenState extends State<SimpleEventExampleScreen> {
55+
int _counter = 0;
56+
57+
@override
58+
void initState() {
59+
super.initState();
60+
AnalytixManager().logScreenView("simple_event_example_screen.dart");
61+
}
62+
63+
@override
64+
Widget build(BuildContext context) {
65+
return Scaffold(
66+
appBar: AppBar(
67+
title: const Text("Analytix Demo"),
68+
),
69+
body: Center(
70+
child: Column(
71+
mainAxisAlignment: MainAxisAlignment.center,
72+
children: <Widget>[
73+
Text('Button pressed: $_counter times'),
74+
ElevatedButton(
75+
onPressed: _incrementCounter,
76+
child: const Text('Press Me'),
77+
),
78+
],
79+
),
80+
),
81+
);
82+
}
83+
84+
void _incrementCounter() {
85+
setState(() {
86+
_counter++;
87+
});
88+
AnalytixManager().logEvent('button_press', 'User pressed the button', params: {'counter': _counter});
89+
}
90+
}
91+
```
92+
793
For help getting started with Flutter development, view the online
894
[documentation](https://flutter.dev/).
995

0 commit comments

Comments
 (0)