Understanding and implementing effective website tracking and user engagement tools is crucial for optimizing your digital strategy. Let’s explore how to integrate tools like Google Tag Manager, Facebook Pixel, and Survicate to gain valuable insights into your audience and improve their experience.
First, it’s critically important to determine your user’s subscription status and geolocation. this details allows for personalized experiences and targeted campaigns. Typically, this involves checking for a window?.geoinfo?.CountryCode and defaulting to ‘IN’ if unavailable.
Next, you can leverage visitor traits through platforms like Survicate. Specifically, w._sva.setVisitorTraits allows you to send data regarding user subscription status (toi_user_subscription_status) and geolocation (toi_user_geolocation).
However, Survicate’s integration requires a bit of finesse.If w._sva and w._sva.setVisitorTraits are instantly available, you can proceed with setting attributes directly. Otherwise, you shoudl listen for a “SurvicateReady” event to ensure the platform is fully loaded before attempting to set these traits.
To load the Survicate script, a dynamic script tag is created and inserted into the document. This script, sourced from https://survey.survicate.com/workspaces/0be6ae9845d14a7c8ff08a7a00bd9b21/web_surveys.js, is set to load asynchronously for optimal page performance.
Now, let’s discuss triggering these integrations based on specific site configurations. I’ve found that checking for the presence of toiplus_site_settings and campaign flags (isFBCampaignActive, isGoogleCampaignActive) is a reliable starting point.
If these settings are available and the user isn’t a prime subscriber, you can directly load Google Tag Manager (Gtag) events, Facebook Pixel events, and the Survicate JavaScript. This streamlined approach ensures that tracking and engagement tools are activated without delay.
However, if the initial configuration isn’t available, a fallback mechanism is necessary.Here’s what works best: a request is made to a Jarvis URL (https://jarvis.indiatimes.com/v1/feeds/toi_plus/site_settings/643526e21443833f0c454615?db_env=published) to retrieve the necessary settings.
Upon receiving the configuration, you can then proceed to load Gtag events, Facebook Pixel events, and Survicate JavaScript. Importantly, the allowed Survicate sections can be dynamically adjusted based on whether the user is in a prime layout, using either allowedSurvicatePrimeSections or allowedSurvicateSections.
To summarize,here’s a breakdown of the key steps:
* Determine User Status: Check for subscription status and geolocation.
* Set Visitor Traits: Utilize w._sva.setVisitorTraits to send relevant data to Survicate.
* Dynamic script Loading: Load the Survicate script asynchronously.
* Configuration Check: Verify the availability of toiplus_site_settings and campaign flags.
* Fallback Mechanism: Retrieve configuration from a Jarvis URL if initial settings are unavailable.
* Conditional Loading: Load tracking and engagement tools based on configuration and user status.
By implementing these strategies, you’ll gain a thorough understanding of your audience and create a more engaging and personalized experience for your users. Remember, consistent monitoring and optimization are key to maximizing the effectiveness of these tools.









