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 man­age your ana­lyt­ics s_code has a bunch of good ben­e­fits in my opin­ion. Things like:

  1. You will always be work­ing with the lat­est ver­sion of the Adobe Ana­lyt­ics library (no need to down­load the lat­est and great­est).

  2. If you des­ig­nate your pro­duc­tion and stag­ing report suites as part of your Adobe Ana­lyt­ics con­fig­u­ra­tion, DTM will auto­mat­i­cal­ly 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­cal­ly based on URL? Does this mean you auto­mat­i­cal­ly will need to switch to a cus­tom s_code deploy­ment? Is there a way to get the best of both worlds? Recent­ly, I’ve been work­ing on a DTM project that requires mul­ti-suite tag­ging and I want­ed to find a way to always give the client the most recent ver­sion of s_code and still be able to man­age 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 man­age your s_code, using the glob­al “Cus­tomize Page Code” sec­tion in DTM will allow you to add any addi­tion­al cus­tomized Javascript or plu­g­ins. This real­ly means that your code changes can over­ride or change vari­able set­tings (like s.account) because the cus­tom code will take prece­dence over UI set­tings. So how can you change the s.account val­ues dynam­i­cal­ly for a mul­ti-suite tag­ging imple­men­ta­tion with Adobe man­aged code? Here’s what I did:

Step 1: Set your Library Man­age­ment Con­fig­u­ra­tion

Con­firm that the Library Man­age­ment con­fig­u­ra­tion of your DTM prop­er­ty is using Adobe man­aged s_code.

Step 1 - set your library management config

Step 2: Con­fig­ure the Cus­tom Page Code prece­dence.

Make sure the prece­dence set­ting under the glob­al “Cus­tomize Page Code” con­fig­u­ra­tion is set to “After UI Set­tings” This will allow your code changes to over­ride the use of default stag­ing or pro­duc­tion report suite set­tings.

step 2 config custom page code

Step 3: Add your cus­tom code to dynam­i­cal­ly set the report suite.

Open the “Cus­tomize Page Code” edi­tor and add code that will set the report suite based on URL con­di­tions. o   The exam­ple below will set the s.account based on the cur­rent URL. step 3 add custom code

Step 4: Save changes and test in stag­ing.

step 4 save change and test

Using the Cus­tom Page Code con­fig­u­ra­tion is a great way to man­age the report suite set­tings for mul­ti-suite tag­ging and still get the ben­e­fit of an Adobe man­aged s_code imple­men­ta­tion.