Expand my Community achievements bar.

SOLVED

Not able to fetch Datalayer variable

Avatar

Level 1

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.
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

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

Avatar

Level 2

@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