Pre-Requisites
Before proceeding, ensure you:1
Have installed Angular
Get started here
2
Get your workspace ID
Sign up on Litlyx Dashboard and create a new workspace.
1. Install
Choose your package manager & install the library.2. Import
Now import Litlyx in yourentry-point
file. The easiest way in Angular is in the file app.component.ts
.
javascript
If you have an advanced Angular workspace or you are a senior developer, import it in the chosen path where you configure the entire application, for example, a provider used to initialize the application in
app.module.ts
.3. Initialize
Next, initialize the Litlyx library with your workspace in your entry-point file (alwaysapp.component.ts
in this example) as follow:
javascript
Page Visits
, Real-Time Users
, Referrers
, Bounce Rate
, Countries
, Unique Visitor Sessions
, OS
& Devices
.
If you have an advanced Angular workspace or you are a senior developer, remember not to show hardcoded IDs. Use a more secure pattern, for example, using an .env file and reading from it “workspace_id”.
4. Collect Custom Events
To customize your experience, add the following line in each function you desire. There is no limit to the number of events. If you want to test if it works and everything is well configured, import the OnInit method in the entry-point file (alwaysapp.component.ts
in this example):
javascript
javascript
metadata
field.
javascript
Events
tab with the Event Metadata Analyzer
.