Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

AEM Data Layer installation in AEM weretail site (localhost)

Avatar

Level 4

Team,

 

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!!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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: '${currentPage.name @ context='scriptString'}',
                    pageReferrer: document.referrer,
                    pageSiteSubsection: '${digitalDataLayer.pageSiteSubsection @ context='scriptString'}',
                    pageType: '${pageProperties.pageType @ context='scriptString'}',
                    pageURL: window.location.href
                }
            }
        }
    }());
</script>

 

Example: View Page Source, and go to the bottom of the HTML document: https://www.rolex.com
Documentation: https://docs.adobe.com/content/help/en/analytics/implementation/prepare/data-layer.html

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

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: '${currentPage.name @ context='scriptString'}',
                    pageReferrer: document.referrer,
                    pageSiteSubsection: '${digitalDataLayer.pageSiteSubsection @ context='scriptString'}',
                    pageType: '${pageProperties.pageType @ context='scriptString'}',
                    pageURL: window.location.href
                }
            }
        }
    }());
</script>

 

Example: View Page Source, and go to the bottom of the HTML document: https://www.rolex.com
Documentation: https://docs.adobe.com/content/help/en/analytics/implementation/prepare/data-layer.html

Avatar

Level 4
Hi, thanks for your reply. I am aware about the data layer and its usage across the analytics and web site. However, I am looking to host the AEM data layer under my local host 4502 (we retail) instance. Please refer the link for reference. I am looking to host the data layer on the same method. Would be good if you guide me to install on the same method. Where can I download those package and how to proceed further? https://blogs.adobe.com/contentmanagement/2017/04/18/be-an-aemrockstar-use-aem-datalayer/

Avatar

Community Advisor

Everything should be in the documentation, https://blogs.adobe.com/contentmanagement/2017/04/18/be-an-aemrockstar-use-aem-datalayer/ Just start from Step 1.

With the documentation, make sure to watch the video: https://spark.adobe.com/video/RE9fXgcyYVTrC

You can download the AEM content package from Proficient Digital's GitHub releases tab, https://github.com/PerficientDigital/AEM-DataLayer/releases