diff --git a/README.md b/README.md index 6921208479..89a7cffce2 100644 --- a/README.md +++ b/README.md @@ -212,5 +212,3 @@ there is information on handling draft in CRUD operations for rdf entities. there is information on how to handle notifications in Joinup. * In [Joinup core module](web/modules/custom/joinup_core/README.md) there is information on how to handle and create workflows. -* In [Matomo analytics](docs/matomo.md) you find information about working with -the web analytics platform used in Joinup. diff --git a/build.matomo.xml b/build.matomo.xml index fe9f4f147f..6f3912624a 100644 --- a/build.matomo.xml +++ b/build.matomo.xml @@ -1,87 +1,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -91,65 +10,14 @@ - - - - + text="$config['matomo.settings']['site_id'] = '${matomo.website_id}';${line.separator}$config['matomo.settings']['url_http'] = '${matomo.url.http}';${line.separator}$config['matomo.settings']['url_https'] = '${matomo.url.https}';${line.separator}$config['matomo_reporting_api.settings']['token_auth'] = '${matomo.token}';${line.separator}$config['oe_webtools_analytics.settings']['siteID'] = '${webtools_analytics.site_id}';${line.separator}$config['oe_webtools_analytics.settings']['sitePath'] = '${webtools_analytics.site_path}';${line.separator}$config['oe_webtools_analytics.settings']['instance'] = '${webtools_analytics.instance}';${line.separator}" /> - - - - - - - - - - - - - - - - diff --git a/build.properties b/build.properties index 59d9a3913e..1676cc2e2f 100644 --- a/build.properties +++ b/build.properties @@ -280,24 +280,8 @@ migration.mock_filesystem = TRUE # migration.acceptance = 1 -# Matomo configuration -# ------------------- - -# Installation path. -matomo.dir = ${project.basedir}/vendor/matomo-org/matomo - -# Git repository. -matomo.repo = https://github.com/libresh/compose-matomo.git -matomo.branch = master - -# Configuration file. -matomo.config = docker-compose.yml - -# Credentials. -matomo.db.password = ${drupal.db.password} - -# Port to use. Matomo will be available on http://localhost:{port} -matomo.port = 8000 +# Analytics configuration +# ----------------------- # Website ID. This can be seen in the Matomo UI, at Administration > Websites > # Manage. @@ -305,7 +289,7 @@ matomo.website_id = 1 # Optional HTTP URL to the Matomo server. Only intended for development # environments. -matomo.url.http = http://localhost:${matomo.port}/ +matomo.url.http = # Optional HTTPS URL to the Matomo server. Intended for production environments. matomo.url.https = @@ -314,6 +298,21 @@ matomo.url.https = # Administration > Platform > API > User authentication. matomo.token = 0123456789abcdef0123456789abcdef +# The site ID to use with Webtools Analytics. +webtools_analytics.site_id = ${matomo.website_id} + +# The site path to use with Webtools Analytics. This defaults to the user +# acceptance environment so that we will not accidentally pollute our analytics +# data when running Joinup on an environment that doesn't properly override +# these properties. +webtools_analytics.site_path = joinup.uat.fpfis.tech.ec.europa.eu + +# The Webtools Analytics server instance to use. This defaults to the test +# environment so that we will not accidentally pollute our analytics data when +# running Joinup on an environment that doesn't properly override these +# properties. +webtools_analytics.instance = testing + # Redis configuration # ------------------- diff --git a/composer.json b/composer.json index 403ce7fbbc..02a9eba946 100644 --- a/composer.json +++ b/composer.json @@ -76,6 +76,7 @@ "jacklmoore/autosize": "dev-master", "masterminds/html5": "^2.6", "ml/json-ld": "^1.0", + "openeuropa/oe_webtools": "~1.0", "openeuropa/oe_webtools_location": "dev-master", "pear/console_table": "~1.3", "phing/phing": "^2.15.0", @@ -269,6 +270,9 @@ }, "masterminds/html5": { "Apply default UTF-8 encoding @see https://github.com/Masterminds/html5-php/pull/168": "https://patch-diff.githubusercontent.com/raw/Masterminds/html5-php/pull/168.patch" + }, + "openeuropa/oe_webtools": { + "Include the smartloader on pages where analytics are used.": "https://patch-diff.githubusercontent.com/raw/openeuropa/oe_webtools/pull/71.patch" } } }, @@ -281,6 +285,18 @@ "type": "vcs", "url": "https://github.com/ec-europa/spdx.git" }, + { + "type": "package", + "package": { + "name": "spdx/license-list-data", + "version": "master", + "source": { + "url": "https://github.com/spdx/license-list-data", + "type": "git", + "reference": "master" + } + } + }, { "type": "vcs", "url": "https://github.com/ec-europa/rdf_entity.git" diff --git a/composer.lock b/composer.lock index 705f8b6553..abcc0ae232 100644 --- a/composer.lock +++ b/composer.lock @@ -4659,7 +4659,7 @@ }, "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0+" + "GPL-2.0-or-later" ], "authors": [ { @@ -4678,7 +4678,7 @@ "description": "Simple migrate drush commands: run, generate.", "homepage": "https://www.drupal.org/project/migrate_drush", "support": { - "source": "http://cgit.drupalcode.org/migrate_drush" + "source": "https://git.drupalcode.org/project/migrate_drush" } }, { @@ -5371,8 +5371,8 @@ "dev-1.x": "1.x-dev" }, "drupal": { - "version": "8.x-1.x-dev", - "datestamp": "1486527783", + "version": "8.x-1.1-beta1+0-dev", + "datestamp": "1532080685", "security-coverage": { "status": "not-covered", "message": "Dev releases are not covered by Drupal security advisories." @@ -5381,13 +5381,17 @@ }, "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0+" + "GPL-2.0-or-later" ], "authors": [ { "name": "Bevan", "homepage": "https://www.drupal.org/user/49989" }, + { + "name": "Nixou", + "homepage": "https://www.drupal.org/user/2304734" + }, { "name": "RobLoach", "homepage": "https://www.drupal.org/user/61114" @@ -5424,7 +5428,7 @@ "description": "Redirect anonymous users from 403 Access Denied pages to the /user/login page.", "homepage": "https://www.drupal.org/project/r4032login", "support": { - "source": "http://cgit.drupalcode.org/r4032login" + "source": "https://git.drupalcode.org/project/r4032login" }, "time": "2017-02-08T04:20:19+00:00" }, @@ -6146,7 +6150,7 @@ "description": "Provides code-driven workflow functionality.", "homepage": "https://www.drupal.org/project/state_machine", "support": { - "source": "http://cgit.drupalcode.org/state_machine" + "source": "https://git.drupalcode.org/project/state_machine" } }, { @@ -6197,7 +6201,7 @@ "description": "Provides support for extending sub-paths of URL aliases.", "homepage": "https://www.drupal.org/project/subpathauto", "support": { - "source": "http://cgit.drupalcode.org/subpathauto" + "source": "https://git.drupalcode.org/project/subpathauto" } }, { @@ -6426,7 +6430,7 @@ }, "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0+" + "GPL-2.0-or-later" ], "authors": [ { @@ -6449,7 +6453,7 @@ "description": "Select which roles should be able to see unpublished nodes.", "homepage": "https://www.drupal.org/project/view_unpublished", "support": { - "source": "http://cgit.drupalcode.org/view_unpublished" + "source": "https://git.drupalcode.org/project/view_unpublished" } }, { @@ -8266,6 +8270,74 @@ ], "time": "2019-05-25T20:07:01+00:00" }, + { + "name": "openeuropa/oe_webtools", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/openeuropa/oe_webtools.git", + "reference": "eab913a181326b73b4234930970ceec91b7063e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/openeuropa/oe_webtools/zipball/eab913a181326b73b4234930970ceec91b7063e1", + "reference": "eab913a181326b73b4234930970ceec91b7063e1", + "shasum": "" + }, + "require": { + "drupal/core": "^8.7", + "ext-json": "*", + "php": "^7.1" + }, + "require-dev": { + "composer/installers": "~1.5", + "drupal-composer/drupal-scaffold": "^2.5.2", + "drupal/config_devel": "~1.2", + "drupal/drupal-extension": "^4.0", + "drush/drush": "~9.0", + "nikic/php-parser": "^3.1.5", + "openeuropa/behat-transformation-context": "~0.1", + "openeuropa/code-review": "~1.0@beta", + "openeuropa/drupal-core-require-dev": "^8.7", + "openeuropa/oe_media": "~0.4", + "openeuropa/task-runner": "~1.0.0-beta5", + "phpunit/phpunit": "~6.0", + "symfony/dom-crawler": "~3.0" + }, + "type": "drupal-module", + "extra": { + "composer-exit-on-patch-failure": true, + "enable-patching": true, + "installer-paths": { + "build/core": [ + "type:drupal-core" + ], + "build/profiles/contrib/{$name}": [ + "type:drupal-profile" + ], + "build/modules/contrib/{$name}": [ + "type:drupal-module" + ], + "build/themes/contrib/{$name}": [ + "type:drupal-theme" + ] + }, + "patches_applied": { + "Include the smartloader on pages where analytics are used.": "https://patch-diff.githubusercontent.com/raw/openeuropa/oe_webtools/pull/71.patch" + } + }, + "autoload": { + "psr-4": { + "Drupal\\oe_webtools\\": "./src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "EUPL-1.2" + ], + "description": "OpenEuropa Webtools integration.", + "time": "2019-05-15T11:26:37+00:00" + }, { "name": "openeuropa/oe_webtools_location", "version": "dev-master", diff --git a/docs/matomo.md b/docs/matomo.md deleted file mode 100644 index dd768d0335..0000000000 --- a/docs/matomo.md +++ /dev/null @@ -1,78 +0,0 @@ -# Matomo analytics - -(formerly Piwik analytics) - -Joinup uses the open source [Matomo](https://matomo.org/) web analytics platform -to gain insights in the usage and popularity of content. - -In order to develop the analytics integration it is advisable to run a local -instance of Matomo. One easy way to get this up and running is by running a -containerized instance. For this you will need the following software: - -- git - [https://git-scm.com/downloads](https://git-scm.com/downloads) -- docker-compose - [https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/) - -Once the prerequisite software is installed, run the following command from the -project root to download and run Matomo: - -``` -$ ./vendor/bin/phing setup-matomo -``` - -This will download Matomo in ./vendor/matomo-org/matomo and start a running -instance at http://localhost:8000. - -Now, visit the web UI at `http://localhost:8000`, or the host and port that were -configured previously in `./build.properties.local` and follow the installation -wizard. Use the values provided in console by the output of the previous -`./vendor/bin/phing setup-matomo` command. Check the 'Matomo' section in -`build.properties` for possible configuration options. - -## Configuration - -After Matomo has been installed, update your local Phing properties in -`build.properties.local` with the site ID and authentication token. These are -environment specific and can be found in the Matomo web interface: - -``` -# Website ID. This can be seen in the Matomo UI, at Administration > Websites > -# Manage. -matomo.website_id = 1 - -# Authentication token. This can be retrieved from the Matomo web interface at -# Administration > Platform > API > User authentication. -matomo.token = 0123456789abcdef0123456789abcdef -``` - -During the installation of the project these parameters will be written in the -`settings.local.php` file and used by Drupal to connect to the Matomo instance. - -## Troubleshooting - -### Nothing being registered - -If your page visits are not being registered in Matomo, check the following: - -* Adblockers or other privacy enhancing extensions might be blocking the - requests. -* The browser's "Do not track" option might be enabled. - -### Driver devicemapper failed - -If you get the error `Driver devicemapper failed to remove root filesystem` when -stopping the Matomo containers, then shut down your web server and try again. - -### Reinitializing Matomo - -If you want to start from scratch using a fresh Matomo instance: - -``` -# Stop the running instance. -$ ./vendor/bin/phing stop-matomo - -# Remove the local storage (run with sudo if needed). -$ sudo rm -rf ./vendor/matomo/matomo - -# Set up a fresh instance. -$ ./vendor/bin/phing setup-matomo -``` diff --git a/tests/features/isa2_analytics/site_sections.feature b/tests/features/isa2_analytics/site_sections.feature new file mode 100644 index 0000000000..575e2abeea --- /dev/null +++ b/tests/features/isa2_analytics/site_sections.feature @@ -0,0 +1,42 @@ +@api @terms +Feature: Site sections + As an analytics engineer + I want visitor statistics to be grouped in sections + So that I can better understand the needs of our users + + Background: + Given the following collection: + | uri | http://joinup.eu/collection/the-polygone-project | + | title | The Polygone Project | + | state | validated | + And the following solution: + | title | Miss Fashionista | + | collection | The Polygone Project | + | state | validated | + And discussion content: + | title | body | state | collection | + | Deep Carnival | Now online | validated | The Polygone Project | + And event content: + | title | state | solution | + | Flat Beat 20th Anniversary | validated | Miss Fashionista | + + Scenario: Reporting of site sections to the analytics platform + # Check a couple of pages that do not belong to a particular collection or + # solution. These should not report any site sections. + Given I am on the homepage + Then the analytics report should not include a site section + Given I visit the collection overview + Then the analytics report should not include a site section + Given I visit the contact form + Then the analytics report should not include a site section + + # Now do a sample check of a collection and solution overview page, as well + # as some community content belonging to these groups. + Given I visit the "The Polygone Project" collection + Then the analytics report should include the site section "http://joinup.eu/collection/the-polygone-project" + Given I visit the "Miss Fashionista" solution + Then the analytics report should include the site section "http://joinup.eu/collection/the-polygone-project" + Given I visit the "Deep Carnival" discussion + Then the analytics report should include the site section "http://joinup.eu/collection/the-polygone-project" + Given I visit the "Flat Beat 20th Anniversary" event + Then the analytics report should include the site section "http://joinup.eu/collection/the-polygone-project" diff --git a/web/modules/custom/isa2_analytics/isa2_analytics.behat.inc b/web/modules/custom/isa2_analytics/isa2_analytics.behat.inc new file mode 100644 index 0000000000..26c0484a29 --- /dev/null +++ b/web/modules/custom/isa2_analytics/isa2_analytics.behat.inc @@ -0,0 +1,90 @@ +assertAnalyticsJsonContainsParameter(AnalyticsEventInterface::SITE_SECTION, $section); + } + else { + $this->assertAnalyticsJsonNotContainsParameter(AnalyticsEventInterface::SITE_SECTION); + } + } + + /** + * Asserts that a given parameter is passed in the analytics data. + * + * @param string $parameter + * The parameter name. + * @param string $value + * The expected value for the parameter. + */ + protected function assertAnalyticsJsonContainsParameter(string $parameter, string $value): void { + $analytics_data = $this->getAnalyticsData(); + Assert::assertArrayHasKey($parameter, $analytics_data); + Assert::assertEquals($value, $analytics_data[$parameter]); + } + + /** + * Asserts that a given parameter is not passed in the analytics data. + * + * @param string $parameter + * The parameter that should not be present in the analytics data. + */ + protected function assertAnalyticsJsonNotContainsParameter(string $parameter): void { + $analytics_data = $this->getAnalyticsData(); + Assert::assertArrayNotHasKey($parameter, $analytics_data); + } + + /** + * Returns the data being reported to Webtools Analytics. + * + * @return array + * The data being reported to Webtools Analytics. + */ + protected function getAnalyticsData(): array { + // The Webtools Analytics data is present in the form of JSON data. Retrieve + // all JSON data from the page. + $elements = $this->getSession()->getPage()->findAll("css", "script[type=\"application/json\"]"); + $json_applications = array_map(function (NodeElement $element) { + return json_decode($element->getText(), TRUE); + }, $elements); + + // The analytics data is a JSON array that can be identified by the 'piwik' + // value in the 'utility' key. + $analytics_data_arrays = array_filter($json_applications, function ($json_data) { + return is_array($json_data) && isset($json_data['utility']) && $json_data['utility'] === 'piwik'; + }); + + // Fail if there are multiple analytics JSON arrays found. + Assert::assertCount(1, $analytics_data_arrays, 'There should be exactly 1 analytics JSON array in the page.'); + + return reset($analytics_data_arrays); + } + +} diff --git a/web/modules/custom/isa2_analytics/isa2_analytics.info.yml b/web/modules/custom/isa2_analytics/isa2_analytics.info.yml new file mode 100644 index 0000000000..ab6dc2fae7 --- /dev/null +++ b/web/modules/custom/isa2_analytics/isa2_analytics.info.yml @@ -0,0 +1,9 @@ +name: ISA2 Analytics +description: Integrates the ISA2 Joinup instance with Webtools Analytics for tracking user behaviour. +package: ISA2 + +core: 8.x +type: module + +dependencies: + - oe_webtools:oe_webtools_analytics diff --git a/web/modules/custom/isa2_analytics/isa2_analytics.services.yml b/web/modules/custom/isa2_analytics/isa2_analytics.services.yml new file mode 100644 index 0000000000..13a51b941d --- /dev/null +++ b/web/modules/custom/isa2_analytics/isa2_analytics.services.yml @@ -0,0 +1,6 @@ +services: + isa2_analytics.oe_webtools_analytics_subscriber: + class: Drupal\isa2_analytics\EventSubscriber\WebtoolsAnalyticsSubscriber + arguments: ['@entity_type.manager', '@og.context'] + tags: + - { name: event_subscriber } diff --git a/web/modules/custom/isa2_analytics/src/EventSubscriber/WebtoolsAnalyticsSubscriber.php b/web/modules/custom/isa2_analytics/src/EventSubscriber/WebtoolsAnalyticsSubscriber.php new file mode 100644 index 0000000000..afef670978 --- /dev/null +++ b/web/modules/custom/isa2_analytics/src/EventSubscriber/WebtoolsAnalyticsSubscriber.php @@ -0,0 +1,98 @@ +entityTypeManager = $entityTypeManager; + $this->ogContext = $ogContext; + } + + /** + * Sets the site section on the analytics event. + * + * If the current page belongs to a certain group (collection or solution) + * then this will be reported to Webtools Analytics as a "site section". This + * allows the visitor data to be analysed for specific collections and + * solutions. + * + * @param \Drupal\oe_webtools_analytics\AnalyticsEventInterface $event + * Response event. + */ + public function setSiteSection(AnalyticsEventInterface $event) { + // The site section varies by the active group. + $event->addCacheContexts(['og_group_context']); + + // Set the group label as the site section if there is an active group. + if ($group = $this->ogContext->getGroup()) { + if ($group->bundle() === 'solution') { + + $collection = NULL; + // Normally, the solution has the `collections` computed field that + // holds the list of collections that are affiliates to the solution. + // However, this method is fired during the preparation of the page + // while the computation of the value takes place during the rendering + // of the page. + // @see \Drupal\Core\Render\MainContent\HtmlRenderer::renderResponse + if ($collections = solution_get_collection_ids($group)) { + // Only the first affiliated collection should be used to set the site + // section. This is considered to be the "main" collection. Any other + // collections are ignored since they would make the analytics results + // more difficult to interpret. + $collection_id = reset($collections); + $collection = $this->entityTypeManager->getStorage('rdf_entity')->load($collection_id); + } + $group = $collection; + } + } + + if (!empty($group)) { + $event->setSiteSection($group->id()); + $event->addCacheableDependency($group); + } + } + + /** + * {@inheritdoc} + */ + public static function getSubscribedEvents() { + $events[AnalyticsEvent::NAME][] = ['setSiteSection']; + + return $events; + } + +} diff --git a/web/modules/custom/joinup_core/joinup_core.services.yml b/web/modules/custom/joinup_core/joinup_core.services.yml index 6f6cf80ef6..78d65017d9 100644 --- a/web/modules/custom/joinup_core/joinup_core.services.yml +++ b/web/modules/custom/joinup_core/joinup_core.services.yml @@ -12,9 +12,6 @@ services: joinup_core.node_workflow_access: class: Drupal\joinup_core\NodeWorkflowAccessControlHandler arguments: ['@entity_type.manager', '@og.membership_manager', '@joinup_core.relations_manager', '@current_user', '@config.factory', '@joinup_core.workflow.helper'] - joinup_core.page_type_determiner: - class: Drupal\joinup_core\PageTypeDeterminer - arguments: ['@current_route_match', '@entity_type.bundle.info'] joinup_core.refresh_visit_count: class: Drupal\joinup_core\EventSubscriber\RefreshCachedFieldsEventSubscriber arguments: ['@entity_type.manager', '@datetime.time', '@matomo.query_factory', '@config.factory', '@logger.factory'] diff --git a/web/modules/custom/joinup_core/joinup_core.tokens.inc b/web/modules/custom/joinup_core/joinup_core.tokens.inc index 22e8c1e1f2..cca95c6054 100644 --- a/web/modules/custom/joinup_core/joinup_core.tokens.inc +++ b/web/modules/custom/joinup_core/joinup_core.tokens.inc @@ -12,23 +12,7 @@ use Drupal\Core\Render\BubbleableMetadata; */ function joinup_core_token_info() { return [ - 'types' => [ - 'joinup-current-page' => [ - 'name' => t('Joinup current page'), - 'description' => t('Custom tokens that can be derived from the context of the current page.'), - ], - ], 'tokens' => [ - 'joinup-current-page' => [ - 'group-context' => [ - 'name' => t('Group context'), - 'description' => t('The collection or solution a page belongs to.'), - ], - 'page-type' => [ - 'name' => t('Page type'), - 'description' => t('Human readable page type. Intended for analytics.'), - ], - ], 'random' => [ 'uuid' => [ 'name' => t('UUID'), @@ -46,23 +30,6 @@ function joinup_core_tokens($type, $tokens, array $data, array $options, Bubblea $replacements = []; switch ($type) { - case 'joinup-current-page': - foreach ($tokens as $name => $original) { - switch ($name) { - case 'group-context': - /** @var \Drupal\Core\Entity\ContentEntityInterface $group */ - if ($group = \Drupal::service('og.context')->getGroup()) { - $replacements[$original] = $group->label(); - } - break; - - case 'page-type': - $replacements[$original] = \Drupal::service('joinup_core.page_type_determiner')->getType(); - break; - } - } - break; - case 'random': /** @var \Drupal\Component\Uuid\UuidInterface $uuid_service */ $uuid_service = \Drupal::service('uuid'); @@ -72,7 +39,6 @@ function joinup_core_tokens($type, $tokens, array $data, array $options, Bubblea } } break; - } return $replacements; diff --git a/web/modules/custom/joinup_core/src/PageTypeDeterminer.php b/web/modules/custom/joinup_core/src/PageTypeDeterminer.php deleted file mode 100644 index 1c115a9ff5..0000000000 --- a/web/modules/custom/joinup_core/src/PageTypeDeterminer.php +++ /dev/null @@ -1,131 +0,0 @@ -routeMatch = $routeMatch; - $this->entityTypeBundleInfo = $entityTypeBundleInfo; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('og.membership_manager'), - $container->get('entity_type.bundle.info') - ); - } - - /** - * {@inheritdoc} - */ - public function getType() { - $route_name = $this->routeMatch->getRouteName(); - switch ($route_name) { - case 'entity.rdf_entity.canonical': - return $this->getBundle($this->routeMatch->getParameter('rdf_entity')); - } - - // Return the human readable alias for the route. If none exists, return the - // route name itself. - return $this->getRouteAlias($route_name) ?: $route_name; - } - - /** - * Returns the human readable bundle name of a given entity. - * - * @param \Drupal\Core\Entity\EntityInterface $entity - * The entity to debundle. - * - * @return string - * The human readable bundle name. - */ - protected function getBundle(EntityInterface $entity) { - $bundle_info = $this->entityTypeBundleInfo->getBundleInfo($entity->getEntityTypeId()); - return $bundle_info[$entity->bundle()]['label']; - } - - /** - * Returns a human readable alias for a given route name. - * - * @param string $route_name - * The route name. - * - * @return string|null - * The human readable alias, or NULL if no alias is defined. - */ - protected static function getRouteAlias($route_name) { - $aliases = self::getRouteAliases(); - if (!empty($aliases[$route_name])) { - return $aliases[$route_name]; - } - return NULL; - } - - /** - * Returns a list of human readable aliases for route names. - * - * @return array - * An associative array of human readable aliases, keyed by route name. - */ - protected static function getRouteAliases() { - return [ - 'asset_release.solution_asset_release.overview' => 'Releases overview', - 'contact_form.contact_page' => 'Contact form', - 'dashboard.page' => 'Dashboard', - 'entity.rdf_entity.about_page' => 'About page', - 'entity.rdf_entity.edit_form' => 'Edit form', - 'entity.rdf_entity.rdf_export' => 'Export RDF metadata', - 'entity.user.canonical' => 'User profile', - 'homepage.content' => 'Homepage', - 'joinup_licence.overview' => 'Licence overview', - 'user.login' => 'Login form', - 'view.collections.page_1' => 'Collections overview', - 'view.content_overview.page_1' => 'Content overview', - 'view.solutions.page_1' => 'Solutions overview', - 'view.search.page_1' => 'Search', - ]; - } - -} diff --git a/web/modules/custom/joinup_core/src/PageTypeDeterminerInterface.php b/web/modules/custom/joinup_core/src/PageTypeDeterminerInterface.php deleted file mode 100644 index 7043f2c25d..0000000000 --- a/web/modules/custom/joinup_core/src/PageTypeDeterminerInterface.php +++ /dev/null @@ -1,18 +0,0 @@ -field_is_state->value; if (in_array($state, ['validated', 'deletion_request'])) { - \Drupal::entityManager()->getStorage('rdf_entity')->deleteFromGraph([$entity], 'draft'); + \Drupal::entityTypeManager()->getStorage('rdf_entity')->deleteFromGraph([$entity], 'draft'); } if ($state == 'blacklisted') { - /** @var \Drupal\sparql_entity_storage\SparqlEntityStorage $storage */ - \Drupal::entityManager()->getStorage('rdf_entity')->deleteFromGraph([$entity], 'default'); + \Drupal::entityTypeManager()->getStorage('rdf_entity')->deleteFromGraph([$entity], 'default'); } solution_invalidate_collection($entity); } diff --git a/web/profiles/joinup/config/install/matomo.settings.yml b/web/profiles/joinup/config/install/matomo.settings.yml index 0dcb832f15..81be621631 100644 --- a/web/profiles/joinup/config/install/matomo.settings.yml +++ b/web/profiles/joinup/config/install/matomo.settings.yml @@ -1,9 +1,19 @@ +# @todo This file does not belong in the Joinup profile since it is specific +# to the ISA2 installation of Joinup. This should be moved into the exported +# config sync folder. +# @see https://webgate.ec.europa.eu/CITnet/jira/browse/ISAICP-4858 site_id: '177' url_http: 'http://joinup.acc.ne-dev.eu/' url_https: 'https://joinup.acc.ne-dev.eu/' domain_mode: 0 visibility: - request_path_mode: 0 + # Workaround to disable Matomo page tracking. We are currently using Webtools + # Analytics for tracking page visits, but are still using the Matomo Reporting + # API for showing the visit counts and download counts. By setting the request + # path mode to 2 (= "PHP") and not having the PHP module enabled Matomo will + # not do any page tracking. + # @see _matomo_visibility_pages() + request_path_mode: 2 request_path_pages: "/admin\n/admin/*\n/batch\n/node/add*\n/node/*/*\n/rdf_entity/add/*\n/user/*/*" user_role_mode: 0 user_role_roles: { } @@ -21,14 +31,14 @@ privacy: custom: variable: 1: - name: 'Group context' - value: '[joinup-current-page:group-context]' - scope: page + name: '' + value: '' + scope: visit slot: 1 2: - name: 'Page type' - value: '[joinup-current-page:page-type]' - scope: page + name: '' + value: '' + scope: visit slot: 2 3: name: '' diff --git a/web/profiles/joinup/config/install/oe_webtools_analytics.settings.yml b/web/profiles/joinup/config/install/oe_webtools_analytics.settings.yml new file mode 100644 index 0000000000..4b3dbb8696 --- /dev/null +++ b/web/profiles/joinup/config/install/oe_webtools_analytics.settings.yml @@ -0,0 +1,7 @@ +# @todo This file does not belong in the Joinup profile since it is specific +# to the ISA2 installation of Joinup. This should be moved into the exported +# config sync folder. +# @see https://webgate.ec.europa.eu/CITnet/jira/browse/ISAICP-4858 +siteID: '' +sitePath: joinup.uat.fpfis.tech.ec.europa.eu +instance: testing diff --git a/web/profiles/joinup/joinup.info.yml b/web/profiles/joinup/joinup.info.yml index 5d794fe37d..c77707a6d5 100644 --- a/web/profiles/joinup/joinup.info.yml +++ b/web/profiles/joinup/joinup.info.yml @@ -43,6 +43,7 @@ dependencies: - honeypot:honeypot - drupal:image - inline_entity_form:inline_entity_form + - isa2_analytics:isa2_analytics - joinup:joinup_collection - joinup:joinup_core - joinup:joinup_discussion @@ -243,6 +244,7 @@ config_devel: - linkit.linkit_profile.default - mailsystem.settings - matomo.settings + - oe_webtools_analytics.settings - og.settings - og_menu.ogmenu.navigation - page_manager.page.legal_notice diff --git a/web/profiles/joinup/joinup.post_update.php b/web/profiles/joinup/joinup.post_update.php index 7509a152b0..1421fd7356 100644 --- a/web/profiles/joinup/joinup.post_update.php +++ b/web/profiles/joinup/joinup.post_update.php @@ -41,6 +41,13 @@ function joinup_post_update_install_joinup_rss() { \Drupal::service('module_installer')->install(['joinup_rss']); } +/** + * Enable the "ISA2 Analytics" module. + */ +function joinup_post_update_install_isa2_analytics() { + \Drupal::service('module_installer')->install(['isa2_analytics']); +} + /** * Enable the "config_readonly" module. */