Home » World » Delhi Flood Chaos: Hospital Overwhelmed, Woman and Son Killed by Collapsed Wall

Delhi Flood Chaos: Hospital Overwhelmed, Woman and Son Killed by Collapsed Wall

new Delhi: TimesApps has introduced a new JavaScript function, `toiPlusEvents`, designed to manage marketing and analytics integrations for its “toiplus” service. This function dynamically loads Google Tag Manager (gtag.js) and Facebook Pixel (fbevents.js) scripts based on campaign activation flags,and also integrates the Survicate customer feedback platform.

The `toiPlusEvents` function first checks for the presence of `toiplus_site_settings` in the global `f` object, specifically looking for `isFBCampaignActive` and `isGoogleCampaignActive` flags. If these settings are available and the user is not identified as a prime subscriber (checked via `window.isPrime`), the function proceeds to load the respective marketing scripts and Survicate.js, passing the `allowedSurvicateSections` from the site settings.

In scenarios where the initial site settings are not available or the user is a prime subscriber, the `toiPlusEvents` function fetches site settings from a specified Jarvis API endpoint. this endpoint, located at `https://jarvis.indiatimes.com/v1/feeds/toi_plus/site_settings/643526e21443833f0c454615?db_env=published`, provides campaign and Survicate configuration. The function then uses this fetched data to load gtag.js, fbevents.js, and Survicate.js. Notably,when a prime user layout is detected (`window.isPrimeUserLayout`), the function prioritizes `allowedSurvicatePrimeSections` for Survicate integration.

the Survicate integration itself is handled by a separate block of code that ensures the Survicate JavaScript library is loaded asynchronously. This code checks if the `_sva` object and its `setVisitorTraits` method are available. If they are,it promptly calls a `setAttributes` function to configure visitor traits,including subscription status and geolocation. If `_sva` is not yet ready, an event listener is attached to the `survicateready` event to execute `setAttributes` once the platform is initialized. The `setAttributes` function determines the country code from `window.geoinfo.CountryCode` or defaults to ‘IN’ if unavailable.

This implementation allows timesapps to manage its digital marketing and customer engagement tools efficiently, adapting its strategy based on user status and campaign configurations.

You may also like

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.