Expand my Community achievements bar.

SOLVED

View as published option in AEM 6.2 author instance includes Production DTM JS Library

Avatar

Level 3

Hi,

We have noticed that View as published option in AEM 6.2 author instance includes Production DTM script (instead of Staging DTM Script), which affects Analytics Report (since analytics data is also coming from author instance). How can we rectify this issue since all the DTM rules are getting fired from 'View as Published' option in author instance and sending data to Production Report?

Kindly refer below screen shot :

Your immediate response is much appreciated.

Thank you.

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi 

I have checked the behavior you just have mentioned.

When configuring DTM cloud service  we have un-checked "Include Production Code on Author" so in theory AEM authoring should use staging data.

So when we select preview mode, it only triggers Staging script but when we click on "View as published" it adds "?wcmmode=disabled" to the URL and the production scripts getting triggered.

I am not sure if this is a correct behavior or not, may be when we do "View as published" we have imitating full production view.

 

Workaround:- In DTM,

1. Select your property

2. Go to Analytic tool settings

3. Go to "Customize Page Code" (Select After UI settings (custom code takes precedence)) Here write a logic to check if URL of page (windows.location.href) is of Author instance then set "s.account="Staging report suit". This will make sure that data from authoring instance would never goes to production server. 

 

I hope this helps.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

View solution in original post

4 Replies

Avatar

Level 3

Hi,

Just wanted to check if we have any update on this ?

Thank you in advance!

Avatar

Correct answer by
Administrator

Hi 

I have checked the behavior you just have mentioned.

When configuring DTM cloud service  we have un-checked "Include Production Code on Author" so in theory AEM authoring should use staging data.

So when we select preview mode, it only triggers Staging script but when we click on "View as published" it adds "?wcmmode=disabled" to the URL and the production scripts getting triggered.

I am not sure if this is a correct behavior or not, may be when we do "View as published" we have imitating full production view.

 

Workaround:- In DTM,

1. Select your property

2. Go to Analytic tool settings

3. Go to "Customize Page Code" (Select After UI settings (custom code takes precedence)) Here write a logic to check if URL of page (windows.location.href) is of Author instance then set "s.account="Staging report suit". This will make sure that data from authoring instance would never goes to production server. 

 

I hope this helps.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 3

Hi Kautuk,

Thank you for your suggestion. However this doesn't resolve the issue. I can still see, production report suite is getting triggered on author URL with '?wcmmode=disabled'. :(

For testing purpose, I just put s.account="report-suite-id"; under Customize Page Code in DTM and I can see the mentioned report suite Id is not getting triggered anywhere.

Please let me know if anything else can be done.

Avatar

Level 3

It worked for me after I published the changes for Analytics tool changes in DTM.

Thank you.