Not able to fetch Datalayer variable | Community
Skip to main content
August 27, 2024
Solved

Not able to fetch Datalayer variable

  • August 27, 2024
  • 2 replies
  • 795 views

Hi All,

 

I am a beginner trying to learn Launch and was practicing. I created a sample 1 page and added data layer. I was trying to get the pageName variable using satellite call but getting as undefined.

Below is the data layer

    <script>
        var digitalData = {
            "page": {
                "pageInfo" : {
                    "pageName": "Home"
                    }
                }
        };
Data Element : digitalData.page.pageInfo.pageName
 
Rule custom code: console.log('The page name is '+_satellite.getVar('pageName'));
 
but getting the output as 
The page name is undefined
 
let me know if I am doing something wrong.
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 EstebanBustamante

Hi,


Check that the data element name you set up is "pageName," and double-check that the code is properly deployed. Then, in the browser console, you must verify if digitalData.page.pageInfo.pageName outputs the expected value. Some of these steps must be broken.

 

Hope this helps

2 replies

EstebanBustamante
Community Advisor and Adobe Champion
EstebanBustamanteCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
August 27, 2024

Hi,


Check that the data element name you set up is "pageName," and double-check that the code is properly deployed. Then, in the browser console, you must verify if digitalData.page.pageInfo.pageName outputs the expected value. Some of these steps must be broken.

 

Hope this helps

Esteban Bustamante
Level 3
September 12, 2024

@bhushan_mahajan90  If you are still facing issue and thinks that there is some issue with your own datalayer and if you feel that you need a already implemented datalayer than you can practice on below website provided by Adobe. On that website digitalData layer is already implemented and you can simply start creating data elements to fetch the values. 

Note:- Use AEP debugger tool to inject the environment code for testing.

https://luma.enablementadobe.com/content/luma/us/en.html