Understanding and Implementing website Visitor Analytics and Engagement Tools
successfully tracking user behavior and tailoring experiences is crucial for modern websites. You need to understand who your visitors are and how they interact with your content to optimize performance and drive results. This involves leveraging tools for geolocation, subscription status tracking, and targeted surveys.
Geolocation for Personalized Experiences
Determining a visitor’s geographic location allows for highly personalized content delivery. Typically, this is achieved through IP address analysis. However, it’s notable to handle this data responsibly and respect user privacy.
* If geolocation data is available via window.geoinfo?.CountryCode, it’s used.
* Otherwise, a default country code of ‘IN’ (India) is assigned.
* This ensures a baseline location is always available for segmentation and analysis.
Tracking User Subscription Status
Knowing whether a visitor is a subscriber unlocks opportunities for tailored experiences. For example, you might offer premium content or exclusive features to paying members.
* Teh prime_user_status variable indicates whether a user has a premium subscription.
* This facts is then passed to visitor trait systems like Survicate.
Leveraging Visitor Traits with survicate
Visitor traits provide a comprehensive profile of each user, enabling targeted engagement. Survicate, a popular survey and feedback platform, utilizes these traits to deliver relevant experiences.
* toi_user_subscription_status and toi_user_geolocation are key traits set within Survicate.
* These traits allow you to segment your audience and trigger surveys based on specific criteria.
* If the Survicate integration isn’t immediately available, the code dynamically waits for the SurvicateReady event before setting the attributes.
Implementing the Survicate Script
The Survicate JavaScript code is dynamically loaded into your website.This ensures that the survey functionality is available without blocking page load times.
* A script tag is created and its src attribute is set to the Survicate workspace URL.
* The async attribute ensures the script loads in the background.
* The script is inserted before the first existing script tag on the page.
Dynamic Configuration and Event Loading
The system is designed to adapt to different configurations and campaign settings. It prioritizes readily available settings but falls back to fetching data from a configuration source if needed.
* Initially, the code checks for the presence of toiplus_site_settings and campaign flags (isFBCampaignActive, isGoogleCampaignActive).
* If these settings are available and the user isn’t a premium subscriber, relevant events are loaded for Google Tag Manager (Gtag) and Facebook.
* Survicate is also initialized with the appropriate allowed sections.
Fetching Configuration from Jarvis
If the initial configuration isn’t available, the system retrieves it from an external source, Jarvis.
* A request is made to the Jarvis API endpoint.
* Upon receiving a successful response, the code extracts the necessary settings.
* the allowedSurvicateSections are adjusted based on whether the user has a premium layout.
* Gtag,facebook,and Survicate are then initialized with the fetched configuration.
Handling Premium user Layouts
The system recognizes and adapts to different user layouts, particularly for premium subscribers.
* if isPrimeUserLayout is true, the allowedSurvicatePrimeSections are used for Survicate configuration.
* Otherwise, the standard allowedSurvicateSections are applied.
* This ensures that premium users receive surveys tailored to their specific experience.







