Answer the question
In order to leave comments, you need to log in
How to resolve Rails 5 turbolinks and document.write() conflict?
There is a Rails 5 project with turbolinks enabled.
You need to insert the pixel code for analytics on the pages. Pixel source code:
<script type='text/javascript'>
var binom_link='http://tracker.domain/click.php?camp_id=xxx&key=zzzzzzzzzzzzzzzzz';
document.write('<img src="'+binom_link+'&lp_type=pixel&'+window.location.search.substring(1)+'" style="display:none"/>');
</script>
Answer the question
In order to leave comments, you need to log in
var binom_link='http://tracker.domain/click.php?camp_id=xxx&key=zzzzzzzzzzzzzzzzz';
document.body.innerHTML += '<img src="'+binom_link+'&lp_type=pixel&'+window.location.search.substring(1)+'" style="display:none"/>'
// или
var img = document.sreateElement('img')
img.src = binom_link+'&lp_type=pixel&'+window.location.search.substring(1)
document.body.appendChild(img)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question