
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
@comparaonline/event-tracker
Advanced tools
This library it's an interface between any frontend application and some event tracking platforms, currently Snowplow and Tag Manager.
This library is an interface between any frontend application and event tracking platforms.
There's more documentation available for the library in compara's notion
To install the library in your application use
yarn add @comparaonline/event-tracker
or
npm install @comparaonline/event-tracker
After installing the package you can send an event using the function track. For example:
import { track, BUSINESS_UNIT, COUNTRY_CODE } from '@comparaonline/event-tracker';
// Example of form step render event
track({
name: 'form_step_render',
data: {
app_name: 'my-app',
app_version: '1.0.0',
country_code: COUNTRY_CODE.CL,
business_unit: BUSINESS_UNIT.CAR_INSURANCE,
user_type: 'anonymous',
quote_id: '12345',
accordion_index: '0',
accordion_name: 'personal-information'
}
});
// Example of transaction event
track({
name: 'transaction',
data: {
app_name: 'my-app',
app_version: '1.0.0',
country_code: COUNTRY_CODE.CL,
business_unit: BUSINESS_UNIT.CAR_INSURANCE,
user_type: 'registered',
user_id: 'user-123',
transaction_id: 'trans-456',
amount: 15000,
currency: 'CLP'
}
});
// Example of one-click checkout modal open event
track({
name: 'one_click_checkout_modal_open',
data: {
app_name: 'my-app',
app_version: '1.0.0',
country_code: COUNTRY_CODE.CL,
business_unit: BUSINESS_UNIT.CAR_INSURANCE,
user_type: 'registered',
user_id: 'user-123',
offer_id: 'offer-789',
quote_id: 'quote-456'
}
});
The library will automatically send the event to all enabled trackers (currently ABTasty and Heap).
The trackers currently supported by the library are:
The library is configured to use both trackers by default. The events are automatically sent to both trackers when you use the track function.
The library supports various event types:
attached_policy_to_user: Track when a policy is attached to a usercancel_policy_requested: Track when a user requests a policy cancellationcep_autocompleted: Track when a postal code is autocompletedform_step_render: Track when a form step is renderedone_click_checkout_completed: Track when a one-click checkout is completedone_click_checkout_modal_open: Track when a one-click checkout modal is openedotp_error: Track when an OTP error occurspayment_method_updated: Track when a payment method is updatedperson_autocompleted: Track when person information is autocompletedtransaction: Track a transactiontutorial_begin: Track when a tutorial beginstutorial_complete: Track when a tutorial is completeduser_account_onboarding_completed: Track when user onboarding is completeduser_multi_travel_selected: Track when user selects multi-travelvehicle_autocompleted: Track when vehicle information is autocompletedprofile_updated: Track when user profile information is updatedtravel_companion_upserted: Track when a user's travel companion information is upsertedtravel_companion_removed: Track when a user's travel companion information is removedemergency_contact_upserted: Track when a user's emergency contact information is upsertedemergency_contact_removed: Track when a user's emergency contact information is removedsuccessful_payment: Track when user payment is completedEach event type requires specific data. You can import the type definitions to ensure you're providing the correct data:
import { track, BUSINESS_UNIT, COUNTRY_CODE } from '@comparaonline/event-tracker';
import type { FormStepRenderData } from '@comparaonline/event-tracker';
const eventData: FormStepRenderData = {
app_name: 'my-app',
app_version: '1.0.0',
country_code: COUNTRY_CODE.CL,
business_unit: BUSINESS_UNIT.CAR_INSURANCE,
user_type: 'anonymous',
quote_id: '12345',
accordion_index: '0',
accordion_name: 'personal-information'
};
track({
name: 'form_step_render',
data: eventData
});
If you're migrating from version 6.x or earlier, there are significant changes to the API. The main changes are:
sendEvent function has been replaced with trackSNOWPLOW_APP or TAG_MANAGER_APPTo migrate, update your imports and replace your event sending code:
Old code:
import { endpoints, sendEvent, types } from '@comparaonline/event-tracker/';
import {
carInsuranceGenerators,
FormSubmitParams,
} from '@comparaonline/event-tracker/eventGenerators/carInsurance';
const rawFormSubmit: FormSubmitParams = {
appVersion: '1.0',
appName: 'test-module',
countryCode: types.CountryCodeTypes.chile,
formId: 'asdf',
formType: types.FormTypes.wizard,
formSubmitStatus: types.FormStatusTypes.successful,
funnelType: types.FormRelatedTypes.FunnelTypes.quote,
formValues: { a: 'asdf', b: 'sdf' },
};
const formSubmit = carInsuranceGenerators.generateFormSubmit(rawFormSubmit);
sendEvent(endpoints.SNOWPLOW_APP, formSubmit);
New code:
import { track, BUSINESS_UNIT, COUNTRY_CODE } from '@comparaonline/event-tracker';
track({
name: 'form_step_render',
data: {
app_name: 'test-module',
app_version: '1.0',
country_code: COUNTRY_CODE.CL,
business_unit: BUSINESS_UNIT.CAR_INSURANCE,
user_type: 'anonymous',
quote_id: 'asdf',
accordion_index: '0',
accordion_name: 'form-step'
}
});
FAQs
This library it's an interface between any frontend application and some event tracking platforms, currently Snowplow and Tag Manager.
The npm package @comparaonline/event-tracker receives a total of 25 weekly downloads. As such, @comparaonline/event-tracker popularity was classified as not popular.
We found that @comparaonline/event-tracker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 12 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.