<div class="wrap">
    <?php
    require_once(WPMETASEO_ADDON_PLUGIN_DIR . 'inc/pages/google-services/menu.php');
    wp_enqueue_script('jquery');
    
    if (!empty($this->google_alanytics['googleCredentials'])) {
        ?>

    <div class="wpms-ga-setting">
        <h3 class="wpms-ga-setting-title up">
            <?php esc_html_e('Tracking settings', 'wpmsPro') ?>
        </h3>
        <div class="wpms-ga-setting-content">
            <div id="post-body-content">
                <div class="settings-wrapper">
                    <?php

                    $trackExclude = $this->ga_tracking['wpmsga_track_exclude'];
                    if (empty($this->ga_tracking['wpmsga_dash_tracking'])) {
                        echo '<div class="error"><p>' .
                            sprintf(
                                esc_html__('The tracking component is disabled. You should set %1$s to %2$s', 'wpmsPro'),
                                '<strong>' . esc_html__('Tracking Options', 'wpmsPro') . '</strong>',
                                '<strong>' . esc_html__('Enabled', 'wpmsPro') . '</strong>'
                            ) . '</p></div>';
                    }
                    if (empty($this->google_alanytics['tableid_jail'])) {
                        echo "<div class='error'><p>";
                        esc_html_e('Please select a profile first in order to get Google Analytics data', 'wpmsPro');
                        echo '</p></div>';
                    }
                    ?>
                    <div class="inside track-setting-content-box">
                        <form method="post" action="">
                            <div id="wpmsga-basic">
                                <p class="wpms_width_100 wpms_left">
                                    <button type="submit" name="Submit" class="ju-button orange-button"
                                    ><?php esc_html_e('Save Changes', 'wpmsPro'); ?></button>
                                </p>

                                <!--Tracking setting-->
                                <div class="ju-settings-option wpms-no-background wpms-no-shadow wpms-no-margin">
                                    <div class="wpms_row_full">
                                        <label class="ju-setting-label wpms_width_100 text">
                                            <?php esc_html_e('Tracking Settings', 'wpmsPro') ?>
                                        </label>
                                        <div class="ju-settings-option wpms_width_100">
                                            <div class="wpms_row_full" style="margin-bottom: 0">
                                                <label class="ju-setting-label wpms_width_100">
                                                    <?php esc_html_e('Tracking Options', 'wpmsPro') ?>
                                                </label>
                                                <p class="p-d-20">
                                                    <label>
                                                        <select id="wpmsga_dash_tracking" class="wpms-large-input"
                                                                name="_metaseo_ggtracking_settings[wpmsga_dash_tracking]"
                                                                onchange="this.form.submit()">
                                                            <option value="0" <?php selected($this->ga_tracking['wpmsga_dash_tracking'], 0) ?>>
                                                                <?php esc_html_e('Disabled', 'wpmsPro') ?>
                                                            </option>
                                                            <option value="1" <?php selected($this->ga_tracking['wpmsga_dash_tracking'], 1) ?>>
                                                                <?php esc_html_e('Enabled', 'wpmsPro') ?>
                                                            </option>
                                                        </select>
                                                        <input type="button" name="wpmsClearauthor"
                                                            class="wpmsClearauthor ju-button"
                                                            value="<?php esc_attr_e('!Remove tracking authorization!', 'wpmsPro') ?>">
                                                    </label>
                                                </p>
                                            </div>

                                            <div class="wpms_row_full" style="margin-top: 0">
                                                <label class="ju-setting-label wpms_width_100">
                                                    <?php esc_html_e('Analytics profile:', 'wpmsPro') ?>
                                                </label>
                                                <p class="p-d-20">
                                                    <label>
                                                        <input type="hidden" name="wpms_nonce"
                                                            value="<?php echo esc_attr(wp_create_nonce('wpms_nonce')) ?>">
                                                        <script>
                                                            var profileList = <?php echo json_encode($this->google_alanytics['profile_list']);  ?>;
                                                        </script>
                                                        <select onclick="changeSettingProfile(this.value, profileList)" id="tableid_jail" class="wpms-large-input wpms_width_100"
                                                                name="tableid_jail">
                                                            <?php
                                                            echo '<option value="0">' . esc_html__('Select a profile', 'wpmsPro') . '</option>';
                                                            if (!empty($this->google_alanytics['profile_list'])) {
                                                                foreach ($this->google_alanytics['profile_list'] as $items) {
                                                                    if ($items[1]) {
                                                                        echo '<optgroup
                                                    label="' . esc_attr($items[3]) . '">';
                                                                        if (isset($this->google_alanytics['tableid_jail'])
                                                                            && $this->google_alanytics['tableid_jail'] === $items[1]) {
                                                                            echo '<option value="' . esc_attr($items[1]) . '" selected ';
                                                                            echo '>' . esc_html($items[0]) . '</option>';
                                                                        } else {
                                                                            echo '<option value="' . esc_attr($items[1]) . '" ';
                                                                            echo '>' . esc_html($items[0]) . '</option>';
                                                                        }

                                                                        echo '</optgroup >';
                                                                    }
                                                                }
                                                            } else {
                                                                echo '<option value="">
    ' . esc_html__('Property not found', 'wpmsPro') . '</option>';
                                                            }
                                                            ?>
                                                        </select>
                                                    </label>
                                                    <?php
                                                    if (isset($this->google_alanytics['tableid_jail'])
                                                        && isset($this->google_alanytics['profile_list'])) {
                                                        $profile_info = WpmsGaTools::getSelectedProfile(
                                                            $this->google_alanytics['profile_list'],
                                                            $this->google_alanytics['tableid_jail']
                                                        );
                                                        if (isset($profile_info[0]) && !empty($profile_info[0])
                                                            && !empty($this->ga_tracking['wpmsga_dash_tracking'])) {
                                                            echo '<pre class="p-lr-20" style="white-space: nowrap;width: 100%;overflow: hidden;text-overflow: ellipsis;"><div id="tracking-profile-info">';
                                                            if (isset($profile_info[0]) && $profile_info[0]) {
                                                                echo esc_html('Profile Name: ', 'wpmsPro') . esc_html($profile_info[0]) . '<br>';
                                                            }
                                                            if (isset($profile_info[1]) && $profile_info[1]) {
                                                                echo esc_html('Profile ID: ', 'wpmsPro') . esc_html($profile_info[1]) . '<br>';
                                                            }
                                                            if (isset($profile_info[2]) && $profile_info[2]) {
                                                                echo esc_html('Property ID:	', 'wpmsPro') . esc_html($profile_info[2]) . '<br>';
                                                            }
                                                            if (isset($profile_info[3]) && $profile_info[3]) {
                                                                echo esc_html('Default URL:	', 'wpmsPro') . esc_html($profile_info[3]) . '<br>';
                                                            }
                                                            if (isset($profile_info[4]) && $profile_info[4]) {
                                                                echo esc_html('Property Type: ', 'wpmsPro') . esc_html($profile_info[4]) . '<br>';
                                                            }
                                                            if (isset($profile_info[5]) && $profile_info[5]) {
                                                                echo esc_html('Time Shift: ', 'wpmsPro') . esc_html($profile_info[5]) . '<br>';
                                                            }
                                                            if (isset($profile_info[6]) && $profile_info[6]) {
                                                                echo esc_html('Time Zone: ', 'wpmsPro') . esc_html($profile_info[6]) . '<br>';
                                                            }
                                                            if (isset($profile_info[7]) && $profile_info[7]) {
                                                                echo esc_html('Default Page: ', 'wpmsPro') . esc_html($profile_info[7]) . '<br>';
                                                            }
                                                            if (isset($profile_info[8]) && $profile_info[8]) {
                                                                echo esc_html('Measurement ID: ', 'wpmsPro') . esc_html($profile_info[8]) . '<br>';
                                                            }
                                                            echo '</div></pre>';
                                                        }
                                                    } else {
                                                        echo '<pre class="p-lr-20" style="white-space: nowrap;width: 100%;overflow: hidden;text-overflow: ellipsis;"><div id="tracking-profile-info">';
                                                        echo '</div></pre>';
                                                    }

                                                    ?>
                                                </p>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <!--End Tracking setting-->

                                <!--Basic Tracking-->
                                <div class="ju-settings-option wpms-no-background wpms-no-shadow wpms_right wpms-no-margin">
                                    <?php
                                    if (isset($this->google_alanytics['tableid_jail'])
                                        && isset($this->google_alanytics['profile_list'])) {
                                        $profile_info = WpmsGaTools::getSelectedProfile(
                                            $this->google_alanytics['profile_list'],
                                            $this->google_alanytics['tableid_jail']
                                        );
                                    }
                                    ?>
                                    <div class="wpms_row_full">
                                        <label class="ju-setting-label wpms_width_100 text">
                                            <?php esc_html_e('Basic Tracking', 'wpmsPro') ?>
                                        </label>

                                        <div class="ju-settings-option wpms_width_100">
                                            <div id="gg-tracking-type" class="hidden wpms_row_full" style="margin-bottom: 0">
                                                <label class="ju-setting-label wpms_width_100">
                                                    <?php esc_html_e('Tracking Type:', 'wpmsPro') ?>
                                                </label>
                                                <p class="p-d-20">
                                                    <label>
                                                        <select id="wpmsga_dash_tracking_type"
                                                                class="wpms-large-input wpms_width_100"
                                                                name="_metaseo_ggtracking_settings[wpmsga_dash_tracking_type]">
                                                            <option value="classic"
                                                                <?php selected($this->ga_tracking['wpmsga_dash_tracking_type'], 'classic') ?>>
                                                                <?php esc_html_e('Classic Analytics', 'wpmsPro') ?></option>
                                                            <option value="universal"
                                                                <?php selected($this->ga_tracking['wpmsga_dash_tracking_type'], 'universal') ?>
                                                            >
                                                                <?php esc_html_e('Universal Analytics', 'wpmsPro') ?></option>
                                                        </select>
                                                    </label>
                                                </p>
                                            </div>
                                            <div id="anonymize-ip-tracking" class="hidden wpms_row_full" style="margin-bottom: 0; margin-top: 0">
                                                <label class="ju-setting-label">
                                                    <?php esc_html_e('Anonymize IPs while tracking', 'wpmsPro') ?>
                                                </label>
                                                <div class="ju-switch-button">
                                                    <label class="switch">
                                                        <input type="checkbox"
                                                            name="_metaseo_ggtracking_settings[wpmsga_dash_anonim]"
                                                            <?php checked($this->ga_tracking['wpmsga_dash_anonim'], 1); ?>
                                                            value="1" class="wpmsga-settings-switchoo-checkbox"
                                                            id="wpmsga_dash_anonim">
                                                        <span class="slider round"></span>
                                                    </label>
                                                </div>
                                            </div>
                                            <?php if (isset($profile_info) && $profile_info[4] === 'GA4') {
                                                ?>
                                                <script>
                                                    document.getElementById('anonymize-ip-tracking').style.display = 'none';
                                                    document.getElementById('gg-tracking-type').style.display = 'none';
                                                </script>
                                            <?php } ?>
                                            <div class="wpms_row_full" style="margin-top: 0">
                                                <label class="ju-setting-label">
                                                    <?php esc_html_e('Enable remarketing, demographics and interests reports', 'wpmsPro') ?>
                                                </label>
                                                <div class="ju-switch-button">
                                                    <label class="switch">
                                                        <input type="checkbox"
                                                            name="_metaseo_ggtracking_settings[wpmsga_dash_remarketing]"
                                                            <?php checked($this->ga_tracking['wpmsga_dash_remarketing'], 1) ?>
                                                            value="1" class="wpmsga-settings-switchoo-checkbox"
                                                            id="wpmsga_dash_remarketing">
                                                        <span class="slider round"></span>
                                                    </label>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <!--End Basic tracking-->

                                <!--Events Tracking-->
                                <div class="ju-settings-option wpms-no-background wpms-no-shadow wpms_width_100 wpms-no-margin">
                                    <div class="ju-settings-option wpms-no-background wpms-no-shadow">
                                        <div class="wpms_row_full">
                                            <label class="ju-setting-label wpms_width_100 text">
                                                <?php esc_html_e('Events Tracking', 'wpmsPro') ?>
                                            </label>

                                            <div class="ju-settings-option wpms_width_100">
                                                <div class="wpms_row_full" style="margin-bottom: 0">
                                                    <label class="ju-setting-label wpms_width_100">
                                                        <?php esc_html_e('Downloads Regex:', 'wpmsPro') ?>
                                                    </label>
                                                    <p class="p-d-20">
                                                        <label>
                                                            <input type="text" id="wpmsga_event_downloads"
                                                                class="wpms-large-input wpms_width_100"
                                                                name="_metaseo_ggtracking_settings[wpmsga_event_downloads]"
                                                                value="<?php echo esc_attr($this->ga_tracking['wpmsga_event_downloads']) ?>"
                                                                size="50">
                                                        </label>
                                                    </p>
                                                </div>

                                                <div class="wpms_row_full" style="margin-top: 0">
                                                    <label class="ju-setting-label">
                                                        <?php esc_html_e('Track downloads, mailto and outbound links', 'wpmsPro') ?>
                                                    </label>
                                                    <div class="ju-switch-button">
                                                        <label class="switch">
                                                            <input type="checkbox"
                                                                name="_metaseo_ggtracking_settings[wpmsga_event_tracking]"
                                                                <?php checked($this->ga_tracking['wpmsga_event_tracking'], 1) ?>
                                                                value="1" class="wpmsga-settings-switchoo-checkbox"
                                                                id="wpmsga_event_tracking">
                                                            <span class="slider round"></span>
                                                        </label>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="ju-settings-option wpms-no-background wpms-no-shadow wpms_right wpms-no-margin">
                                        <div class="wpms_row_full">
                                            <label class="ju-setting-label wpms_width_100 text">
                                                <?php esc_html_e('Exclude Tracking', 'wpmsPro') ?>
                                            </label>

                                            <div class="ju-settings-option wpms_width_100">
                                                <div class="wpms_row_full">
                                                    <label class="ju-setting-label wpms_width_100">
                                                        <?php esc_html_e('Exclude tracking for:', 'wpmsPro') ?>
                                                    </label>
                                                    <div class="p-d-20 exclude_tracking">
                                                        <div class="pure-checkbox">
                                                            <input name="_metaseo_ggtracking_settings[wpmsga_track_exclude][]"
                                                                <?php
                                                                echo (in_array('administrator', $trackExclude)) ? 'checked' : ''
                                                                ?>
                                                                value="administrator" id="wpmsga_track_exclude_administrator"
                                                                type="checkbox">
                                                            <label for="wpmsga_track_exclude_administrator">
                                                                <?php esc_html_e('Administrator', 'wpmsPro'); ?></label>
                                                        </div>
                                                        <div class="pure-checkbox">
                                                            <input name="_metaseo_ggtracking_settings[wpmsga_track_exclude][]"
                                                                <?php echo (in_array('editor', $trackExclude)) ? 'checked' : '' ?>
                                                                value="editor" id="wpmsga_track_exclude_editor" type="checkbox">
                                                            <label for="wpmsga_track_exclude_editor">
                                                                <?php esc_html_e('Editor', 'wpmsPro'); ?>
                                                            </label>
                                                        </div>
                                                        <div class="pure-checkbox">
                                                            <input name="_metaseo_ggtracking_settings[wpmsga_track_exclude][]"
                                                                <?php echo (in_array('author', $trackExclude)) ? 'checked' : '' ?>
                                                                value="author" id="wpmsga_track_exclude_author" type="checkbox">
                                                            <label for="wpmsga_track_exclude_author">
                                                                <?php esc_html_e('Author', 'wpmsPro'); ?>
                                                            </label>
                                                        </div>
                                                        <div class="pure-checkbox">
                                                            <input name="_metaseo_ggtracking_settings[wpmsga_track_exclude][]"
                                                                <?php
                                                                echo (in_array('contributor', $trackExclude)) ? 'checked' : ''
                                                                ?>
                                                                value="contributor" id="wpmsga_track_exclude_contributor"
                                                                type="checkbox">
                                                            <label for="wpmsga_track_exclude_contributor">
                                                                <?php esc_html_e('Contributor', 'wpmsPro'); ?>
                                                            </label>
                                                        </div>
                                                        <div class="pure-checkbox">
                                                            <input name="_metaseo_ggtracking_settings[wpmsga_track_exclude][]"
                                                                <?php echo in_array('subscriber', $trackExclude) ? 'checked' : '' ?>
                                                                value="subscriber" id="wpmsga_track_exclude_subscriber"
                                                                type="checkbox">
                                                            <label for="wpmsga_track_exclude_subscriber">
                                                                <?php esc_html_e('Subscriber', 'wpmsPro'); ?>
                                                            </label>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <!--End Events Tracking-->

                                <p class="wpms_width_100 wpms_left">
                                    <button type="submit" name="Submit" class="ju-button orange-button"
                                    ><?php esc_html_e('Save Changes', 'wpmsPro'); ?></button>
                                </p>

                                <input type="hidden" name="_metaseo_ggtracking_settings[wpmsga_dash_hidden]" value="Y">
                                <?php wp_nonce_field('gadash_form', 'gadash_security'); ?>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
        <?php
    }
    ?>
    <h2 class="wpms_uppercase"><?php esc_html_e('Google Analytics Tracking Methods', 'wpmsPro') ?></h2>
    <form class="wpms-tracking-form" name="input" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" method="post" style="margin-top: 20px">
        <?php wp_nonce_field('gadash_form', 'gadash_security'); ?>
        <input type="hidden" name="wpms_nonce" value="<?php echo esc_attr(wp_create_nonce('wpms_nonce')) ?>">
        <input type="hidden" class="wpms_tracking_id" name="wpms_tracking_id" value="-1">
        <div class="wpmsga-advanced-configuration">
            <div class="content-box">
                <p class="ju-description">
                <?php esc_html_e('You can add multiple trackings using Google Analytics v4, Tag manager, or custom code', 'wpmsPro') ?></p>
                <div class="wpms-settings-options m-b-20">
                    <div class="wpms-settings-title wpms-ga-settings-title">
                        <label for="wpms_gg_service_tracking_type"
                                class="wpms-text"
                                title="<?php esc_attr_e('Analytics tracking type', 'wpmsPro') ?>">
                            <?php esc_html_e('Analytics tracking method', 'wpmsPro'); ?></label>
                    </div>
                    <div class="wpms-ga-settings-content">
                        <label>
                            <select onclick="requireTrackingIdTitle(this.value)" id="wpms_gg_service_tracking_type"
                                    class="wpms-large-input"
                                    name="wpms_gg_service_tracking_type">
                                <option value="analytics4">
                                    <?php esc_html_e('Google Analytics v4', 'wpmsPro') ?>
                                </option>
                                <option value="tagmanager">
                                    <?php esc_html_e('Google Tag Manager', 'wpmsPro') ?>
                                </option>
                                <option value="analytics4_custom">
                                    <?php esc_html_e('Google Analytics custom JS code', 'wpmsPro') ?>
                                </option>
                                <option value="tagmanager_custom">
                                    <?php esc_html_e('Google Tag Manager custom JS code', 'wpmsPro') ?>
                                </option>
                                <option value="other_custom">
                                    <?php esc_html_e('Other custom JS code', 'wpmsPro') ?>
                                </option>
                            </select>
                        </label>
                    </div>
                    <div class="wpms-settings-title wpms-ga-settings-title wpms-tracking-id">
                        <label
                            for="wpms_gg_service_tracking_id"
                            class="wpms-text"
                            title="<?php esc_attr_e('Google Analytics ID', 'wpmsPro') ?>">
                        <?php esc_html_e('Measurement ID', 'wpmsPro'); ?></label>
                    </div>
                    <div class="wpms-ga-settings-content wpms-tracking-id">
                        <input type="text" class="wpms-large-input wpmsga_code_tracking" id="wpms_gg_service_tracking_id"
                                name="wpms_gg_service_tracking_id"
                                value="<?php echo esc_attr($this->gaDisconnect['wpms_gg_service_tracking_id']) ?>"
                                size="61">
                        <input type="hidden" name="wpms_nonce"
                                value="<?php echo esc_attr(wp_create_nonce('wpms_nonce')) ?>">
                    </div>
                    <div class="hidden wpms-settings-title wpms-ga-settings-title wpms-code-placement">
                        <label class="wpms-text"><?php esc_html_e('Code Placement', 'wpmsPro') ?></label>
                    </div>
                    <div class="hidden wpms-ga-settings-content wpms-code-placement">
                        <div style="display: flex;align-items: center;column-gap: 4px;">
                            <label for="wpms-head-code"><?php esc_html_e('Head Code', 'wpmsPro') ?></label>
                            <input onclick="showOrHideCustomCodeGoogleAnalytics()" type="checkbox" name="wpms-head-code" id="wpms-head-code" style="margin: auto 0;">
                            <label for="wpms-body-code"><?php esc_html_e('Body Code', 'wpmsPro') ?></label>
                            <input onclick="showOrHideCustomCodeGoogleAnalytics()" type="checkbox" name="wpms-body-code" id="wpms-body-code" style="margin: auto 0;">
                        </div>
                    </div>
                    <div class="hidden wpms-settings-title wpms-ga-settings-title wpms-head-code-input">
                        <label class="wpms-text"><?php esc_html_e('Head Code', 'wpmsPro') ?></label>
                    </div>
                    <div class="hidden wpms-ga-settings-content wpms-head-code-input">
                        <p class="ju-description">
                            <?php
                            echo sprintf(
                                esc_html__('Add the tracking code in the %s of your website', 'wpmsPro'),
                                '<strong>' . esc_html__('<head>', 'wpmsPro') . '</strong>'
                            );
                            ?>
                        </p>
                        <textarea style="height: 100px"
                                name="wpmstm_header_code_tracking"
                                class="wpmsga_code_tracking wpms-gg-tagmanager-header-code"><?php echo trim(esc_textarea($this->gaDisconnect['wpmstm_header_code_tracking'])); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></textarea>
                    </div>
                    <div class="hidden wpms-settings-title wpms-ga-settings-title wpms-body-code-input">
                        <label class="wpms-text"><?php esc_html_e('Body Code', 'wpmsPro') ?></label>
                    </div>
                    <div class="hidden wpms-ga-settings-content wpms-body-code-input">
                        <p class="ju-description">
                            <?php
                            echo sprintf(
                                esc_html__('Add the tracking code in the %s of your website', 'wpmsPro'),
                                '<strong>' . esc_html__('<body>', 'wpmsPro') . '</strong>'
                            );
                            ?>
                        </p>
                        <textarea style="height: 100px" name="wpmstm_body_code_tracking"
                                  class="wpmsga_code_tracking wpms-gg-tagmanager-body-code"><?php echo trim(esc_textarea($this->gaDisconnect['wpmstm_body_code_tracking'])); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></textarea>
                    </div>
                </div>
                <div>
                    <button type="button" class="ju-button orange-button wpms_add_trackings" name="wpms_add_trackings" onclick="addOrUpdateTracking()"><?php esc_html_e('Save Tracking', 'wpmsPro') ?></button>
                    <button type="button" class="ju-button orange-button wpms_clear_trackings_form" name="wpms_clear_trackings_form" onclick="clearTrackingForm()"><?php esc_html_e('Clear Form', 'wpmsPro') ?></button>
                </div>
                <div data-tracking-record-id=${latestRecordId} class="m-t-20 wpms-tracking-record wpms-tracking-list-row">
                    <span><?php esc_html_e('Record ID', 'wpmsPro') ?></span>
                    <span><?php esc_html_e('Tracking Type', 'wpmsPro') ?></span>
                    <span><?php esc_html_e('Container/Measurement ID', 'wpmsPro') ?></span>
                    <span><?php esc_html_e('Custom Code in Head', 'wpmsPro') ?></span>
                    <span><?php esc_html_e('Custom Code in Body', 'wpmsPro') ?></span>
                    <span><?php esc_html_e('Action', 'wpmsPro') ?></span>
                </div>
                <div class="wpms-trackings-list">
                </div>
                <div class="wpms_left" style="display: flex;align-items: center;gap: 10px;">
                    <div class="wpms-d-flex" style="flex-direction: column;align-items: center;">
                        <button type="button" class="ju-button orange-button wpms_save_tracking_list m-t-20"
                            name="gg_service_disconnect_setting"
                            onclick="saveTrackingCodes()"
                        ><?php esc_html_e('Save Changes', 'wpmsPro'); ?></button>
                        <span class="hidden wpms-success wpms-saved-changes"><?php esc_html_e('Changes saved', 'wpmsPro'); ?></span>
                    </div>
                    <div class="hidden wpms-tracking-loader m-t-20">
                        <img width=30px src="<?php echo esc_url(WPMETASEO_ADDON_PLUGIN_URL . 'assets/images/loading.gif') ?>" class="white-loader">
                    </div>
                </div>
                <span class="hidden wpms_right wpms-danger wpms-unsaved-changes"><?php esc_html_e('* Unsaved', 'wpmsPro'); ?></span>
            </div>
        </div>
    </form>
    <script>
        // Slide toggle
        jQuery('body').on('click', '.wpms-gg-services-directly-header', function (e) {
            if (jQuery(this).hasClass('down')) {
                jQuery(this).removeClass('down').addClass('up');
            } else {
                jQuery(this).removeClass('up').addClass('down');
            }

            jQuery(this).closest('.wpmsga-advanced-box').find('.content-box').stop().slideToggle();
        });
        // Set default
        <?php if (empty($this->google_alanytics['tableid_jail'])) {
            ?>
        jQuery('.wpms-ga-setting-content').removeClass('hidden');
            <?php
        } else {
            ?>
        jQuery('.wpms-ga-setting-content').addClass('hidden');
            <?php
        }
        ?>
        // Up/Down arrow
        jQuery('body').on('click', '.wpms-ga-setting-title', function (e) {
            if (jQuery(this).hasClass('down')) {
                jQuery(this).removeClass('down').addClass('up');
            } else {
                jQuery(this).removeClass('up').addClass('down');
            }

            jQuery(this).closest('.wpms-ga-setting').find('.wpms-ga-setting-content').stop().slideToggle();
        });
    </script>
</div>