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.
Solved! Go to Solution.
Views
Replies
Total Likes
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.
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.
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.
@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!
Views
Replies
Total Likes
@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"
Views
Replies
Total Likes
Views
Like
Replies
Views
Likes
Replies