Usage
SDK Methods
List of commands available with our SDK
The SDK includes 4 methods :
- show
- hide
- toggle
- hasNotification
- setLanguage
- setUser
show
Opens the Logchange modal. Use this when you want to open the modal with a click.
Example:
window.Logchange.show();
// Type
show: () => void;
hide
Closes the Logchange modal. Use this when you need to close the modal.
Example:
window.Logchange.hide();
// Type
hide: () => void;
toggle
Toggle the Logchange modal
Example:
window.Logchange.toggle();
// Type
toggle: () => void;
hasNotification
Use this when you need to know if the user has unread notifications.
Example:
window.Logchange.hasNotification;
// Type
hasNotification: boolean;
setLanguage
Sets the user's language in Logchange to ensure that the correct changelogs are displayed, based on the language settings configured in your account.
Example:
window.Logchange.setLanguage(
"fr" | "en" | "it" | "pt" | "be" | "es" | "de" | "cn"
);
// Type
setLanguage: (
language: "fr" | "en" | "it" | "pt" | "be" | "es" | "de" | "cn"
) => void;
setUser and Segment Users
Sets the user in Logchange. Defining the user avoids anonymous entries and enables user segmentation based on the provided information. You can pass attributes such as fullname, email, and other custom attributes.
This method allows for effective segmentation, enabling you to categorize users based on details like fullname, email, and any additional attributes you provide. This segmentation can help tailor services, enhance analytics, and improve user experience.
Example:
window.Logchange.setUser({
fullname: "John Doe",
email: "[email protected]",
attributes: { location: "France", ... },
});
// Type
setUser: (user: {
email: string;
fullname: string;
attributes: Record<string, string>;
}) => void;
By leveraging user segmentation, you can better understand and serve your users according to their specific attributes.
Simple usage
Instantiate Our SDK on Page Load
Ensure the SDK initializes as soon as your webpage loads, setting the groundwork for user interactions.
User Login Commands
When users log into your site Execute the following commands to personalize their experience and track user activity accurately.
window.Logchange.setLanguage(
"fr" | "en" | "it" | "pt" | "be" | "es" | "de" | "cn"
);
window.Logchange.setuser({
fullname: "John Doe",
email: "[email protected]",
});