Skip to content
This repository has been archived by the owner on Mar 29, 2022. It is now read-only.

Commit

Permalink
Feature mcvd (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbosen authored Jan 14, 2019
1 parent 424ea63 commit 03e2486
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
language: php
sudo: required
dist: xenial

services:
- mysql

cache:
apt: true
Expand All @@ -10,7 +13,6 @@ cache:

php:
- 7.2
- 5.6

branches:
only:
Expand Down
1 change: 1 addition & 0 deletions config/install/ivw_integration.settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ frabo_default: 'in'
frabo_overridable: false
frabo_mobile_default: 'mo'
frabo_mobile_overridable: false
mcvd: false
3 changes: 3 additions & 0 deletions config/schema/ivw_integration.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,6 @@ ivw_integration.settings:
frabo_mobile_overridable:
type: boolean
label: 'Frabo control for mobile is overridable'
mcvd:
type: boolean
label: 'Activate Multistage Client & Visit Detection (MCVD)'
1 change: 1 addition & 0 deletions ivw_integration.module
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function ivw_integration_theme() {
'cp' => NULL,
'sv' => NULL,
'co' => NULL,
'sc' => NULL,
'mobile_st' => NULL,
'mobile_cp' => NULL,
'mobile_sv' => NULL,
Expand Down
8 changes: 7 additions & 1 deletion src/Form/SettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ 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'] = [
'#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 <a href="https://www.infonline.de/downloads/web-mew-und-ctv/">INFOnline Fact Sheet \'Multistage Client & Visit Detection\' (MCVD)</a> for more information about this.'),
];
$frabo_default = $ivw_integration_settings->get('frabo_default');
$form['default_values']['frabo_default'] = [
'#type' => 'select',
Expand Down Expand Up @@ -398,6 +403,7 @@ 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'])
->save();
}

Expand Down
11 changes: 11 additions & 0 deletions src/IvwTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function getTrackingInformation() {
'cp' => $this->getCp(),
'sv' => $this->getSv(),
'mobile_sv' => $this->getMobileSv(),
'sc' => $this->getSc(),
];
// Calculate cpm based upon cp.
// TODO: this is absolutely not generic.
Expand Down Expand Up @@ -140,6 +141,16 @@ protected function getMobileSv() {
return empty($sv) ? 'mo' : $sv;
}

/**
* Gets the sc parameter.
*
* @return string
* The value of the st parameter.
*/
protected function getSc() {
return $this->configFactory->get('ivw_integration.settings')->get('mcvd') ? 'yes' : '';
}

/**
* {@inheritdoc}
*/
Expand Down
1 change: 1 addition & 0 deletions src/Plugin/Block/IvwCallBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public function build() {
'#st' => $tracker['st'],
'#cp' => $tracker['cp'],
'#sv' => $tracker['sv'],
'#sc' => $tracker['sc'],
// Not yet configurable.
'#co' => '',
'#mobile_cp' => $tracker['cpm'],
Expand Down
3 changes: 2 additions & 1 deletion templates/ivw-call.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"st": "{{ st }}",
"cp": "{{ cp }}",
"sv": "{{ sv }}",
"co": "{{ co }}"
"co": "{{ co }}",
"sc": "{{ sc }}"
};
if ( (window.innerWidth < {{ mobile_width }}) || (/iPhone/.test(window.navigator.userAgent))) {
Expand Down
1 change: 1 addition & 0 deletions tests/src/Unit/IvwLookupServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ 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')
Expand Down

0 comments on commit 03e2486

Please sign in to comment.