edisonlabs/adobe_analytics
Composer 安装命令:
composer require edisonlabs/adobe_analytics
包简介
Adds Adobe Analytics JavaScript tracking code to your site's pages.
README 文档
README
Adds the Adobe Analytics system to your website.
Requirements
- Token module.
Installation
Install like any other module via Drush or the web administration interface.
Configuration
To enable the environment mode for the Adobe analytics module, add the configuration in settings.php file as:
$config['adobe_analytics'] = [ 'mode' => 'dev/prod', ];
Setting it to dev will fire the development scripts and setting it to prod will fire the production scripts.
To add the scripts, navigate to Administration > Configuration > Adobe Analytics, where the main configuration settings live. These apply to all non-administration pages and support additional conditions based on the role of the user making a request.
If you need to override or extend the settings in a particular entity, then add a field of type Adobe Analytics to the entity bundle. Once you have done that, the edit form of an entity will show an Adobe Analytics section where you can override the global settings.
API
Here is an example of module code that you can use to create variables more suited to tracking your needs by utilizing hook_adobe_analytics_variables(). This code should go in your custom module's .module file and modified accordingly. For illustration purposes we are adding a setting to the adobe_anlaytics administration form to allow site administrators to control whether or not they want to track our custom "referring_search_engine" variable.
Note: Do not forget to rename the functions.
/** * @file */ /** * Implements hook_adobe_analytics_variables(). */ function mymodule_adobe_analytics_variables() { // Initialize a variables array to be returned by this hook. $variables = []; $config_var = \Drupal::config('adobe_anlaytics.settings') ->get('track_search_engine', 0); if ($config_var) { $variables['referring_search_engine'] = 'none'; // Create a list of possible search engines that my site cares about. $search_engines = ['google.com', 'yahoo.com', 'bing.com', 'ask.com']; // Get the referring URL. $referer = $_SERVER['HTTP_REFERER']; // Check the URL to see if the request is coming from a search engine // and if it is, change the value of my "referring_search_engine" variable. foreach ($search_strings as $engine) { if (stripos($referer, $engine) !== FALSE) { $variables['referring_search_engine'] = $engine; break; } } } // Lets assume we need a variable called "date" and that for some reason it // *must* come before all the other variables. Note that if you have a // variable that must come at the end you can use "footer" as well. $header = ['date' => date('Ymd')]; return ['variables' => $variables, 'header' => $header]; } /** * Implements hook_form_FORM_ID_alter(). */ function mymodule_form_adobe_anlaytics_admin_settings_alter(&$form, &$form_state) { $form['general']['adobe_anlaytics_track_search_engine'] = [ '#type' => 'checkbox', '#title' => t('Track the referring search engine for every request'), '#default_value' => \Drupal::config(adobe_anlaytics . settings) ->get('track_search_engine', 0), ]; }
edisonlabs/adobe_analytics 适用场景与选型建议
edisonlabs/adobe_analytics 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.01M 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 09 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 edisonlabs/adobe_analytics 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 edisonlabs/adobe_analytics 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.01M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0
- 更新时间: 2018-09-17