<?php if (!defined('TWEAKR_INIT')) die('DIRECT ACCESS PROHIBITED'); ?>

     <!-- MATOMO/PIWIK Analytics -->
    <div class="postbox tweakr-postbox">
    <h3 class="hndle"><span><?php _e('Matomo (formerly Piwik) Analytics', 'tweakr'); ?></span></h3>
    <div class="inside tweakr-setting-section">

        <?php 
            // Enable
            $this->_settingsUtility->displayCheckbox(__('Matomo Analytics', 'tweakr'), 'piwik-analytics-enabled', array(
                'label' => 'Enable',
                'description' => 'The required Javascript Tracking Code will be added to your frontend including opt-out wrapper code.',
                'readmore' => 'https://developer.matomo.org/guides/tracking-javascript-guide'
            ));

        ?>

        <div class="tweakr-selective-section" data-trigger="#tweakr-piwik-analytics-enabled" data-condition="checked">

        <h4><?php _e('General Settings', 'tweakr'); ?></h4>

        <?php

            // Piwik Host
            $this->_settingsUtility->displayInput(__('Matomo Host', 'tweakr'), 'piwik-analytics-host', array(
                'placeholder' => 'https://piwik.example.org',
                'label' => 'Your Matomo Host',
                'cssClass' => 'input-large',
                'description' => 'Insert the full URL of your Matomo installation.',
                'readmore' => 'https://developer.matomo.org/guides/tracking-javascript-guide'
            ));

            // Site ID
            $this->_settingsUtility->displayInput(__('Site-ID', 'tweakr'), 'piwik-analytics-siteid', array(
                'placeholder' => '123',
                'label' => 'The Unique Site-ID of this Project',
                'description' => 'Add your Site-ID here.',
                'readmore' => 'https://matomo.org/faq/general/faq_19212/'
            ));
            
        ?>

        <h4><?php _e('Options', 'tweakr'); ?></h4>

        <?php

            // OPT-OUT
            $this->_settingsUtility->displayCheckbox(__('User Optional Out', 'tweakr'), 'piwik-analytics-optout-shortcode', array(
                'label' => 'Enable opt-out shortcode',
                'description' => 'An additional shortcode will become available which generates an opt-out button. MATOMO Analytics can be disabled by each user individually - in this case a persistent cookie is set which blocks the tracking code. It is recommended to add this button to the end of your privacy policy.',
                'readmore' => 'https://codeberg.org/AenonDynamics/wp-tweakr/src/branch/main/docs/Analytics_OptOut.md'
            ));

            // Subdomain Tracking
            $this->_settingsUtility->displayCheckbox(__('Subdomain Tracking', 'tweakr'), 'piwik-analytics-subdomain-tracking', array(
                'label' => 'Track users across all subdomains',
                'description' => 'In case someone visits a.example.org as well as b.example.org it will be counted as one unique visit.',
                'readmore' => 'http://developer.piwik.org/guides/tracking-javascript-guide#measuring-domains-andor-sub-domains'
            ));

            // Prepend Domain
            $this->_settingsUtility->displayCheckbox(__('Prepend Domain', 'tweakr'), 'piwik-analytics-prepend-domain', array(
                'label' => 'Prepend the Subdomain to the Document Title',
                'description' => 'By Visiting A.example.com/MyPage the pageview is recorded as A/MyPage.'
            ));

             // ClientSide DoNotTrack
            $this->_settingsUtility->displayCheckbox(__('DoNotTrack', 'tweakr'), 'piwik-analytics-dnt', array(
                'label' => 'Enable Client-Side DoNotTrack recognition.',
                'description' => 'Visitors with DoNotTrack preference set will no be tracked. Normally this option should be permanently enabled within your MATOMO Website settings!'
            ));

            // Simple Document Title
            $this->_settingsUtility->displayCheckbox(__('Simple Page Title', 'tweakr'), 'pwiki-analytics-simple-pagetitle', array(
                'label' => 'Enable Simple Page Titles.',
                'description' => 'Instead of the full Page Title (Title + Blogname) the pure WordPress Page Name is used to record visits.'
            ));

        ?>
        </div>

    <!-- // MATOMO/PIWIK Analytics -->
    </div></div>
