JS library that runs before Data Elements | Community
Skip to main content
Andrey_Osadchuk
New Participant
July 6, 2018
New

JS library that runs before Data Elements

  • July 6, 2018
  • 3 replies
  • 4050 views

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 replies

New Participant
November 28, 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.

Andrey_Osadchuk
New Participant
July 9, 2018

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

New Participant
July 9, 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.