Expand my Community achievements bar.

SOLVED

"S is not defined" Error in Adobe DTM

Avatar

Level 1

Hi there,

I am in the process of migrating an existing Adobe anlytics implementation on s_code version 27.5 to DTM.   The first step of the migration and what is in scope of the project is a pick up and shift job of the current s_code into AdobeDTM.

The site has multiple JS files that house functions that need the 's object' to be initialised to work, however s is being initialised in the s_code contents after most of these JS functions have run so is throwing errors for 'S is not defined'.  It is not being initialised globally as it would be in a standard implementation.

Is there a way I can initialise 's' in the DTM satellite library globally. I have tried to add var = s{}; a page load rule under third party/custom tags area but only having intermittent luck with it, where sometimes getting errors thrown.

Any support/insight into this issue would be most appreciated.

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Aman ,

Assuming that you have unchecked the Page code already present option  and is using the option Custom code hosted in DTM  . "The AppMeasurement code / s_code"  is configured in the Library Management section of the tool settings under Code Configuration 

The Custom configuration option is typically preferred as an initial migration approach because it allows you to reference your existing AppMeasurement / s_code as-is without the need for additional tool configuration.

Hence to initialize the S object globally please write below code in the start of AppMeaurement code:

var s = new AppMeasurement();

Also, Please find below the guide for migrating to DTM

https://marketing.adobe.com/resources/help/en_US/dtm/gs/migrating-to-dtm.html

Thanks & Regards

Parit Mittal

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi Aman ,

Assuming that you have unchecked the Page code already present option  and is using the option Custom code hosted in DTM  . "The AppMeasurement code / s_code"  is configured in the Library Management section of the tool settings under Code Configuration 

The Custom configuration option is typically preferred as an initial migration approach because it allows you to reference your existing AppMeasurement / s_code as-is without the need for additional tool configuration.

Hence to initialize the S object globally please write below code in the start of AppMeaurement code:

var s = new AppMeasurement();

Also, Please find below the guide for migrating to DTM

https://marketing.adobe.com/resources/help/en_US/dtm/gs/migrating-to-dtm.html

Thanks & Regards

Parit Mittal

Avatar

Level 1

Hi Parit,

Thanks for your reply. 

I can confirm that Page code already present option  and am using the option Custom code hosted in DTM.

Will the line of code also work with s_code version H.27.5?

Kind regards.

Avatar

Level 10

Hi Aman ,

By using the option custom code hosted in DTM, you are basically migrating from s_code.js to Appmeaurement.js (AppMeasurement for JavaScript is a new library that provides the same core functionality of s_code.js, but is lighter and faster for use on both mobile and desktop sites) Hence "Copy your s_code.js customization to  Custom code hosted in DTM" i.e. Move all code that appears before the DO NOT ALTER ANYTHING BELOW THIS LINE section in s_code.js to the beginning of DTM hosted Appmeaurement code and also below code as stasrting line of Custom code hosted in DTM

var s= new AppMeasurement();

Please see the below links for more information:

https://marketing.adobe.com/resources/help/en_US/sc/implement/appmeasure_mjs_migrate.html

https://marketing.adobe.com/resources/help/en_US/sc/implement/appmeasure_mjs.html

Thanks & Regards

Parit Mittal