Wordpress Oxygen Builder Segment

Buna, ma adresez cunoscatorilor de WordPress. Am un website ce face trecerea la Oxigen Builder
https://oxygenbuilder.com/ si trebuie sa migram eventurile pentru segment (https://segment.com/)
relativ usor din cod

window.analytics.track(eventName, options);

Si avem nevoie undeva global in wordpress sa definim toate eventurile astea.
M-am gandit sa le adaug cate un global selector si sa pun atribute pe el cum ar fi "segment-name=“Click pe butonul roz” segment-location=“Pagina de contact”
si sa le iau asa:

$('[segment-click]').on('click', function () {
    try {
        const options = {};
        const eventName = $(this).attr('segment-click');
        $.each(this.attributes, function (i, attrib) {
            var name = attrib.name;
            var value = attrib.value;

            if (name.includes('segment-') && name !== 'segment-click') {
                const formatName = name.split('-')[1];
                options[formatName] = value;
            }
        });

        window.analytics.track(eventName, options);
    } catch (e) {
        console.log('e', e);
    }
});


Dar e un chin foarte mare sa adaug din builder, poate exista o alta modalitate. Sau m-am gandit daca este un plugin basic de CRUD in care sa am

element, event_name, event_attributes (json, sau multiple fields).
Orice ideea va rog.
Multumesc.

nu e de ajuns sa pui acel cod intr-un fisier .js care e inclus in tot site-ul?

LE: nu stiu daca am inteles bine

Codul oricum il adaug, ii functional, ideea ii unde sa creezi toate eventurile astea sa am o lista intreaga.
Cum ar fi aici


numai ca in cazul meu am multe optiuni pe event