AEM Data Layer installation in AEM weretail site (localhost)





I am looking forward to install AEM data layer for my local instance which is http://localhost:4502/sites.html/content/we-retail . So that the way and method of getting data to anaytics will make site easier and standard. Basically I am a analytics guy and not aware much on this data layer installation process. Please assit me with below.


1. Could you please tell me where can I get my AEM data layer packages from adobe?

2. Also, send me some docs or steps to be followed to install in my local host.


Thank you!!

Accepted Solutions (1)

Accepted Solutions (1)




Hi @Jayakrish ,

A data layer is a framework of JavaScript objects on your site that contains all variable values used in your implementation. It allows greater control and easier maintenance in your implementation. These JavaScript objects interact with Adobe Analytics.
Setup can be done as simple as adding code within your basePage template, right before the </body> as such:


<script data-sly-use.digitalDataLayer="my.package.DigitalDataLayer">
    (function () {
        var digitalDataLayer = {
            environment: {
                environmentVersion: '${digitalDataLayer.environmentVersion @ context='scriptString'}',
                environmentName: '${digitalDataLayer.environmentName @ context='scriptString'}',
                siteName: '${digitalDataLayer.siteName @ context='scriptString'}',
                statusCode: '${digitalDataLayer.statusCode @ context='scriptString'}'
            target: {},
            page: {
                pageInfo: {
                    pageName: '${ @ context='scriptString'}',
                    pageReferrer: document.referrer,
                    pageSiteSubsection: '${digitalDataLayer.pageSiteSubsection @ context='scriptString'}',
                    pageType: '${pageProperties.pageType @ context='scriptString'}',
                    pageURL: window.location.href


Example: View Page Source, and go to the bottom of the HTML document:

Answers (0)