Skip to main content
Level 2
Oct 11, 2022 8:58 AM UTC
Solved

With an Adobe Analytics rule, is it necessary to add a condition to check that 's' is defined?

Hi everyone!

Haven't used Launch... or Tags... or Platform Data Collection in a while, and just wondered when you set up an Adobe Analytics rule, should you add a condition to make sure the 's' variable is available?

I'm using the Adobe Analytics extension, and in the past didn't perform this check as I thought it was something baked into using the Adobe Analytics extension.

Many thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
tim_funk
tim_funkAccepted solution
Level 3
Oct 11, 2022 9:48 AM UTC

The answer is ... it depends. Inside of Adobe launch, if you are creating rules or custom conditions - The s variable will be scoped in and available to use. So no need to declare it, Adobe Launch + the Analytics extension takes care of that for you.

 

If you want to use the "s" variable elsewhere, there is an option in the Launch extension to enable the s variable to be globally accessible. This comes in handle when you have a generic helper method (such as a plugin) that assumes the s variable (is global) instead of allowing the s variable to be passed as a variable(preferred)

5 replies

ranjithd
Level 4
Oct 11, 2022 9:38 AM UTC

first check Jquery plugin is running before the adobe launch & cross-validate that the launch script is inserted in the head tag section

 

https://experienceleague.adobe.com/docs/analytics/implementation/vars/functions/doplugins.html?lang=en

 

Update the setting in the adobe analytics plugin and as well publish the configurations.

Adobe Analytics

 

After you can use

s.charSet = "UTF-8";
s.trackDownloadLinks = true;
s.trackExternalLinks = true;
s.trackInlineStats = true;

 

s.---- values in all the trackings.

 

Refer:

https://experienceleague.adobe.com/docs/analytics-learn/tutorials/implementation/via-adobe-launch/configuring-global-variables-in-the-launch-analytics-extension.html?lang=en

 

Translate
tim_funk
tim_funkAccepted solution
Level 3
Oct 11, 2022 9:48 AM UTC

The answer is ... it depends. Inside of Adobe launch, if you are creating rules or custom conditions - The s variable will be scoped in and available to use. So no need to declare it, Adobe Launch + the Analytics extension takes care of that for you.

 

If you want to use the "s" variable elsewhere, there is an option in the Launch extension to enable the s variable to be globally accessible. This comes in handle when you have a generic helper method (such as a plugin) that assumes the s variable (is global) instead of allowing the s variable to be passed as a variable(preferred)

Translate
Level 2
Oct 11, 2022 10:04 AM UTC

Thanks Tim!

We have window.s set as a global variable in the Adobe Analytics extension.

So basically, when Launch initialises the Adobe Analytics extension, it sets window.s up, and then any subsequent rules won't need to worry about checking for it?

Translate
tim_funk
Level 3
Oct 11, 2022 10:09 AM UTC

Correct - When set, I believe you can safely assume the variable exists. So it could be referenced anytime (after initialization) without the dreaded

Uncaught TypeError: Cannot read properties of undefined 
Translate