Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Help 

Print Javascript in img src

Hi,

I'm working on a tracking mechanism to a affiliate script and need a unique ID in my src.

I have the following code:

Code
<script type="text/javascript">
    function uuidv() {
  return 'xxxxxxxx-xxxx-xxxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
    var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
    return v.toString(16);
  });
}

document.write(uuidv());
</script>

<img src="https://www.partner-ads.com/dk/leadtrack.php?programid=xxxx&type=lead&uiv=VAR HERE" width=0 height=0 style="display:none">

I need the uuidv()) function to be inserted into the src where it says VAR HERE - How the f... do i do that?
Your free online strength/weightloss and mental coach.

Hit me up for free advices.
Do you have access to the js on the same page??
I think you need to use onclick and change the src and add UUID
(Feb 15, 2019 07:56 AM)I337 Wrote:  Do you have access to the js on the same page??
I think you need to use onclick and change the src and add UUID

I don't think onclick is an option.

The script is going to be on a "succes page" from when you're signing up for a newsletter.
Your free online strength/weightloss and mental coach.

Hit me up for free advices.
(Feb 15, 2019 08:14 AM)Grey Goose Wrote:  I don't think onclick is an option.

The script is going to be on a "succes page" from when you're signing up for a newsletter.

I think it would be better to generate the ids server side or there will be duplicates.

Possible Solution without server side checking:
Code
<img id="partner-ads" src="" width=0 height=0 style="display:none">
<script type="text/javascript">
    var programid = "";
    var uuid = "";
    function uuidv() {
        return 'xxxxxxxx-xxxx-xxxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
            var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
            return v.toString(16);
        });
    }
    uuid = uuidv();
    document.getElementById("partner-ads").src = `https://www.partner-ads.com/dk/leadtrack.php?programid=${programid}&type=lead&uiv=${uuid}`;
</script>


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Source] by Emre_Apr 21, 2024 11:15 AM 0 63 Apr 21, 2024 11:15 AM
Last Post: Emre_
[Source] by Emre_Apr 21, 2024 11:07 AM 0 99 Apr 21, 2024 11:07 AM
Last Post: Emre_
by X-LITDec 13, 2022 06:33 AM 4 149 Dec 13, 2022 06:33 AM
Last Post: Hackers