I'm will try to make my previous question a little more clearer.
So I have to CPA offer from my CPA network using tag.
<script type="text/javascript" src="https://megadownloder.com/script_include.php?id=372715"></script>
and
<script type="text/javascript" src="https://megadownloder.com/script_include.php?id=372716"></script>
Now, I want it to randomly call and choose between the two when the user click the download button.
Example scenario:
When a user clicked download button, the <script type="text/javascript" src="https://megadownloder.com/script_include.php?id=372715"></script> will be called.
When a new user clicked download again the <script type="text/javascript" src="https://megadownloder.com/script_include.php?id=372716"></script> will show.
In ramdom manners.
I hope I make my question clear and you guys can help me. Thank you very much.
Just give your script tag an id and then read the src attribute.
With slice cut of the last character, and add 5 + (0 or 1 random) to the string again.
So the result will be 372715 or 372716 as the id.
If there is no JS active, the src is still valid, but only with this id: 372715
As a side note:
This won't work in your case. The time you manipulate the script src attribute, the script was already loaded. So you should do this on server side.
var dlScr = document.getElementById('dl-script');
dlScr.src = dlScr.src.slice(0, -1) + (5+Math.round(Math.random()));
<script id="dl-script" type="text/javascript" src="https://megadownloder.com/script_include.php?id=372715"></script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With