lokalnyi / loki
PHP SDK,用于增强转化率和适应用户在网页上的活动。
dev-main
2023-12-05 16:36 UTC
Requires
- php: ^7.4 || ^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.2
- illuminate/http: ^8.83
- illuminate/support: ^8.83
- illuminate/validation: ^8.83
- mobiledetect/mobiledetectlib: ^3.74
- nesbot/carbon: ^2.71
- predis/predis: ^2.1
Requires (Dev)
- phpunit/phpunit: ^9.3
This package is auto-updated.
Last update: 2024-09-05 18:23:23 UTC
README
这项技术作为增强网页用户体验的强大工具,允许网站适应个别用户及其需求。技术的关键组件
Page Blocks: Each page contains a certain number of blocks, with each block having three versions.
Analytical Part: Gathers information about users visiting the page:
- User's device type.
- Browser used.
- User's origin.
- Time spent on a particular block.
- Number of clicks/taps on a block.
A/B Testing: The first 200 users are provided with a random distribution of blocks to determine user reactions to different versions of blocks.
Heuristic Algorithm: After analyzing the behavior of the first 200 users, the algorithm creates a "snapshot" of the page best suited to a particular type of user. From 200 to 500 users.
Behavioral Algorithm: From 500 to 2000 users.
Neural Network: From 2000 users onwards.
此启发式算法是针对网站内容块的适应性显示开发的。
考虑到用户的个人特征。
其主要阶段
User Analysis: When a user visits the site, the algorithm collects information about their location and "user agent" (technical information about the browser and user device).
Data Filtering: Based on the collected "user agent", the algorithm searches for similar users in the database and selects those records that most closely match the current user.
Block Analysis: The algorithm then analyzes which blocks and their versions most frequently interacted with similar users.
Blocks Reformatting: After analyzing the blocks, the algorithm filters and sorts them. Content deemed unnecessary or less relevant is filtered out. The blocks are then sorted so that the user sees the most relevant and interesting content.
Content Display: The user receives a web page with sorted content blocks, optimized specifically for them based on the analysis of their location and device.
技术的优势
Increased Conversion: Thanks to the individual approach to each user, conversion can double.
Optimized Site Engagement Time: Adaptive content can encourage the user to spend more time on the site, enhancing their engagement.
用法
要使用此库,您需要遵循以下步骤
-
包含用户行为分析的JavaScript脚本:
脚本位于assets/js/*
文件夹中。有三种版本的脚本:纯JavaScript、Vue.js和jQuery。根据您的需求,您可以使用任何一种。 -
从两个方面收集统计数据:
- 当用户进行转化时收集数据。
- 当用户仅仅访问您的资源时收集分析数据。以下是使用LokiHandler的示例
use Loki\LokiHandler; // For posting statistics LokiHandler::postStatistic($params); // For posting analytic statistics LokiHandler::postAnalyticStatistic($params);
您可以在tests/LokiTest::testPostStatistic中找到正确的$ params验证示例。
- 每天向主服务器发送一次统计信息:
您可以根据您的调度器进行配置。使用前一种方法时,数据会自动保存。然后,从session.json中保存的数据被发送以进行处理use Loki\LokiHandler; LokiHandler::sendStatistic();
- 检索您的网络资源的聚合数据:
您需要发出请求以获取页面块use Loki\LokiHandler; LokiHandler::getPageBlocks($params);
验证数据的示例可以在tests/LokiTest::testGetPageBlocks中看到,您也可以在那里找到示例响应。
注意:如果您有任何问题或建议,请随时通过ggommenn@gmail.com与我们联系。