A
A
alex1nd2021-06-06 13:30:20
PHP
alex1nd, 2021-06-06 13:30:20

Client id google + bitrix24 does not reach everyone - how to fix it?

configured client id google + output to Bitrix 24
It comes to me normally from all forms
Half of the people don’t get it (many don’t get it)

the problem is probably in js that displays the client id in the input field, since most likely 99% with sending to cpm there are no problems for sure, while the Yandex client id always comes to all people normally

<!--YA CLID-->
<input type="hidden" id="clientID" name="ClientID" value="*************">
<input type="hidden" id="clientID2" name="ClientID" value="*************">
<input type="hidden" id="clientID3" name="ClientID" value="*************">
<input type="hidden" id="clientID4" name="ClientID" value="*************">
<!--GA CLID-->
<input type="hidden" id="clientId" name="clientId" value="*************">
<input type="hidden" id="clientId2" name="clientId" value="*************">
<input type="hidden" id="clientId3" name="clientId" value="*************">
<input type="hidden" id="clientId4" name="clientId" value="*************">


-------------------------------------------------- ------------

spoiler
<script>
ym(*******, 'getClientID', function(clientID) {
document.getElementById('clientID').value = clientID;
});
</script>
<script>
ym(*******, 'getClientID', function(clientID) {
document.getElementById('clientID2').value = clientID;
});
</script>
<script>
ym(*******, 'getClientID', function(clientID) {
document.getElementById('clientID3').value = clientID;
});
</script>
<script>
ym(*******, 'getClientID', function(clientID) {
document.getElementById('clientID4').value = clientID;
});
</script>

<script>
var match = document.cookie.match('(?:^|;)\\s*_ga=([^;]*)');
var raw = (match) ? decodeURIComponent(match[1]) : null;
if (raw){
match = raw.match(/(\d+\.\d+)$/);
}
var gacid = (match) ? match[1] : null;
if (gacid) {
document.getElementById('clientId').value = gacid;
}
</script>
<script>
var match = document.cookie.match('(?:^|;)\\s*_ga=([^;]*)');
var raw = (match) ? decodeURIComponent(match[1]) : null;
if (raw){
match = raw.match(/(\d+\.\d+)$/);
}
var gacid = (match) ? match[1] : null;
if (gacid) {
document.getElementById('clientId2').value = gacid;
}
</script>
<script>
var match = document.cookie.match('(?:^|;)\\s*_ga=([^;]*)');
var raw = (match) ? decodeURIComponent(match[1]) : null;
if (raw){
match = raw.match(/(\d+\.\d+)$/);
}
var gacid = (match) ? match[1] : null;
if (gacid) {
document.getElementById('clientId3').value = gacid;
}
</script>
<script>
var match = document.cookie.match('(?:^|;)\\s*_ga=([^;]*)');
var raw = (match) ? decodeURIComponent(match[1]) : null;
if (raw){
match = raw.match(/(\d+\.\d+)$/);
}
var gacid = (match) ? match[1] : null;
if (gacid) {
document.getElementById('clientId4').value = gacid;
}
</script>


-------------------------------------------------

output to the Bitrix fields

spoiler
<script>
jQuery(document).ready(function($) {
  $('input#form_zvonok').click(function() {
    name1 = $("input.input-xlarge").val();
    phone1 = $("#phone").val();
    clientID = $("#clientID4").val();
    clientId = $("#clientId4").val();
    var title1 = document.title;
    if (name1 == '' || phone1 == '') {
      return false;
    }
    $.ajax({
    type: 'POST',
    url: 'https://donjurist.ru/******************',
    data: 'name='+name1+'&phone='+phone1+'&title='+title1+'&clientID='+clientID+'&clientId='+clientId,
    success: function(html){
      console.log(html);
    }
    });
  });
});
</script>

<script>
jQuery(document).ready(function($) {
  $('#form1 .btn').click(function() {
    name = $("#exampleInputEmail1").val();
    phone = $("#exampleInputPassword1").val();
    clientID = $("#clientID2").val();
    clientId = $("#clientId2").val();
    var title = document.title;
    if (name == 'undefined' || phone == 'undefined') {
    name = $("#form1 #exampleInputEmail2").val();
    phone = $("#exampleInputPassword22").val();
    }
    if (name == '' || phone == '') {
      return false;
    }
    $.ajax({
    type: 'POST',
    url: 'https://donjurist.ru/******************',
    data: 'name='+name+'&phone='+phone+'&title='+title+'&clientID='+clientID+'&clientId='+clientId,
    success: function(html){
      console.log(html);
    }
    });
  });
});
</script>

<script>
jQuery(document).ready(function($) {
  $('#form5 .btn').click(function() {
    name3 = $("#exampleInputEmail2").val();
    phone3 = $("#exampleInputPassword2").val();
    clientID = $("#clientID").val();
    clientId = $("#clientId").val();
    var title3 = document.title;
    if (name3 == '' || phone3 == '') {
      return false;
    }
    $.ajax({
    type: 'POST',
    url: 'https://donjurist.ru/******************',
    data: 'name='+name3+'&phone='+phone3+'&title='+title3+'&clientID='+clientID+'&clientId='+clientId,
    success: function(html){
      console.log(html);
    }
    });
  });
});
</script>

<script>
jQuery(document).ready(function($) {
  $('#form2 .btn').click(function() {
    name3 = $("#form2 #exampleInputEmail1").val();
    phone3 = $("#form2 #exampleInputPassword1").val();
    clientID = $("#clientID3").val();
    clientId = $("#clientId3").val();
    var title3 = document.title;
    if (name3 == '' || phone3 == '') {
      return false;
    }
    $.ajax({
    type: 'POST',
    url: 'https://donjurist.ru/bitrixhook.php',
    data: 'name='+name3+'&phone='+phone3+'&title='+title3+'&clientID='+clientID+'&clientId='+clientId,
    success: function(html){
      console.log(html);
    }
    });
  });
});
</script>


Hook passing

$name = $_REQUEST['name'];
$phone = $_REQUEST['phone'];
$clientID = $_REQUEST['clientID'];
$clientId = $_REQUEST['clientId'];

$title = $_REQUEST['title'];
if(!validName($name) || !validPhone($phone)){
die();
}
echo $title;
echo "<br>";
echo $name;
echo "<br>";
echo $phone;
echo "<br>";
echo $clientID;
echo "<br>";
echo $clientId;
// формируем URL в переменной $queryUrl
$queryUrl = '***************************************************************';
// формируем параметры для создания лида в переменной $queryData
$queryData = http_build_query(array(
'fields' => array(
'TITLE' => $title,
'NAME' => $name,
'PHONE' => Array(
"n0" => Array(
"VALUE" => $phone,
"VALUE_TYPE" => "MOBILE",
),
),
'SOURCE_ID' => 'CALL',
'UF_CRM_1622554831752' => $clientID,
'UF_CRM_1622623204366' => $clientId,
),
'params' => array("REGISTER_SONET_EVENT" => "Y")
));
// обращаемся к Битрикс24 при помощи функции curl_exec
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $queryUrl,
CURLOPT_POSTFIELDS => $queryData,
));
$result = curl_exec($curl);
curl_close($curl);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SVladimir84, 2022-02-18
@SVladimir84

I have a similar problem, only I get metrics every other time, and to the mail, and not to crm.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question