New Delhi, India – A recent update to the timesapps JavaScript code introduces enhanced tracking and engagement capabilities for users, particularly focusing on subscription status and geolocation data. The changes aim to provide a more personalized user experience and improve campaign effectiveness across various platforms.
The updated script, designed to be implemented within the TimesApps framework, includes functionalities for integrating with Survicate, a customer feedback and survey platform. This integration allows for the dynamic setting of visitor traits, such as user subscription status and geolocation.The code snippet reveals a conditional logic that sets the visitor’s country code to ‘IN’ if no geolocation details is available through the `window.geoinfo` object.
the implementation of Survicate is managed through an event listener. If the Survicate JavaScript object (`_sva`) and its `setVisitorTraits` method are available, the attributes are set immediately. Or else, the script waits for a “SurvicateReady” event to be dispatched before proceeding. A seperate script tag for Survicate is dynamically created and inserted into the document’s head to load the necessary survey functionalities.
The `TimesApps.toiPlusEvents` function serves as the primary entry point for these new features. It checks for the availability of specific site settings, including flags for active Facebook and Google campaigns. The execution of campaign-related tracking scripts,such as Google Tag (gtag) events and facebook Pixel events,is contingent on these settings.
in scenarios were the initial site settings are not readily available, the script initiates a request to a specified Jarvis API endpoint. This endpoint, located at `https://jarvis.indiatimes.com/v1/feeds/toi_plus/site_settings/643526e21443833f0c454615?db_env=published`, retrieves the necessary configuration. The response from this API call then dictates weather Google and Facebook campaign tracking scripts are loaded, along with the Survicate JavaScript, based on whether the user is on a prime user layout or not.
This comprehensive update signifies a strategic move by TimesApps to leverage user data for improved personalization and campaign targeting, ensuring that marketing efforts are both efficient and relevant to the user base.