Reply To: Google Client ID

Home Forums Quform WordPress Google Client ID Reply To: Google Client ID

#36558
vsexmogushiy
Participant

Thank you very much. It works.

And one more thing. Tell please how I can add Yclid (step by step):

STEP 1. Go to the Yandex Metrcia — https://yandex.ru/support/metrica/data/get-yclid.html?lang=en#null . Copy and insert example code every page:

<script type="text/javascript">
function setCookie(name, value, days){
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
var expires = "; expires=" + date.toGMTString();
document.cookie = name + "=" + value + expires + ";path=/";
}
function getParam(p){
var match = RegExp('[?&]' + p + '=([^&]*)').exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
var yclid = getParam('yclid');
if(yclid){
setCookie('yclid', yclid, 90);
}
</script>

STEP 2. GET Yclid.

<form action="" name="myForm">
Name: <input type="text" name="name">
<!--Скрытое поле для извлечения yclid-->
<input type="hidden" id="yclid_field" name="yclid_field" value="">
<input type="submit" value="Submit Form" name="btnSubmit">
</form>

<!--Извлечение yclid и изменение скрытого поля-->
<script>
function readCookie(name) {
var n = name + "=";
var cookie = document.cookie.split(';');
for(var i=0;i < cookie.length;i++) {
var c = cookie[i];
while (c.charAt(0)==' '){c = c.substring(1,c.length);}
if (c.indexOf(n) == 0){return c.substring(n.length,c.length);}
}
return null;
}
window.onload = function() {
document.getElementById('yclid_field').value =
readCookie('yclid');
}
</script>

How I can do this correctly?
——————————————————————

And if you have the opportunity to tell me how to find out how to insert a Google Client ID into the form, as well as tell me how to set the UTM parameters (campaign, source, term and other) correctly in a separate field. I will be extremely grateful to you.

Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy