Answer the question
In order to leave comments, you need to log in
How to add utm tags to a deal?
Good day.
On the Amocrm service.
It is necessary to make sure that when sending an application, utm tags are also sent. I searched the internet and found these codes. But when I inserted them into my code, deals were not created at all. How can it be corrected or supplemented?
'source_data' => array(
array(
'id' => 'ID',
'values' => array(
array(
'value' => $utm_source,
)
)
),
);
if (!empty($utm_source)) {
$request["add"][0]["custom_fields"][] = array(
"id" => 16533, // source
"values" => array(
array(
"value" => $utm_source
)
)
);
unset($utm_source);
}
foreach($custom_fields_leads as $field){
if($field['name']=='Источник трафика' && $utm_source != '')
$add['request']['leads']['add'][0]['custom_fields'][]=array('id'=>$field['id'],'values'=>array(array('value'=>$utm_source)));
if($field['name']=='Тип трафика' && $utm_medium != '')
$add['request']['leads']['add'][0]['custom_fields'][]=array('id'=>$field['id'],'values'=>array(array('value'=>$utm_medium)));
if($field['name']=='Название рекламной кампании' && $utm_campaign != '')
$add['request']['leads']['add'][0]['custom_fields'][]=array('id'=>$field['id'],'values'=>array(array('value'=>$utm_campaign)));
if($field['name']=='Ключевое слово кампании' && $utm_term != '')
$add['request']['leads']['add'][0]['custom_fields'][]=array('id'=>$field['id'],'values'=>array(array('value'=>$utm_term)));
}
Answer the question
In order to leave comments, you need to log in
https://github.com/dotzero/amocrm-php
Use this solution, there is such an option
We save the tags in cookies on the first visit
. Then we pass them to the fields via custom_fields
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question