Skip to content

Instantly share code, notes, and snippets.

@Shoora
Shoora / common.js
Created Nov 2, 2020 — forked from mysmartapps/common.js
jQuery AJAX form
View common.js
function AjaxFormRequest (result_id, formMain, url) {
jQuery.ajax({
url: url,
type: "POST",
dataType: "html",
data: jQuery("#"+formMain).serialize(),
success: function(response) {
document.getElementById(result_id).innerHTML = response;
yaCounterXXXX.reachGoal('Goal Name');
if ( document.getElementById(result_id).innerHTML == "<p>Cообщение успешно отправлено. Пожалуйста, оставайтесь на связи</p>" ) {
@Shoora
Shoora / 60_sec_plug_activity_js.js
Last active Nov 2, 2020
60_sec_plug_activity_js
View 60_sec_plug_activity_js.js
/**
* @name jQuery plugin Activity
* @version 1.3a
* @author vs.ustinov
* @author an.nidziy
* @author gr.tsvetkov
* @license GNU Free Documentation License
* @copyright 2013 ООО «АйТи-агентство»
* @link http://www.it-agency.ru/process/60seconds
* @uses jQuery 1.7+
@Shoora
Shoora / genious.js
Created Nov 2, 2020 — forked from Piterden/genious.js
Not null implementation
View genious.js
var onloadCallback = function() {
grecaptcha.render("g-recaptcha", {
sitekey: "6Le2hsIUAAAAAGb1mcRlZ-W1Tdc0atbw002G5UUL",
theme: "light",
callback: "checkReCapture",
"expired-callback": "expiredReCapture"
})
};
function checkReCapture() {
return "" != grecaptcha.getResponse() ? ($("#recaptchaError").text(""),
View E-commerce - Покупка в один клик
<script>
try{
//window.dataLayer = window.dataLayer || [];
dataLayer.push({
'ecommerce': {
'purchase': {
'actionField': {
'id': $('.modal-container').text().match(/\d+/g)[0]*1, // Transaction ID. Required for purchases and refunds.
'revenue': currentPrice * productQuantity, // Total transaction value (incl. tax and shipping)
},
View track_event.js
function submit_track_event(event){
if (yaCounter) {
yaCounter.reachGoal(event);
}
if (ga) {
ga('send','event','submit',event);
}
}
@Shoora
Shoora / tilda yandex goal js
Created Nov 2, 2020 — forked from grvoyt/tilda yandex goal js
название цели ставится у формы тут http://prntscr.com/o3rsk9 . А в яндекс метрике событие jsvsscript
View tilda yandex goal js
$(document).ready(function() {
window.myAfterSendedFunction = function($form){
//id yandex метрики
var metrikID = 99999999;
var goal = $form.find('[name=tildaspec-formname]').val();
var res = window['yaCounter'+metrikID].reachGoal(goal);
console.log(yaCounter51697628, res)
return true;
}
View 404 yandexMetrika
window.onload = function () {
yaCounter32108701.reachGoal('page404');
}
View goals.js
function reachYandexGoal(goal){
try{
ym(9999999, 'reachGoal', goal); //new
//yaCounter9999999.reachGoal(goal); //old
}catch(ex){
console.error("Счетчик не найден. \n" + ex);
}
return true;
}
View script.js
/**
* Цели метрики
* Область видимости функции должна быть ГЛОБАЛЬНОЙ
*/
slTarget=function (targetName) {
if(Ya===undefined) {console.error('Не найден счетчик метрики'); return false;}
var counterID=Ya.Metrika2.counters()[0].id;
ym(counterID, 'reachGoal',targetName);
console.info('Событие: '+targetName);
@Shoora
Shoora / universal geo button 2 mobile
Created Nov 2, 2020 — forked from cave2006/universal geo button 2 mobile
Код для вставки универсального кода в кнопки на мобильном
View universal geo button 2 mobile
// Находим и записываем координаты обекта
55.002707° 82.975013°
// addition js
<script>
if(navigator.vendor != null && navigator.vendor.match(/Apple Computer, Inc./) && navigator.userAgent.match(/iPhone/i) || (navigator.userAgent.match(/iPod/i)))
{
document.querySelector('.geo').style.display = 'none';
}
else if (navigator.vendor != null && navigator.vendor.match(/Apple Computer, Inc./) && navigator.userAgent.match(/iPad/i))