From 37e5e1f40072921ec58d8401c08c5a754362e181 Mon Sep 17 00:00:00 2001 From: Daniel Bosen Date: Tue, 16 Nov 2021 10:05:04 +0100 Subject: [PATCH] Measurement manager --- .../workflows/{module_test.yml => test.yml} | 2 +- composer.json | 2 +- config/install/ivw_integration.settings.yml | 6 +- config/schema/ivw_integration.schema.yml | 25 ++++- graphql/ivw.base.graphqls | 6 +- ivw_integration.module | 50 ++++++--- ivw_integration.services.yml | 2 +- src/Form/SettingsForm.php | 104 +++++++++++++++-- src/IvwTracker.php | 105 ++++++++++++++++-- src/IvwTrackerInterface.php | 2 +- src/Plugin/Block/IvwCallBlock.php | 14 ++- src/Plugin/GraphQL/DataProducer/IvwCall.php | 6 +- .../SchemaExtension/IvwSchemaExtension.php | 18 ++- templates/ivw-call.html.twig | 26 +++-- .../Functional/IvwIntegrationOverrideTest.php | 1 - tests/src/Unit/IvwLookupServiceTest.php | 1 - 16 files changed, 305 insertions(+), 65 deletions(-) rename .github/workflows/{module_test.yml => test.yml} (97%) diff --git a/.github/workflows/module_test.yml b/.github/workflows/test.yml similarity index 97% rename from .github/workflows/module_test.yml rename to .github/workflows/test.yml index 19d8905..1037fc3 100644 --- a/.github/workflows/module_test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: - PHP: ['7.3', '7.4'] + PHP: ['7.4', '8.0'] steps: - uses: actions/checkout@v1 diff --git a/composer.json b/composer.json index f0c60f1..83edb8c 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "GPL-2.0-or-later", "minimum-stability": "dev", "require": { - "drupal/core": "^8.8|^9.0", + "drupal/core": "^8.9|^9.2", "drupal/token": "^1.7" }, "require-dev": { diff --git a/config/install/ivw_integration.settings.yml b/config/install/ivw_integration.settings.yml index e900483..7284b6a 100644 --- a/config/install/ivw_integration.settings.yml +++ b/config/install/ivw_integration.settings.yml @@ -27,4 +27,8 @@ frabo_default: 'in' frabo_overridable: false frabo_mobile_default: 'mo' frabo_mobile_overridable: false -mcvd: false +debug: false +pixel_type: 'cp' +distribution_channel: 'web' +legacy_mode: false +bfe: true diff --git a/config/schema/ivw_integration.schema.yml b/config/schema/ivw_integration.schema.yml index c48a9a0..1e1b654 100644 --- a/config/schema/ivw_integration.schema.yml +++ b/config/schema/ivw_integration.schema.yml @@ -48,10 +48,10 @@ ivw_integration.settings: label: 'IVW mobile site name as used in st parameter' service_domain_name: type: string - label: 'Domain name for anonymous INFOnline measurement. It should look similar to data-{hash}.example.com' + label: 'Domain name for anonymous Measurement Manager.' mobile_service_domain_name: type: string - label: 'Mobile domain name for anonymous INFOnline measurement. It should look similar to data-{hash}.example.com' + label: 'Mobile domain name for anonymous Measurement Manager.' code_template: type: string label: 'IVW code template' @@ -127,6 +127,23 @@ ivw_integration.settings: frabo_mobile_overridable: type: boolean label: 'Frabo control for mobile is overridable' - mcvd: + debug: type: boolean - label: 'Activate Multistage Client & Visit Detection (MCVD)' + label: 'Activate debugging' + pixel_type: + type: string + label: 'The pixel type' + distribution_channel: + type: string + label: 'The distribution type' + legacy_mode: + type: boolean + label: 'Display legacy code additionally to measurement manager' + bfe: + type: boolean + label: 'Participate in agof daily digital facts' + disabled_languages: + type: sequence + label: 'Disabled languages' + sequence: + type: string diff --git a/graphql/ivw.base.graphqls b/graphql/ivw.base.graphqls index 6b62bee..a152b0c 100644 --- a/graphql/ivw.base.graphqls +++ b/graphql/ivw.base.graphqls @@ -2,12 +2,16 @@ type Ivw { st: String cp: String sv: String - sc: String co: String dn: String + dg: String + pt: String + dc: String + bfe: String mobile_cp: String mobile_st: String mobile_sv: String mobile_dn: String mobile_width: String + legacy_mode: String } diff --git a/ivw_integration.module b/ivw_integration.module index f123eb5..a99cb10 100644 --- a/ivw_integration.module +++ b/ivw_integration.module @@ -19,8 +19,11 @@ function ivw_integration_theme() { 'cp' => NULL, 'sv' => NULL, 'co' => NULL, - 'sc' => NULL, 'dn' => NULL, + 'dc' => NULL, + 'dg' => NULL, + 'pt' => NULL, + 'bfe' => NULL, 'mobile_st' => NULL, 'mobile_cp' => NULL, 'mobile_sv' => NULL, @@ -87,42 +90,59 @@ function ivw_integration_page_attachments(array &$page) { return; } - // Base minification script on the core javascript setting. - $minified = \Drupal::config('system.performance')->get('js.preprocess'); + if (!$trackerService->isLanguageEnabled()) { + return; + } + + $page['#cache']['tags'] = Cache::mergeTags($page['#cache']['tags'] ?? [], $trackerService->getCacheTags()); - $page['#cache']['tags'] = Cache::mergeTags(isset($page['#cache']['tags']) ? $page['#cache']['tags'] : [], $trackerService->getCacheTags()); + if ($tracker['legacy_mode']) { + $page['#attached']['html_head'][] = [ + [ + '#tag' => 'script', + '#attributes' => [ + 'src' => 'https://script.ioam.de/iam.js' . (\Drupal::config('system.performance')->get('js.preprocess') ? '?m=1' : ''), + ], + ], + 'ivw_library', + ]; + $page['#attached']['library'][] = 'ivw_integration/ivw_call'; + } $page['#attached']['html_head'][] = [ [ - '#tag' => 'script', + '#tag' => 'link', '#attributes' => [ - 'src' => 'https://script.ioam.de/iam.js' . ($minified ? '?m=1' : ''), + 'rel' => 'preload', + 'href' => '//' . $tracker['dn'] . '/iomm/latest/manager/base/es6/bundle.js', + 'as' => 'script', + 'id' => 'IOMmBundle', ], ], - 'ivw_library', + 'web_manager_base_preload', ]; $page['#attached']['html_head'][] = [ [ '#tag' => 'link', '#attributes' => [ - 'rel' => 'prefetch', + 'rel' => 'preload', + 'href' => '//' . $tracker['dn'] . '/iomm/latest/bootstrap/loader.js', 'as' => 'script', - 'data-name' => 'ima', - 'href' => 'https://' . $tracker['dn'] . '/sensor.modern.ncl.min.js', ], ], - 'ima_prefetch', + 'web_manager_bootstrap_preload', ]; $page['#attached']['html_head'][] = [ [ '#tag' => 'script', - '#value' => '!function(e,n,c,r,t,l,o,a,d){r=e.IMAGlobalObject=r,e[r]=e[r]||function(){(e[r].q=e[r].q||[]).push(arguments)},l=n.querySelector("[data-name="+r+"]"),t=t&&!l?t+"/sensor.modern.ncl.min.js":l.href,e[r].src=t,o=n.createElement("script"),d=e.crypto&&e.crypto.subtle,a="noModule"in o&&!/Edge/.test(e.navigator.userAgent),o.src=a?d?t:t.replace(".ncl",".lcl"):t.replace(".modern.n",".legacy.l"),n.head.appendChild(o)}(window,document,0,"ima");', + '#attributes' => [ + 'src' => '//' . $tracker['dn'] . '/iomm/latest/bootstrap/loader.js', + 'data-cmp-ab' => 2, + ], ], - 'ima_bootstrap', + 'web_manager', ]; - $page['#attached']['library'][] = 'ivw_integration/ivw_call'; - } diff --git a/ivw_integration.services.yml b/ivw_integration.services.yml index 5d86997..bf657f8 100644 --- a/ivw_integration.services.yml +++ b/ivw_integration.services.yml @@ -1,7 +1,7 @@ services: ivw_integration.tracker: class: Drupal\ivw_integration\IvwTracker - arguments: ['@config.factory', '@token', '@ivw_integration.lookup'] + arguments: ['@config.factory', '@token', '@ivw_integration.lookup', '@language_manager'] ivw_integration.lookup: class: Drupal\ivw_integration\IvwLookupService arguments: ['@current_route_match', '@config.factory', '@entity_type.manager'] diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php index c49dc19..cb3db52 100644 --- a/src/Form/SettingsForm.php +++ b/src/Form/SettingsForm.php @@ -5,6 +5,7 @@ use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Config\ConfigFactoryInterface; +use Drupal\Core\Language\LanguageManager; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Utility\Token; @@ -12,6 +13,15 @@ * Defines a form that configures ivw settings. */ class SettingsForm extends ConfigFormBase { + + /** + * Language manager. + * + * @var \Drupal\Core\Language\LanguageManager + * Language manager. + */ + protected $languageManager; + /** * The token object. * @@ -26,10 +36,13 @@ class SettingsForm extends ConfigFormBase { * The factory for configuration objects. * @param \Drupal\Core\Utility\Token $token * The token object. + * @param \Drupal\Core\Language\LanguageManager $language_manager + * The Language manager. */ - public function __construct(ConfigFactoryInterface $config_factory, Token $token) { + public function __construct(ConfigFactoryInterface $config_factory, Token $token, LanguageManager $language_manager) { parent::__construct($config_factory); $this->token = $token; + $this->languageManager = $language_manager; } /** @@ -38,7 +51,8 @@ public function __construct(ConfigFactoryInterface $config_factory, Token $token public static function create(ContainerInterface $container) { return new static( $container->get('config.factory'), - $container->get('token') + $container->get('token'), + $container->get('language_manager') ); } @@ -77,6 +91,13 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#group' => 'ivw_settings', ]; + $form['language_settings'] = [ + '#type' => 'details', + '#title' => $this->t('Language'), + '#open' => FALSE, + '#group' => 'ivw_settings', + ]; + $form['site_settings']['site'] = [ '#type' => 'textfield', '#title' => $this->t('IVW Site name'), @@ -94,16 +115,16 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['site_settings']['service_domain_name'] = [ '#type' => 'textfield', '#title' => $this->t('Service domain name'), - '#required' => FALSE, + '#required' => TRUE, '#default_value' => $ivw_integration_settings->get('service_domain_name'), - '#description' => $this->t('Service domain name for anonymous INFOnline measurement'), + '#description' => $this->t('Service domain name for Measurement Manager'), ]; $form['site_settings']['mobile_service_domain_name'] = [ '#type' => 'textfield', - '#title' => $this->t('Service domain name for mobile site'), - '#required' => FALSE, + '#title' => $this->t('Mobile service domain name'), + '#required' => TRUE, '#default_value' => $ivw_integration_settings->get('mobile_service_domain_name'), - '#description' => $this->t('Service domain name for anonymous INFOnline measurement for mobile site'), + '#description' => $this->t('Mobile service domain name for Measurement Manager'), ]; $form['site_settings']['code_template'] = [ '#type' => 'textfield', @@ -141,12 +162,51 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#default_value' => $ivw_integration_settings->get('mobile_width'), '#description' => $this->t('On a responsive site, this value tells the javascript up to which screen width, the device should be treated as mobile.'), ]; - $form['site_settings']['mcvd'] = [ + + $form['site_settings']['distribution_channel'] = [ + '#type' => 'select', + '#options' => [ + 'web' => $this->t('web'), + 'hyb' => $this->t('hyb'), + 'app' => $this->t('app'), + 'ctv' => $this->t('ctv'), + ], + '#title' => $this->t('The distribution channel'), + '#default_value' => $ivw_integration_settings->get('distribution_channel') ?: 'web', + '#description' => $this->t('The pixel type.'), + ]; + + $form['site_settings']['pixel_type'] = [ + '#type' => 'select', + '#options' => [ + 'cp' => $this->t('cp'), + 'sp' => $this->t('sp'), + 'xp' => $this->t('xp'), + ], + '#title' => $this->t('Pixel type'), + '#default_value' => $ivw_integration_settings->get('pixel_type') ?: 'cp', + '#description' => $this->t('The pixel type.'), + ]; + + $form['site_settings']['debug'] = [ + '#type' => 'checkbox', + '#title' => $this->t('Debugging'), + '#default_value' => $ivw_integration_settings->get('debug'), + '#description' => $this->t('Activate debugging.'), + ]; + + $form['site_settings']['legacy_mode'] = [ + '#type' => 'checkbox', + '#title' => $this->t('Use legacy code.'), + '#default_value' => $ivw_integration_settings->get('legacy_mode'), + ]; + + $form['site_settings']['bfe'] = [ '#type' => 'checkbox', - '#title' => $this->t('Activate Multistage Client & Visit Detection (MCVD)'), - '#default_value' => $ivw_integration_settings->get('mcvd'), - '#description' => $this->t('This activates the MCVD tracking capability. See INFOnline Fact Sheet \'Multistage Client & Visit Detection\' (MCVD) for more information about this.'), + '#title' => $this->t('Agof daily digital facts.'), + '#default_value' => $ivw_integration_settings->get('bfe'), ]; + $frabo_default = $ivw_integration_settings->get('frabo_default'); $form['default_values']['frabo_default'] = [ '#type' => 'select', @@ -381,6 +441,21 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#default_value' => $ivw_integration_settings->get('content_overridable'), ]; + // Language specific options. + $languages = $this->languageManager->getLanguages(); + $language_options = []; + foreach ($languages as $language) { + $language_options[$language->getId()] = $language->getName(); + } + + $form['language_settings']['disabled_languages'] = [ + '#type' => 'checkboxes', + '#title' => $this->t('Language settings'), + '#description' => $this->t('IVW will be disabled for the selected languages.'), + '#options' => $language_options, + '#default_value' => !empty($ivw_integration_settings->get('disabled_languages')) ? $ivw_integration_settings->get('disabled_languages') : [], + ]; + return parent::buildForm($form, $form_state); } @@ -419,7 +494,12 @@ public function submitForm(array &$form, FormStateInterface $form_state) { ->set('frabo_overridable', $values['frabo_overridable']) ->set('frabo_mobile_default', $values['frabo_mobile_default']) ->set('frabo_mobile_overridable', $values['frabo_mobile_overridable']) - ->set('mcvd', $values['mcvd']) + ->set('debug', $values['debug']) + ->set('disabled_languages', $values['disabled_languages']) + ->set('pixel_type', $values['pixel_type']) + ->set('distribution_channel', $values['distribution_channel']) + ->set('legacy_mode', $values['legacy_mode']) + ->set('bfe', $values['bfe']) ->save(); } diff --git a/src/IvwTracker.php b/src/IvwTracker.php index 177b1ce..53d8864 100644 --- a/src/IvwTracker.php +++ b/src/IvwTracker.php @@ -6,6 +6,7 @@ use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Entity\ContentEntityInterface; +use Drupal\Core\Language\LanguageManager; use Drupal\Core\Utility\Token; use Drupal\taxonomy\TermInterface; @@ -14,6 +15,13 @@ */ class IvwTracker implements IvwTrackerInterface, CacheableDependencyInterface { + /** + * Language manager. + * + * @var \Drupal\Core\Language\LanguageManager + */ + protected $languageManager; + /** * Static cache of tracking information. * @@ -51,15 +59,19 @@ class IvwTracker implements IvwTrackerInterface, CacheableDependencyInterface { * Token service. * @param \Drupal\ivw_integration\IvwLookupServiceInterface $lookupService * The IVW lookup service. + * @param \Drupal\Core\Language\LanguageManager $language_manager + * The Drupal language manager. */ public function __construct( ConfigFactoryInterface $config_factory, Token $token, - IvwLookupServiceInterface $lookupService + IvwLookupServiceInterface $lookupService, + LanguageManager $language_manager ) { $this->configFactory = $config_factory; $this->token = $token; $this->lookupService = $lookupService; + $this->languageManager = $language_manager; } /** @@ -73,9 +85,14 @@ public function getTrackingInformation(ContentEntityInterface $entity = NULL) { 'cp' => $this->getCp($entity), 'sv' => $this->getSv($entity), 'mobile_sv' => $this->getMobileSv($entity), - 'sc' => $this->getSc(), + 'mobile_dn' => $this->getMobileDn(), 'dn' => $this->getDn(), 'mobile_dn' => $this->getMobileDn(), + 'dg' => $this->getDg(), + 'pt' => $this->getPt(), + 'dc' => $this->getDc(), + 'legacy_mode' => $this->getLegacyMode(), + 'bfe' => $this->getBfe(), ]; // Calculate cpm based upon cp. // @todo This is absolutely not generic. @@ -172,13 +189,13 @@ protected function getMobileSv(ContentEntityInterface $entity = NULL) { } /** - * Gets the sc parameter. + * Gets the dn parameter. * * @return string - * The value of the st parameter. + * The value of the dn parameter. */ - protected function getSc() { - return $this->configFactory->get('ivw_integration.settings')->get('mcvd') ? 'yes' : ''; + protected function getDn() { + return $this->configFactory->get('ivw_integration.settings')->get('service_domain_name'); } /** @@ -187,18 +204,58 @@ protected function getSc() { * @return string * The value of the dn parameter. */ - protected function getDn() { - return $this->configFactory->get('ivw_integration.settings')->get('service_domain_name'); + protected function getMobileDn() { + return $this->configFactory->get('ivw_integration.settings')->get('mobile_service_domain_name'); } /** - * Gets the mobile_dn parameter. + * Gets the debug parameter. + * + * @return bool + * The value of the debug parameter. + */ + protected function getDg() { + return $this->configFactory->get('ivw_integration.settings')->get('debug'); + } + + /** + * Gets the pixel type parameter. * * @return string - * The value of the mobile_dn parameter. + * The value of the pixel type parameter. */ - protected function getMobileDn() { - return $this->configFactory->get('ivw_integration.settings')->get('mobile_service_domain_name'); + protected function getPt() { + return $this->configFactory->get('ivw_integration.settings')->get('pixel_type'); + } + + /** + * Gets the legacy mode parameter. + * + * @return bool + * The value of the legacy mode parameter. + */ + protected function getLegacyMode() { + return $this->configFactory->get('ivw_integration.settings')->get('legacy_mode'); + } + + /** + * Gets the bfe value. + * + * @return bool + * The value of the bfe value. + */ + protected function getBfe() { + return $this->configFactory->get('ivw_integration.settings')->get('bfe'); + } + + /** + * Gets distribution channel. + * + * @return string + * The value of the distribution channel. + */ + protected function getDc() { + return $this->configFactory->get('ivw_integration.settings')->get('distribution_channel'); } /** @@ -226,4 +283,28 @@ public function getCacheMaxAge() { return 0; } + /** + * Should the tracker be enabled for the current language? + * + * @return bool + * Returns TRUE if the tracker is enabled, FALSE otherwise. + */ + public function isLanguageEnabled() { + $config = $this->configFactory->get('ivw_integration.settings'); + $current_language = $this->languageManager->getCurrentLanguage()->getId(); + $disabled_languages = $config->get('disabled_languages'); + + if (!$disabled_languages) { + return TRUE; + } + + if ( + array_key_exists($current_language, $disabled_languages) + && $disabled_languages[$current_language] === $current_language + ) { + return FALSE; + } + return TRUE; + } + } diff --git a/src/IvwTrackerInterface.php b/src/IvwTrackerInterface.php index 758acc8..67cf98c 100644 --- a/src/IvwTrackerInterface.php +++ b/src/IvwTrackerInterface.php @@ -14,7 +14,7 @@ interface IvwTrackerInterface { * * @return string[] * Array containing 'st', 'mobile_st', 'cp', 'cpm', - * 'sv' and 'mobile_sv' parameters. + * 'sv', 'mobile_sv' and 'mobile_dn' parameters. */ public function getTrackingInformation(ContentEntityInterface $entity = NULL); diff --git a/src/Plugin/Block/IvwCallBlock.php b/src/Plugin/Block/IvwCallBlock.php index 72d0ba2..86aabf9 100644 --- a/src/Plugin/Block/IvwCallBlock.php +++ b/src/Plugin/Block/IvwCallBlock.php @@ -90,9 +90,15 @@ public function build() { return []; } + // Disable for language specific sites. + if (!$this->ivwTracker->isLanguageEnabled()) { + return []; + } + $mobile_width = $config->get("mobile_width") ? $config->get("mobile_width") : ''; $mobile_site = $config->get("mobile_site") ? $config->get("mobile_site") : ''; $mobile_sv = $tracker['mobile_sv']; + $mobile_dn = $tracker['mobile_dn']; return [ 'ivw_call' => [ @@ -100,15 +106,19 @@ public function build() { '#st' => $tracker['st'], '#cp' => $tracker['cp'], '#sv' => $tracker['sv'], - '#sc' => $tracker['sc'], '#dn' => $tracker['dn'], + '#dg' => $tracker['dg'], + '#dc' => $tracker['dc'], + '#pt' => $tracker['pt'], + '#bfe' => $tracker['bfe'], // Not yet configurable. '#co' => '', '#mobile_cp' => $tracker['cpm'], '#mobile_st' => $mobile_site, '#mobile_sv' => $mobile_sv, - '#mobile_dn' => $tracker['mobile_dn'], + '#mobile_dn' => $mobile_dn, '#mobile_width' => $mobile_width, + '#legacy_mode' => $tracker['legacy_mode'], ], ]; } diff --git a/src/Plugin/GraphQL/DataProducer/IvwCall.php b/src/Plugin/GraphQL/DataProducer/IvwCall.php index 929b58d..9f74151 100644 --- a/src/Plugin/GraphQL/DataProducer/IvwCall.php +++ b/src/Plugin/GraphQL/DataProducer/IvwCall.php @@ -130,15 +130,19 @@ public function resolve(EntityInterface $entity, RefinableCacheableDependencyInt 'st' => $tracker['st'], 'cp' => $tracker['cp'], 'sv' => $tracker['sv'], - 'sc' => $tracker['sc'], 'dn' => $tracker['dn'], // Not yet configurable. 'co' => '', + 'dg' => $tracker['dg'], + 'pt' => $tracker['pt'], + 'dc' => $tracker['dc'], + 'bfe' => $tracker['bfe'], 'mobile_cp' => $tracker['cpm'], 'mobile_st' => $mobile_site, 'mobile_sv' => $tracker['mobile_sv'], 'mobile_dn' => $tracker['mobile_dn'], 'mobile_width' => $mobile_width, + 'legacy_mode' => $tracker['legacy_mode'], ]; }); diff --git a/src/Plugin/GraphQL/SchemaExtension/IvwSchemaExtension.php b/src/Plugin/GraphQL/SchemaExtension/IvwSchemaExtension.php index c396d99..ba05cf5 100644 --- a/src/Plugin/GraphQL/SchemaExtension/IvwSchemaExtension.php +++ b/src/Plugin/GraphQL/SchemaExtension/IvwSchemaExtension.php @@ -34,9 +34,23 @@ public function registerResolvers(ResolverRegistryInterface $registry) { )); $fields = [ - 'st', 'cp', 'sv', 'sc', 'co', 'dn', 'mobile_cp', 'mobile_st', 'mobile_sv', - 'mobile_width', 'mobile_dn', + 'st', + 'cp', + 'sv', + 'dn', + 'co', + 'dg', + 'pt', + 'dc', + 'bfe', + 'mobile_cp', + 'mobile_st', + 'mobile_sv', + 'mobile_dn', + 'mobile_width', + 'legacy_mode', ]; + foreach ($fields as $field) { $registry->addFieldResolver('Ivw', $field, $builder->callback(function ($arr) use ($field) { diff --git a/templates/ivw-call.html.twig b/templates/ivw-call.html.twig index 0bfe254..f4886a6 100644 --- a/templates/ivw-call.html.twig +++ b/templates/ivw-call.html.twig @@ -3,10 +3,14 @@ "cp": "{{ cp }}", "dn": "{{ dn }}", "sv": "{{ sv }}", - "st": "{{ st }}" + "st": "{{ st }}", + "dc": "{{ dc }}", + "pt": "{{ pt }}", + "dg": "{{ dg }}", + "bfe": "{{ bfe }}", } - if ( (window.innerWidth < {{ mobile_width }}) || (/iPhone/.test(window.navigator.userAgent))) { + if ( (window.innerWidth <= {{ mobile_width }}) || (/iPhone/.test(window.navigator.userAgent))) { responsive_data.cp = "{{ mobile_cp }}"; responsive_data.sv = "{{ mobile_sv }}"; responsive_data.dn = "{{ mobile_dn }}"; @@ -21,21 +25,25 @@ "st": responsive_data.st, "cp": responsive_data.cp, "sv": responsive_data.sv, - "co": "{{ co }}", - "sc": "{{ sc }}" + "co": "{{ co }}" }; if ((typeof window.iom !== 'undefined') && (typeof window.iom.c === 'function')) { - iom.c(iam_data, 1); + iom.c(iam_data, 1); } - if ((typeof window.ima !== 'undefined') && (typeof window.ima === 'function')) { - ima('init', { + if ((typeof window.IOMm !== 'undefined') && (typeof window.IOMm === 'function')) { + IOMm('configure', { "st": responsive_data.st, - "cp": responsive_data.cp, "dn": responsive_data.dn, + "dc": responsive_data.dc, + "dg": responsive_data.dg, }); - ima('count'); + IOMm('pageview', { cp: responsive_data.cp, pt: responsive_data.cp }); + + if (responsive_data.bfe) { + IOMm('3p', 'qds'); + } } diff --git a/tests/src/Functional/IvwIntegrationOverrideTest.php b/tests/src/Functional/IvwIntegrationOverrideTest.php index 6f65dc7..406a248 100644 --- a/tests/src/Functional/IvwIntegrationOverrideTest.php +++ b/tests/src/Functional/IvwIntegrationOverrideTest.php @@ -78,7 +78,6 @@ protected function setUp() { ->set('paid_overridable', 0) ->set('content_default', '01') ->set('content_overridable', 0) - ->set('mcvd', 0) ->save(); $this->drupalLogin($this->adminUser); diff --git a/tests/src/Unit/IvwLookupServiceTest.php b/tests/src/Unit/IvwLookupServiceTest.php index 50076ed..1b6eac6 100644 --- a/tests/src/Unit/IvwLookupServiceTest.php +++ b/tests/src/Unit/IvwLookupServiceTest.php @@ -92,7 +92,6 @@ protected function setUpConfigFactoryMock() { $config->set('paid_overridable', 0); $config->set('content_default', '01'); $config->set('content_overridable', 1); - $config->set('mcvd', 0); $this->configFactoryMock->expects($this->once()) ->method('get')