Afisare numar de telefon in functie de sursa de trafic¶
Definire numere de telefon
$track_phones = array(
'facebook' => '021.539.22.02',
'google' => '021.539.22.04',
'adwords' => '021.539.22.05',
'shopmania' => '021.539.22.06',
'profitshare' => '021.539.22.07',
'newsletter' => '021.539.22.08',
'google_places' => '021.539.22.10'
);
$smarty->assignByRef('track_phones', $track_phones);
$track_phones = array(
'facebook' => '021.539.22.02',
'google' => '021.539.22.04',
'adwords' => '021.539.22.05',
'shopmania' => '021.539.22.06',
'profitshare' => '021.539.22.07',
'newsletter' => '021.539.22.08',
'google_places' => '021.539.22.10'
);
$smarty->assignByRef('track_phones', $track_phones);
Setare cookie referral
# set refferal cookie
$ref = null;
# se pastreaza first referral exceptie facand adwords si referreri trimisi pe GET unde se pastreaza last referral
# confirm-online-order = epayment. ignoram ref
if ((!isset($_COOKIE['ref']) && isset($_SERVER['HTTP_REFERER'])) || (isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'], '2parale') !== false) || (isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'], 'profitshare') !== false) || (!empty($_GET['ref']) && ((isset($_GET['sa']) && $_GET['sa'] != 'confirm-online-order') || !isset($_GET['sa']))) || !empty($_GET['gclid']) || (!empty($_GET['utm_source']) && empty($_GET['utm_nooverride']))) {
if (!empty($_GET['ref']) && ((isset($_GET['sa']) && $_GET['sa'] != 'confirm-online-order') || !isset($_GET['sa']))) {
$ref = $_GET['ref'];
}
elseif (!empty($_GET['gclid'])) {
$ref = 'adwords';
}
elseif (!empty($_GET['utm_source']) && empty($_GET['utm_nooverride'])) {
$ref = $_GET['utm_source'];
}
elseif (!empty($_SERVER['HTTP_REFERER']) && strlen($_SERVER['HTTP_REFERER']) > 7) {
$buf = parse_url($_SERVER['HTTP_REFERER']);
if (!empty($buf['host']) && stripos(STORE_LINK, $buf['host']) === false) {
$ref = $buf['host'];
}
unset($buf);
}
if (!empty($ref)) {
$ref = cleanReferral($ref);
SetMyCookie('ref', htmlentities($ref), time() + 86400*30); # 30 zile
}
}
elseif (isset($_COOKIE['ref'])) {
$ref = cleanReferral($_COOKIE['ref']);
}
# choose what phone to display
if (!empty($ref) && !empty($track_phones)) {
$smarty->assign('custom_phone', customPhone($ref));
}
# assign referral variable, can be used for other trackers
$smarty->assignByRef('ref', $ref);
# set refferal cookie
$ref = null;
# se pastreaza first referral exceptie facand adwords si referreri trimisi pe GET unde se pastreaza last referral
# confirm-online-order = epayment. ignoram ref
if ((!isset($_COOKIE['ref']) && isset($_SERVER['HTTP_REFERER'])) || (isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'], '2parale') !== false) || (isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'], 'profitshare') !== false) || (!empty($_GET['ref']) && ((isset($_GET['sa']) && $_GET['sa'] != 'confirm-online-order') || !isset($_GET['sa']))) || !empty($_GET['gclid']) || (!empty($_GET['utm_source']) && empty($_GET['utm_nooverride']))) {
if (!empty($_GET['ref']) && ((isset($_GET['sa']) && $_GET['sa'] != 'confirm-online-order') || !isset($_GET['sa']))) {
$ref = $_GET['ref'];
}
elseif (!empty($_GET['gclid'])) {
$ref = 'adwords';
}
elseif (!empty($_GET['utm_source']) && empty($_GET['utm_nooverride'])) {
$ref = $_GET['utm_source'];
}
elseif (!empty($_SERVER['HTTP_REFERER']) && strlen($_SERVER['HTTP_REFERER']) > 7) {
$buf = parse_url($_SERVER['HTTP_REFERER']);
if (!empty($buf['host']) && stripos(STORE_LINK, $buf['host']) === false) {
$ref = $buf['host'];
}
unset($buf);
}
if (!empty($ref)) {
$ref = cleanReferral($ref);
SetMyCookie('ref', htmlentities($ref), time() + 86400*30); # 30 zile
}
}
elseif (isset($_COOKIE['ref'])) {
$ref = cleanReferral($_COOKIE['ref']);
}
# choose what phone to display
if (!empty($ref) && !empty($track_phones)) {
$smarty->assign('custom_phone', customPhone($ref));
}
# assign referral variable, can be used for other trackers
$smarty->assignByRef('ref', $ref);
Afisare numar telefon in frontend
<a href="tel:{if $custom_phone}{$custom_phone|clean_telephone}{else}{$smarty.const.SALES_TELEPHONE1|clean_telephone}{/if}"{if $show_external_scripts} onclick="ga('send', 'event', 'UX', 'PhoneClick', '{if $custom_phone}{$custom_phone|clean_telephone}{else}{$smarty.const.SALES_TELEPHONE1|clean_telephone}{/if}', { 'nonInteraction': 1 });"{/if}>
<i class="fa fa-phone"></i>
{if $custom_phone}{$custom_phone}{else}{$smarty.const.SALES_TELEPHONE1}{/if}
</a>
<a href="tel:{if $custom_phone}{$custom_phone|clean_telephone}{else}{$smarty.const.SALES_TELEPHONE1|clean_telephone}{/if}"{if $show_external_scripts} onclick="ga('send', 'event', 'UX', 'PhoneClick', '{if $custom_phone}{$custom_phone|clean_telephone}{else}{$smarty.const.SALES_TELEPHONE1|clean_telephone}{/if}', { 'nonInteraction': 1 });"{/if}>
<i class="fa fa-phone"></i>
{if $custom_phone}{$custom_phone}{else}{$smarty.const.SALES_TELEPHONE1}{/if}
</a>
Go to top