Skip to content

Instantly share code, notes, and snippets.

@faizanayubi
Created May 21, 2017 06:23
Show Gist options
  • Save faizanayubi/ff2677f79b6248cd0527fb5854aeed5e to your computer and use it in GitHub Desktop.
Save faizanayubi/ff2677f79b6248cd0527fb5854aeed5e to your computer and use it in GitHub Desktop.
Track Multiple Conversions from different traffic
$(document.body).on("click", ".product-btn, .btn-buy", function (e) {
e.preventDefault();
var lnk = $(this).attr('href');console.log(lnk);
var l = document.createElement("a"); l.href = lnk;
var src = 'https://track.vnative.com/pixel?adid=5920681cb6920d372064e102&sub2=' + encodeURIComponent(window.location.pathname) + '&sub3=' + encodeURIComponent(document.title) + '&sub1=' + encodeURIComponent(l.hostname) + '&txn_id=RANDOM';
var body = document.getElementsByTagName('body')[0], img = document.createElement('img');
img.style.width = '1px';img.style.height = '1px';img.style.display = 'none';img.src = src; body.appendChild(img);
var win = window.open(lnk, '_blank');
win.focus();
});
@faizanayubi
Copy link
Author

Don't forget to replace the adid(5920681cb6920d372064e102) with your own adid from vNative Panel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment