access application Javascript Variables in launch script | Community
Skip to main content
Level 3
September 3, 2024
Solved

access application Javascript Variables in launch script

  • September 3, 2024
  • 4 replies
  • 1217 views

Is there a way to access application JS variables in launch script?

In our application, we store the data received in service calls into a Javascript variable, how do i access this variable in my Data elements in AEP data collection?, the documentation i looked at point to creating a data element of type "Javascript variable" but they are not pointing to any implementation as such. also, looking to see if this can be implemented without the data layer.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Ankit_Chaudhary

Hi @asp_corp 

JS variable type data element can only access a window level variable from your application generaly data layer are created for the sole purpose of storing additional user data which organizations wants to send to the analytics tools. You can check your data element on the console using _satellite.getVar("your data element Name") method, if it's returning undefined or null then the value is not available.

4 replies

Ankit_Chaudhary
Community Advisor
Ankit_ChaudharyCommunity AdvisorAccepted solution
Community Advisor
September 4, 2024

Hi @asp_corp 

JS variable type data element can only access a window level variable from your application generaly data layer are created for the sole purpose of storing additional user data which organizations wants to send to the analytics tools. You can check your data element on the console using _satellite.getVar("your data element Name") method, if it's returning undefined or null then the value is not available.

bjoern__koth
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
September 9, 2024

Depends on whether your app and attributes are accessible from a window context.

 

Nowadays, it is likely not openly accessible, but what you can do is ask your devs to push this information into a/the data layer instead.

Cheers from Switzerland!
kautuk_sahni
Community Manager
Community Manager
September 16, 2024

@asp_corp Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!

Kautuk Sahni
Amruthesh_AG
Community Advisor
Community Advisor
October 15, 2024

@asp_corp You can check by calling the application stored Javascript variable in browser console by typing the variable name.

 

If it is accessible and printing the value then only you can create a data element by calling the JavaScript variable name
You can validate this on https://www.lastacaft.com/

Ex: application variable name is "btoa.name"

 

While create a data element pass JavaScript variable as "window.btoa.name"