How to log clicks on certain elements in the system
Task: to make a record in the database of clicks on certain elements in the system.
1. Button layout:
<a href="#" class="as-logger" data-text="11" data-header="2222" data-itemid="3333">Ссылка</a>
2. In the global JS, we create a click handler for the button (we use the mechanism Request JS):
$(document).delegate('.as-logger', 'click', function (e) {
var el = $(this);
if (el.attr('data-prevent') === "1") e.preventDefault();
as.sys.request("web", "logger", {
data: {
text: cont.attr('data-text') || "",
header: cont.attr('data-header') || "",
itemID: cont.attr('data-itemID') || ""
},
onSuccess: function (data) {
// if (data.result && data.data && data.data.length) { }
}
});
});
3.In the SQL procedure for the Request JS mechanism, we process data by click:
create PROCEDURE [dbo].[request_web_logger]
@parameters DictionaryParameter READONLY,
@username nvarchar(32)
AS
BEGIN
declare @text nvarchar(256) = '', @header nvarchar(256) = '', @itemID nvarchar(256) = ''
select @text = Value from @parameters where [Key]='text'
select @header = Value from @parameters where [Key]='header'
select @itemID = Value from @parameters where lower([Key])='itemid'
exec as_trace_warn ('logger', @header, try_cast(@itemID as int), @text, @username)
-- SELECT 1 Msg, Result
select 'OK' Msg, 1 Result
-- SELECT 2 Basic data in the form of an arbitrary table
--select top 10 * from as_trace
-- SELECT 3 External actions
END
This way, the data will be saved in the table as_trace.
Falcon Space is a functional web development platform on a narrow stack MS SQL/Bootstrap. Falcon Space Gettting started
- Management
- Falcon Space Foundation
- Basic components
- Falcon Space Features
- Коммуникация с пользователем
- Дизайн, стилизация
- Integrations
- Каталоги
- Навигация
- Документы
- Additional component
- Продвижение, SEO
- Системные моменты Migrating components between Databases HOWTO. How can I quickly transfer a solution (tables, forms, pages) to another database? HOWTO. Where can I edit the search procedure, the Layout common elements procedure, the periodic launch procedure, and so on? HOWTO. How to do lazy loading for separate image HOWTO. Tracking changes to stored procedures and pages (logChanges) How to organize the periodic sending of an error report to the mail Feedback form for errors, suggestions How to differentiate rights at the level of the business logic of stored procedures Secure data processing and access verification in stored procedures How to enable the system log in the Core version of the platform To increase the size of downloads Using standard markup in the form of snippets for solving various tasks Working with the code editor Logging changes to objects using stored procedures as an example How to log clicks on certain elements in the system Processing old browsers (message about an outdated browser) How to track and limit a large number of similar queries on a site How to change the timeout of DB requests Safety. How to hide some headers (http headers) in requests Logging events in the application (trace) How to improve the performance of IIS (Internet Information Services web server) Windows Server, IIS, How to make the site work from a certain account Displaying a message about offline (No network) Developer's workplace via the terminal FAQ для системного администратора сервера Системный анализ работы сайта на Falcon Space. Профилактика, диагностика работы сайта Обновляемые метки времени в сообщениях на сайте Подсказка по интерфейсам хранимых процедур компонентов Защита от CSRF атак через дополнительный токен в формах Дополнительные параметры в @parameters (во многих хранимых процедурах) Массовая оптимизация картинок в менеджерах ресурсов Как логировать события в Falcon в другую базу (чтобы ограничить рост основной базы данных)
- HOWTO
- HOWTO Tables
- HOWTO Forms
- Working with SQL
- HOWTO JS
- HOWTO Layout
- Solve problems
Falcon Space Platform
This is a reduction in the cost of ownership
at the expense of fewer people to support
This is a quick change
while using the program
This is a modern interface
full adaptation for mobile devices
Note
- Falcon Space Video
- Platform features demo will allow you to understand how this or that component looks and works
- Have a question? Write to the chat at the bottom right