JS library that runs before Data Elements

Avatar

Avatar

Andrey_Osadchuk

MVP

Avatar

Andrey_Osadchuk

MVP

Andrey_Osadchuk
MVP

06-07-2018

I would like to have an option to add a JS library to use its functions in Data Element's custom code. This library should be loaded before Data Elements execution.

Example — JQuery.

3 Comments

Avatar

Avatar

thomas_amsler

Avatar

thomas_amsler

thomas_amsler

09-07-2018

If your website already has such a library loaded in the window namespace, you can use it within the custom code as well. The only problem is that you would need to have the other library loaded before and also synchroniously.

Avatar

Avatar

Andrey_Osadchuk

MVP

Avatar

Andrey_Osadchuk

MVP

Andrey_Osadchuk
MVP

09-07-2018

The idea is to have an option for the custom library addition to the site.

Avatar

Avatar

genej56194893

Avatar

genej56194893

genej56194893

28-11-2018

I've run into a few edge cases where this would be helpful.

We have a few data elements which unfortunately have some unique edge cases.

As a result, they have some decently complex custom JS.

They often include helper functions which do things like split up comma delimited lists before hitting a maximum character limitation. We have to include the same functions in every data element because there isn't a guaranteed execution order for data elements.

Having rules which can execute prior to data elements would allow me to consolidate these utility functions, saving space and reducing code maintenance.