The purpose of this blog is to go over AEM DTM Integration process step by step, using the recommended configuration options. There is documentation available for integration by Adobe here. Although, for someone who is integrating AEM DTM for the first time or with limited knowledge of one or the other, it is quite overwhelming to be exposed to the technicalities of all the available options at once. This post will also elaborate and expand on embedding DTM code on various experiences built within a single AEM instance. I hope this blog helps in simplifying the process for you.Assuming you have an author instance of AEM running, there are the three majors steps you need to perform to add the DTM code on your site via the cloud-hosted services integration:
- Create web property in DTM
- Configure AEM DTM Integration
- Embed DTM code in a specific AEM site
Create DTM web property
Let me start with a brief description of ‘Dynamic Tag Management’ (DTM). It is Adobe's Tag Management solution that allows you to setup rules to control when data is collected, where it goes, and how it is organized. With DTM, you can deploy any tag on any number of pages without dealing with rigid templates. It provides much more flexibility over old school analytics implementation in terms of developer involvement, future enhancements and custom metrics tracking.To create a web property in DTM, login to dtm.adobe.com and click on ‘Add Property’. Fill in the required fields – Name and URL. In Advanced settings, I usually check the first two options to enable approving and publishing multiple rules at once:
- Allow Multi-Rule Approvals
- Enable Selective Publish
Leave the rest to defaults. DTM is flexible enough to let you change the settings later on.
Setup DTM connection from AEM
In your AEM instance, go to Tools > Operations > Cloud > Cloud Services. Look for Dynamic Tag Management.
For adding the first configuration, click configure now
If one or more configurations are already added, Click Show configurations then go on to add a new or modify the existing one.
To create a configuration, provide an appropriate title and name (optional) and hit create.
Once a configuration is created, there are three types of settings you need to configure:
- General Settings –
- API Token: AEM requires this property to authenticate with DTM. This is provided by Adobe/DTM client care.
- Company – It appears when you provide the API token and hit ‘Connect to DTM’. Simply select it from the drop-down.
- Property – Select the DTM property you created for analytics implementation on AEM
- Include Production Code on Author – It is recommended to uncheck this option. This allows you to have the staging code on Author and test the DTM rules before publishing.
- Staging Settings –
- Use self-hosting – Uncheck this option. For the purpose of this blog, I am using the cloud-hosted solution, which is recommended and simplest to use.
- Header Code – If you have entered the API token, this will be auto populated with staging header code of the selected DTM property.
- Footer Code – This code is same irrespective of the DTM property you select and is pre-populated for you even before making the DTM connection.
- Production Settings –
- For cloud-hosted solution, these are same as the Staging settings. Just make sure, there is no ‘-staging’ suffix in JS for Header code.
NOTE: Even though, Header and Footer code for both staging and production are auto-populated once you connect to DTM but it is pretty easy to retrieve them from DTM in case you want to verify. Simply navigate to the Embed tab of your DTM property.
Embed DTM code in a specific set of AEM webpages
All the hard work is done, now it is time to get the reward! Once you have configured the AEM DTM connection, it is simply a matter of selecting the right configuration from the list.
Login to AEM author instance; navigate to the site/set of pages where you want to embed the DTM code, and then right click to select Properties –
Go to Cloud Services > Add Service > Select ‘Dynamic Tag Management’
Configuration created in step 2 will be available in the drop-down. Select the configuration to embed the DTM property code to the site and hit ‘OK’ to save.