feat: add popups, JivoSite, callback widget, and analytics tracking

This commit is contained in:
2026-04-03 01:19:19 +05:00
parent 49709e8cf8
commit 85aa6ae65e
@@ -177,3 +177,111 @@ add_action( 'generate_before_footer_content', function () {
</div><!-- .custom-footer -->
<?php
}, 5 );
// ---------------------------------------------------------------------------
// 6. Gated content modal (rendered in footer, priority 50)
// ---------------------------------------------------------------------------
add_action( 'wp_footer', function () {
?>
<div id="gated-modal" class="gated-modal">
<div class="gated-modal__overlay"></div>
<div class="gated-modal__content">
<button class="gated-modal__close" aria-label="Закрыть">&times;</button>
<h3>Скачать материал</h3>
<p>Укажите ваши данные для получения доступа к материалу</p>
<!-- CF7 shortcode will be added here after form creation in admin -->
<!-- echo do_shortcode('[contact-form-7 id="XXX" title="Скачать материал"]'); -->
<form class="gated-form" action="#" method="post">
<input type="hidden" name="material-id" value="" />
<input type="text" name="name" placeholder="Имя *" required />
<input type="email" name="email" placeholder="Email *" required />
<label class="demo-form__consent">
<input type="checkbox" required />
Согласен на <a href="/privacy-policy/" target="_blank">обработку персональных данных</a>
</label>
<button type="submit" class="btn btn-primary">Скачать</button>
</form>
</div>
</div>
<?php
}, 50 );
// ---------------------------------------------------------------------------
// 6. Popup Maker — настраивается в админке WP > Popup Maker > Add New
// ---------------------------------------------------------------------------
/**
* Popup Maker — настраивается в админке WP > Popup Maker > Add New:
*
* 1. Попап "Exit-intent — Подписка":
* - Содержимое: подписка на рассылку
* - Триггер: Exit Intent
* - Условия: все страницы
* - Показывать 1 раз за сессию
*
* 2. Попап "Таймер — Демо":
* - Содержимое: предложение демо БИТ.WMS
* - Триггер: Time Delay 60 сек
* - Условия: только страница БИТ.WMS
* - Показывать 1 раз за сессию
*/
// ---------------------------------------------------------------------------
// 7. JivoSite widget (placeholder — подставить реальный widget_id)
// ---------------------------------------------------------------------------
add_action( 'wp_footer', function () {
?>
<!-- JivoSite — подставить реальный widget_id -->
<!-- <script src="//code.jivo.ru/widget/XXXXXXXX" async></script> -->
<?php
}, 99 );
// ---------------------------------------------------------------------------
// 8. Callback widget (placeholder — подставить реальный код виджета)
// ---------------------------------------------------------------------------
add_action( 'wp_footer', function () {
?>
<!-- Callback Widget — подставить реальный код виджета -->
<!-- <script src="https://cdn.callbackhunter.com/XXXXX.js" async></script> -->
<?php
}, 99 );
// ---------------------------------------------------------------------------
// 9. Analytics — Яндекс.Метрика + GA4 (placeholder — подставить реальные ID)
// ---------------------------------------------------------------------------
add_action( 'wp_head', function () {
?>
<!-- Yandex.Metrika — подставить реальный ID счётчика -->
<!--
<script type="text/javascript">
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
m[i].l=1*new Date();
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
ym(XXXXXXXX, "init", {
clickmap:true,
trackLinks:true,
accurateTrackBounce:true,
webvisor:true
});
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/XXXXXXXX" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
-->
<!-- Google Analytics 4 — подставить реальный ID GA4 -->
<!--
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>
-->
<?php
}, 1 );