Skip to content

Instantly share code, notes, and snippets.

@dvygolov
Created January 9, 2019 18:12
Show Gist options
  • Save dvygolov/fec765bbc695a07c0e46c90de30fc28c to your computer and use it in GitHub Desktop.
Save dvygolov/fec765bbc695a07c0e46c90de30fc28c to your computer and use it in GitHub Desktop.
Код для А/Б тестирования объявлений и лендингов в CPA в Facebook
Вот поля, которые надо добавить ВНУТРИ тега form:
<input type="hidden" name="sub1" value="">
<input type="hidden" name="sub2" value="ID_ВАШЕГО_ЛЕНДА">
И скрипт, который надо добавить ПОСЛЕ закрывающегося тега </form>:
<script>
const urlParams = new URLSearchParams(window.location.search);
if(urlParams.has('utm_content')){
var utmContent=urlParams.get('utm_content');
document.getElementsByName('sub1')[0].value=utmContent;
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment