How can I change the report suite dynamically if my s_code is managed by Adobe?

The recent update in DTM to allow Adobe to manage your analyt­ics s_code has a bunch of good bene­fits in my opinion. Things like:

  1. You will always be working with the latest version of the Adobe Analyt­ics library (no need to down­load the latest and great­est).

  2. If you desig­nate your produc­tion and staging report suites as part of your Adobe Analyt­ics config­u­ra­tion, DTM will auto­mat­i­cally assign the right report suite for the right deploy­ment envi­ron­ment.

But what if your imple­men­ta­tion requires the report suite to change dynam­i­cally based on URL? Does this mean you auto­mat­i­cally will need to switch to a custom s_code deploy­ment? Is there a way to get the best of both worlds? Recently, I’ve been working on a DTM project that requires multi-suite tagging and I wanted to find a way to always give the client the most recent version of s_code and still be able to manage the s.account on the fly.

Using the Customize Page Code allows you to extend the s_code functionality before Adobe Analytics executes

If you choose to let Adobe manage your s_code, using the global “Customize Page Code” section in DTM will allow you to add any addi­tional customized Javascript or plugins. This really means that your code changes can over­ride or change vari­able settings (like s.account) because the custom code will take prece­dence over UI settings. So how can you change the s.account values dynam­i­cally for a multi-suite tagging imple­men­ta­tion with Adobe managed code? Here’s what I did:

Step 1: Set your Library Manage­ment Config­u­ra­tion

Confirm that the Library Manage­ment config­u­ra­tion of your DTM prop­erty is using Adobe managed s_code.

Step 1 - set your library management config

Step 2: Config­ure the Custom Page Code prece­dence.

Make sure the prece­dence setting under the global “Customize Page Code” config­u­ra­tion is set to “After UI Settings” This will allow your code changes to over­ride the use of default staging or produc­tion report suite settings.

step 2 config custom page code

Step 3: Add your custom code to dynam­i­cally set the report suite.

Open the “Customize Page Code” editor and add code that will set the report suite based on URL condi­tions. o   The example below will set the s.account based on the current URL. step 3 add custom code

Step 4: Save changes and test in staging.

step 4 save change and test

Using the Custom Page Code config­u­ra­tion is a great way to manage the report suite settings for multi-suite tagging and still get the benefit of an Adobe managed s_code imple­men­ta­tion.