Expand my Community achievements bar.

JS library that runs before Data Elements

Avatar

Level 10

7/6/18

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

Level 9

7/9/18

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

Level 2

11/28/18

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.