Expand my Community achievements bar.

Webinar: Adobe Customer Journey Analytics Product Innovations: A Quarterly Overview. Come learn for the Adobe Analytics Product team who will be covering AJO reporting, Graph-based Stitching, guided analysis for CJA, and more!
SOLVED

Add new object into existing data layer

Avatar

Level 2

Hi Community ,
I am practicing Web Sdk and Adobe Analytics ,and want to add some object into existing Data layer can i add new object data into data layer ?
Demo websites I used for Web Sdk and analytics implementation : https://geometrixx.awsus3.cdn-alpha.com/index.html


Thanks,
Rishank

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Rishank_Tyagi 

the demo page uses a "digitalData" data layer. Obviously, if you want to add anything to it, you will have to do that via custom code you run in your console or inject with your tag manager.

For instance, to add a "language" field, you could do

digitalData.page.language = "en";

 

bjoern__koth_0-1727459433284.png

bjoern__koth_2-1727459563776.png

 

 

Cheers from Switzerland!

View solution in original post

8 Replies

Avatar

Correct answer by
Community Advisor

Hi @Rishank_Tyagi 

the demo page uses a "digitalData" data layer. Obviously, if you want to add anything to it, you will have to do that via custom code you run in your console or inject with your tag manager.

For instance, to add a "language" field, you could do

digitalData.page.language = "en";

 

bjoern__koth_0-1727459433284.png

bjoern__koth_2-1727459563776.png

 

 

Cheers from Switzerland!

Avatar

Level 2

Hi @bjoern__koth ,
Thanks for quick reply , the way you add "language" field in data Layer , 
Is this field's scope is till the session or it stay forever in data Layer until we remove that field?

Avatar

Community Advisor

Hi @Rishank_Tyagi 

since this is not "my" data layer, I can obviously only influence this value on the current page.

But your own data layer would behave in the same way. Data layers describe the current page and every page may have a completely different context than the previous one.

Obviously, you can persist data between page views e.g., if you wanted to store the previous page name in session storage to track it on the next page.
This very much depends on your tracking needs.

 

The digitalData object represents the minimum set of information that has been agreed upon between you and the developers of the website.
But you are free to use additional information that freely accessible on the website through the Data Elements of your tag manager.

For instance, the page's title does not necessarily have to be present in the digitalData if it identical to the document.title HTML attribute.

Cheers from Switzerland!

Avatar

Community Advisor

Let me know if you have more questions on the matter.

Cheers from Switzerland!

Avatar

Community Advisor

@Rishank_Tyagi  Can we consider this thread closed then?

Cheers from Switzerland!

Avatar

Community Advisor

@Rishank_Tyagi that you will have to do yourself. Mark which ever answer you think is correct ☺️

Cheers from Switzerland!