This guide will help you to integrate Retainly features seamlessly into your web application with Retainly JS SDK.
To initialize the Retainly JS SDK, you can use the
Config Fields #
config object can have the following properties:
|Toggle automatic page view tracking.|
|List of UTM parameters to track automatically.|
|Enable tracking of all query parameters on the page.|
|Define specific query parameters to track, effective only if |
|If specified, sets up Google Analytics and sends page views and events.|
|Automatically ping the server at regular intervals between |
|Interval between pings, in seconds.|
|Additional properties to include in ping requests.|
|Expiration time for tracking cookies, in seconds.|
|Expiration time for A/B test cookies, in seconds.|
|General cookie expiration time, in seconds.|
Event and Page Tracking #
Manually track events and page views.
Page View #
To manually track a page view, use:
To manually track an event, use:
Session Tracking #
Start and end user sessions manually.
Start Session #
To start a new user session, use:
End Session #
To end the current user session, use:
User Identification #
Identify individual users who were previously unknown and tracked only by cookies.
Push Notifications #
Allow your application to subscribe the user for push notifications.
Certainly, I can help rephrase your guidelines to make them easier to understand.
Quick Start Guidelines #
Here are some easy-to-follow guidelines on how to properly integrate Retainly’s WEB SDK into various user interactions on your platform.
1. New User Registration #
When someone new signs up on your website, you’ll need to:
- Tell Us About the New User: Make sure to send us the new user’s details right after they sign up.
- Track the Registration: Also, send us a ‘Registration’ event to note that a new user has joined.
2. Adding Items to Cart #
Whenever someone adds an item to their shopping cart:
- Just Send the Info: You can notify us no matter whether we know this user or not.
- But Preferably, Let Us Know the User: For the best tracking, it’s good if this user already exists in our system.
3. Completing a Purchase #
When a purchase is made:
- Notify Us of the Purchase: Send us a ‘Purchase’ event right after the transaction.
- Who Made the Purchase?: Again, it’s better if this customer is already registered in our system for comprehensive tracking.
Tracking Guest Users #
Our WEB SDK can still track users even if they haven’t signed up. We just label their activities under an ‘unknown customer’ profile. If they later sign up, all their past activities get merged into their new profile.
🔑 Important: Always make sure to create customer profiles in our system for the best experience.
About Cookies and Tracking #
- User Data May Be Lost: If someone clears their cookies or uses private browsing, we might lose their activity data.
- Inform Your Users: Let your users know that cookies are being used to track their activity for a better user experience.