M
M
Mishcake2021-07-15 10:56:21
JavaScript
Mishcake, 2021-07-15 10:56:21

How to add attributes to a link that is specified in a script?

Hello.

The site has a button that is tracked by the following script:

$( '#button6626369' ).click( function(e) {
    //disableButton(e);
    window.open('https://ya.ru')}
);

This ID is generated each time the page is refreshed.

If there are utm tags in the address bar, I need to pass these tags to the address of the page that will open on click. I can pull the labels from the address bar and save them to a variable. But how to substitute them into this script, provided that I do not have access to editing this script?

That is, this piece of code above is generated on the fly without me (the page on the landing designer). Is it possible to find this link using a separate code of my own and add ?utm_source=SOURCE to it if utm_source is not empty?..

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question