<?php // Google Analytics - Register Settings

if (!defined('ABSPATH')) exit;

function ga_google_analytics_pro_register_settings() {
	
	// register_setting( $option_group, $option_name, $sanitize_callback );
	// add_settings_section( $id, $title, $callback, $page ); 
	// add_settings_field( $id, $title, $callback, $page, $section, $args );
	
	// Configure
	register_setting('gapro_configure', 'gapro_configure', 'ga_google_analytics_pro_validate_configure');
	
	add_settings_section('configure', __('Primary Tracking', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_settings_configure', 'gapro_configure');
	add_settings_field('gapro_id',          __('GA Tracking ID',         'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_configure', 'configure', array('id' => 'gapro_id',          'section' => 'configure', 'label' => esc_html__('Enter your Tracking ID (visit Help tab for more info)', 'ga-google-analytics-pro')));
	add_settings_field('gapro_library',     __('Tracking Method',        'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_radio',    'gapro_configure', 'configure', array('id' => 'gapro_library',     'section' => 'configure', 'label' => esc_html__('Choose the tracking method', 'ga-google-analytics-pro')));
	add_settings_field('gapro_display_ads', __('Display Advertising',    'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_configure', 'configure', array('id' => 'gapro_display_ads', 'section' => 'configure', 'label' => esc_html__('Enable support for', 'ga-google-analytics-pro') .' <a target="_blank" rel="noopener noreferrer" href="https://support.google.com/analytics/answer/2444872">'. esc_html__('Display Advertising', 'ga-google-analytics-pro') .'</a>'));
	add_settings_field('gapro_link_attr',   __('Link Attribution',       'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_configure', 'configure', array('id' => 'gapro_link_attr',   'section' => 'configure', 'label' => esc_html__('Enable support for', 'ga-google-analytics-pro') .' <a target="_blank" rel="noopener noreferrer" href="https://support.google.com/analytics/answer/7377126">'. esc_html__('Enhanced Link Attribution', 'ga-google-analytics-pro') .'</a>'));
	add_settings_field('gapro_anonymize',   __('IP Anonymization',       'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_configure', 'configure', array('id' => 'gapro_anonymize',   'section' => 'configure', 'label' => esc_html__('Enable support for', 'ga-google-analytics-pro') .' <a target="_blank" rel="noopener noreferrer" href="https://support.google.com/analytics/answer/2763052">'. esc_html__('IP Anonymization', 'ga-google-analytics-pro') .'</a>'));
	add_settings_field('gapro_force_ssl',   __('Force SSL',              'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_configure', 'configure', array('id' => 'gapro_force_ssl',   'section' => 'configure', 'label' => esc_html__('Enable support for', 'ga-google-analytics-pro') .' '. esc_html__('Force SSL', 'ga-google-analytics-pro')));
	add_settings_field('gapro_location',    __('Tracking Code Location', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_radio',    'gapro_configure', 'configure', array('id' => 'gapro_location',    'section' => 'configure', 'label' => esc_html__('Choose location of tracking code', 'ga-google-analytics-pro')));
	add_settings_field('tracker_object',    __('Custom Tracker Objects', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_textarea', 'gapro_configure', 'configure', array('id' => 'tracker_object',    'section' => 'configure', 'label' => ga_google_analytics_pro_label_tracker_object()));
	add_settings_field('custom_ga_code',    __('Custom GA Code',         'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_textarea', 'gapro_configure', 'configure', array('id' => 'custom_ga_code',    'section' => 'configure', 'label' => ga_google_analytics_pro_label_custom_ga_code()));
	add_settings_field('tracking_preview',  __('Tracking Code Preview',  'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_preview',  'gapro_configure', 'configure', array('id' => 'tracking_preview',  'section' => 'configure', 'label' => esc_html__('Preview of primary tracking code. This code will be added to your web pages.', 'ga-google-analytics-pro'), 'preview' => 0));
	
	// Customize
	register_setting('gapro_customize', 'gapro_customize', 'ga_google_analytics_pro_validate_customize');
	
	add_settings_section('custom1', __('Custom Code #1', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_settings_custom', 'gapro_customize');
	add_settings_field('custom1_code',     __('Custom Code',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_textarea', 'gapro_customize', 'custom1', array('id' => 'custom1_code',     'section' => 'customize', 'label' => esc_html__('Custom Code to include on the post IDs entered below', 'ga-google-analytics-pro')));
	add_settings_field('custom1_admin',    __('Enable Admin',    'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_customize', 'custom1', array('id' => 'custom1_admin',    'section' => 'customize', 'label' => esc_html__('Add code to all pages in the Admin Area',              'ga-google-analytics-pro')));
	add_settings_field('custom1_frontend', __('Enable Frontend', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_customize', 'custom1', array('id' => 'custom1_frontend', 'section' => 'customize', 'label' => esc_html__('Add code to all pages on the frontend',                'ga-google-analytics-pro')));
	add_settings_field('custom1_postids',  __('Include IDs',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_customize', 'custom1', array('id' => 'custom1_postids',  'section' => 'customize', 'label' => esc_html__('Post IDs for which this code should be included',      'ga-google-analytics-pro')));
	add_settings_field('custom1_exclude',  __('Exclude IDs',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_customize', 'custom1', array('id' => 'custom1_exclude',  'section' => 'customize', 'label' => esc_html__('Post IDs for which this code should be excluded',      'ga-google-analytics-pro')));
	add_settings_field('custom1_position', __('Location',        'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_select',   'gapro_customize', 'custom1', array('id' => 'custom1_position', 'section' => 'customize', 'label' => esc_html__('Location for this custom code',                        'ga-google-analytics-pro')));
	add_settings_field('custom1_preview',  __('Preview',         'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_preview',  'gapro_customize', 'custom1', array('id' => 'custom1_preview',  'section' => 'customize', 'label' => esc_html__('Preview of Custom Custom Code #1',                     'ga-google-analytics-pro'), 'preview' => 1));
	
	add_settings_section('custom2', __('Custom Code #2', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_settings_custom', 'gapro_customize');
	add_settings_field('custom2_code',     __('Custom Code',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_textarea', 'gapro_customize', 'custom2', array('id' => 'custom2_code',     'section' => 'customize', 'label' => esc_html__('Custom Code to include on the post IDs entered below', 'ga-google-analytics-pro')));
	add_settings_field('custom2_admin',    __('Enable Admin',    'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_customize', 'custom2', array('id' => 'custom2_admin',    'section' => 'customize', 'label' => esc_html__('Add code to all pages in the Admin Area',              'ga-google-analytics-pro')));
	add_settings_field('custom2_frontend', __('Enable Frontend', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_customize', 'custom2', array('id' => 'custom2_frontend', 'section' => 'customize', 'label' => esc_html__('Add code to all pages on the frontend',                'ga-google-analytics-pro')));
	add_settings_field('custom2_postids',  __('Include IDs',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_customize', 'custom2', array('id' => 'custom2_postids',  'section' => 'customize', 'label' => esc_html__('Post IDs for which this code should be included',      'ga-google-analytics-pro')));
	add_settings_field('custom2_exclude',  __('Exclude IDs',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_customize', 'custom2', array('id' => 'custom2_exclude',  'section' => 'customize', 'label' => esc_html__('Post IDs for which this code should be excluded',      'ga-google-analytics-pro')));
	add_settings_field('custom2_position', __('Location',        'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_select',   'gapro_customize', 'custom2', array('id' => 'custom2_position', 'section' => 'customize', 'label' => esc_html__('Location for this custom code',                        'ga-google-analytics-pro')));
	add_settings_field('custom2_preview',  __('Preview',         'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_preview',  'gapro_customize', 'custom2', array('id' => 'custom2_preview',  'section' => 'customize', 'label' => esc_html__('Preview of Custom Custom Code #2',                     'ga-google-analytics-pro'), 'preview' => 2));
	
	add_settings_section('custom3', __('Custom Code #3', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_settings_custom', 'gapro_customize');
	add_settings_field('custom3_code',     __('Custom Code',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_textarea', 'gapro_customize', 'custom3', array('id' => 'custom3_code',     'section' => 'customize', 'label' => esc_html__('Custom Code to include on the post IDs entered below', 'ga-google-analytics-pro')));
	add_settings_field('custom3_admin',    __('Enable Admin',    'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_customize', 'custom3', array('id' => 'custom3_admin',    'section' => 'customize', 'label' => esc_html__('Add code to all pages in the Admin Area',              'ga-google-analytics-pro')));
	add_settings_field('custom3_frontend', __('Enable Frontend', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_customize', 'custom3', array('id' => 'custom3_frontend', 'section' => 'customize', 'label' => esc_html__('Add code to all pages on the frontend',                'ga-google-analytics-pro')));
	add_settings_field('custom3_postids',  __('Include IDs',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_customize', 'custom3', array('id' => 'custom3_postids',  'section' => 'customize', 'label' => esc_html__('Post IDs for which this code should be included',      'ga-google-analytics-pro')));
	add_settings_field('custom3_exclude',  __('Exclude IDs',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_customize', 'custom3', array('id' => 'custom3_exclude',  'section' => 'customize', 'label' => esc_html__('Post IDs for which this code should be excluded',      'ga-google-analytics-pro')));
	add_settings_field('custom3_position', __('Location',        'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_select',   'gapro_customize', 'custom3', array('id' => 'custom3_position', 'section' => 'customize', 'label' => esc_html__('Location for this custom code',                        'ga-google-analytics-pro')));
	add_settings_field('custom3_preview',  __('Preview',         'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_preview',  'gapro_customize', 'custom3', array('id' => 'custom3_preview',  'section' => 'customize', 'label' => esc_html__('Preview of Custom Custom Code #3',                     'ga-google-analytics-pro'), 'preview' => 3));
	
	add_settings_section('custom4', __('Custom Code #4', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_settings_custom', 'gapro_customize');
	add_settings_field('custom4_code',     __('Custom Code',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_textarea', 'gapro_customize', 'custom4', array('id' => 'custom4_code',     'section' => 'customize', 'label' => esc_html__('Custom Code to include on the post IDs entered below', 'ga-google-analytics-pro')));
	add_settings_field('custom4_admin',    __('Enable Admin',    'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_customize', 'custom4', array('id' => 'custom4_admin',    'section' => 'customize', 'label' => esc_html__('Add code to all pages in the Admin Area',              'ga-google-analytics-pro')));
	add_settings_field('custom4_frontend', __('Enable Frontend', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_customize', 'custom4', array('id' => 'custom4_frontend', 'section' => 'customize', 'label' => esc_html__('Add code to all pages on the frontend',                'ga-google-analytics-pro')));
	add_settings_field('custom4_postids',  __('Include IDs',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_customize', 'custom4', array('id' => 'custom4_postids',  'section' => 'customize', 'label' => esc_html__('Post IDs for which this code should be included',      'ga-google-analytics-pro')));
	add_settings_field('custom4_exclude',  __('Exclude IDs',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_customize', 'custom4', array('id' => 'custom4_exclude',  'section' => 'customize', 'label' => esc_html__('Post IDs for which this code should be excluded',      'ga-google-analytics-pro')));
	add_settings_field('custom4_position', __('Location',        'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_select',   'gapro_customize', 'custom4', array('id' => 'custom4_position', 'section' => 'customize', 'label' => esc_html__('Location for this custom code',                        'ga-google-analytics-pro')));
	add_settings_field('custom4_preview',  __('Preview',         'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_preview',  'gapro_customize', 'custom4', array('id' => 'custom4_preview',  'section' => 'customize', 'label' => esc_html__('Preview of Custom Custom Code #4',                     'ga-google-analytics-pro'), 'preview' => 4));
	
	add_settings_section('custom5', __('Custom Code #5', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_settings_custom', 'gapro_customize');
	add_settings_field('custom5_code',     __('Custom Code',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_textarea', 'gapro_customize', 'custom5', array('id' => 'custom5_code',     'section' => 'customize', 'label' => esc_html__('Custom Code to include on the post IDs entered below', 'ga-google-analytics-pro')));
	add_settings_field('custom5_admin',    __('Enable Admin',    'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_customize', 'custom5', array('id' => 'custom5_admin',    'section' => 'customize', 'label' => esc_html__('Add code to all pages in the Admin Area',              'ga-google-analytics-pro')));
	add_settings_field('custom5_frontend', __('Enable Frontend', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_customize', 'custom5', array('id' => 'custom5_frontend', 'section' => 'customize', 'label' => esc_html__('Add code to all pages on the frontend',                'ga-google-analytics-pro')));
	add_settings_field('custom5_postids',  __('Include IDs',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_customize', 'custom5', array('id' => 'custom5_postids',  'section' => 'customize', 'label' => esc_html__('Post IDs for which this code should be included',      'ga-google-analytics-pro')));
	add_settings_field('custom5_exclude',  __('Exclude IDs',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_customize', 'custom5', array('id' => 'custom5_exclude',  'section' => 'customize', 'label' => esc_html__('Post IDs for which this code should be excluded',      'ga-google-analytics-pro')));
	add_settings_field('custom5_position', __('Location',        'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_select',   'gapro_customize', 'custom5', array('id' => 'custom5_position', 'section' => 'customize', 'label' => esc_html__('Location for this custom code',                        'ga-google-analytics-pro')));
	add_settings_field('custom5_preview',  __('Preview',         'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_preview',  'gapro_customize', 'custom5', array('id' => 'custom5_preview',  'section' => 'customize', 'label' => esc_html__('Preview of Custom Custom Code #5',                     'ga-google-analytics-pro'), 'preview' => 5));
	
	add_settings_section('custom6', __('Custom Code #6', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_settings_custom', 'gapro_customize');
	add_settings_field('custom6_code',     __('Custom Code',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_textarea', 'gapro_customize', 'custom6', array('id' => 'custom6_code',     'section' => 'customize', 'label' => esc_html__('Custom Code to include on the post IDs entered below', 'ga-google-analytics-pro')));
	add_settings_field('custom6_admin',    __('Enable Admin',    'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_customize', 'custom6', array('id' => 'custom6_admin',    'section' => 'customize', 'label' => esc_html__('Add code to all pages in the Admin Area',              'ga-google-analytics-pro')));
	add_settings_field('custom6_frontend', __('Enable Frontend', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_customize', 'custom6', array('id' => 'custom6_frontend', 'section' => 'customize', 'label' => esc_html__('Add code to all pages on the frontend',                'ga-google-analytics-pro')));
	add_settings_field('custom6_postids',  __('Include IDs',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_customize', 'custom6', array('id' => 'custom6_postids',  'section' => 'customize', 'label' => esc_html__('Post IDs for which this code should be included',      'ga-google-analytics-pro')));
	add_settings_field('custom6_exclude',  __('Exclude IDs',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_customize', 'custom6', array('id' => 'custom6_exclude',  'section' => 'customize', 'label' => esc_html__('Post IDs for which this code should be excluded',      'ga-google-analytics-pro')));
	add_settings_field('custom6_position', __('Location',        'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_select',   'gapro_customize', 'custom6', array('id' => 'custom6_position', 'section' => 'customize', 'label' => esc_html__('Location for this custom code',                        'ga-google-analytics-pro')));
	add_settings_field('custom6_preview',  __('Preview',         'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_preview',  'gapro_customize', 'custom6', array('id' => 'custom6_preview',  'section' => 'customize', 'label' => esc_html__('Preview of Custom Custom Code #6',                     'ga-google-analytics-pro'), 'preview' => 6));
	
	add_settings_section('custom7', __('Custom Code #7', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_settings_custom', 'gapro_customize');
	add_settings_field('custom7_code',     __('Custom Code',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_textarea', 'gapro_customize', 'custom7', array('id' => 'custom7_code',     'section' => 'customize', 'label' => esc_html__('Custom Code to include on the post IDs entered below', 'ga-google-analytics-pro')));
	add_settings_field('custom7_admin',    __('Enable Admin',    'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_customize', 'custom7', array('id' => 'custom7_admin',    'section' => 'customize', 'label' => esc_html__('Add code to all pages in the Admin Area',              'ga-google-analytics-pro')));
	add_settings_field('custom7_frontend', __('Enable Frontend', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_customize', 'custom7', array('id' => 'custom7_frontend', 'section' => 'customize', 'label' => esc_html__('Add code to all pages on the frontend',                'ga-google-analytics-pro')));
	add_settings_field('custom7_postids',  __('Include IDs',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_customize', 'custom7', array('id' => 'custom7_postids',  'section' => 'customize', 'label' => esc_html__('Post IDs for which this code should be included',      'ga-google-analytics-pro')));
	add_settings_field('custom7_exclude',  __('Exclude IDs',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_customize', 'custom7', array('id' => 'custom7_exclude',  'section' => 'customize', 'label' => esc_html__('Post IDs for which this code should be excluded',      'ga-google-analytics-pro')));
	add_settings_field('custom7_position', __('Location',        'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_select',   'gapro_customize', 'custom7', array('id' => 'custom7_position', 'section' => 'customize', 'label' => esc_html__('Location for this custom code',                        'ga-google-analytics-pro')));
	add_settings_field('custom7_preview',  __('Preview',         'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_preview',  'gapro_customize', 'custom7', array('id' => 'custom7_preview',  'section' => 'customize', 'label' => esc_html__('Preview of Custom Custom Code #7',                     'ga-google-analytics-pro'), 'preview' => 7));
	
	add_settings_section('custom8', __('Custom Code #8', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_settings_custom', 'gapro_customize');
	add_settings_field('custom8_code',     __('Custom Code',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_textarea', 'gapro_customize', 'custom8', array('id' => 'custom8_code',     'section' => 'customize', 'label' => esc_html__('Custom Code to include on the post IDs entered below', 'ga-google-analytics-pro')));
	add_settings_field('custom8_admin',    __('Enable Admin',    'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_customize', 'custom8', array('id' => 'custom8_admin',    'section' => 'customize', 'label' => esc_html__('Add code to all pages in the Admin Area',              'ga-google-analytics-pro')));
	add_settings_field('custom8_frontend', __('Enable Frontend', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_customize', 'custom8', array('id' => 'custom8_frontend', 'section' => 'customize', 'label' => esc_html__('Add code to all pages on the frontend',                'ga-google-analytics-pro')));
	add_settings_field('custom8_postids',  __('Include IDs',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_customize', 'custom8', array('id' => 'custom8_postids',  'section' => 'customize', 'label' => esc_html__('Post IDs for which this code should be included',      'ga-google-analytics-pro')));
	add_settings_field('custom8_exclude',  __('Exclude IDs',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_customize', 'custom8', array('id' => 'custom8_exclude',  'section' => 'customize', 'label' => esc_html__('Post IDs for which this code should be excluded',      'ga-google-analytics-pro')));
	add_settings_field('custom8_position', __('Location',        'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_select',   'gapro_customize', 'custom8', array('id' => 'custom8_position', 'section' => 'customize', 'label' => esc_html__('Location for this custom code',                        'ga-google-analytics-pro')));
	add_settings_field('custom8_preview',  __('Preview',         'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_preview',  'gapro_customize', 'custom8', array('id' => 'custom8_preview',  'section' => 'customize', 'label' => esc_html__('Preview of Custom Custom Code #8',                     'ga-google-analytics-pro'), 'preview' => 8));
	
	// Advanced
	register_setting('gapro_advanced', 'gapro_advanced', 'ga_google_analytics_pro_validate_advanced');
	
	add_settings_section('advanced', __('Advanced Options', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_settings_advanced', 'gapro_advanced');
	add_settings_field('login_page',     __('Login Page',    'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_advanced', 'advanced', array('id' => 'login_page',     'section' => 'advanced', 'label' => esc_html__('Enable GA tracking on the WP Login Page',        'ga-google-analytics-pro')));
	add_settings_field('admin_area',     __('Admin Area',    'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_advanced', 'advanced', array('id' => 'admin_area',     'section' => 'advanced', 'label' => esc_html__('Enable GA tracking in the WP Admin Area',        'ga-google-analytics-pro')));
	add_settings_field('disable_admin',  __('Admin Users',   'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_advanced', 'advanced', array('id' => 'disable_admin',  'section' => 'advanced', 'label' => esc_html__('Disable tracking of Admin-level users',          'ga-google-analytics-pro')));
	add_settings_field('disable_logged', __('Logged Users',  'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_advanced', 'advanced', array('id' => 'disable_logged', 'section' => 'advanced', 'label' => esc_html__('Disable tracking of all logged-in users',        'ga-google-analytics-pro')));
	add_settings_field('reset_options',  __('Reset Options', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_reset',    'gapro_advanced', 'advanced', array('id' => 'reset_options',  'section' => 'advanced', 'label' => esc_html__('Restore default plugin options',                 'ga-google-analytics-pro')));
	add_settings_field('rate-plugin',    __('Rate Plugin',   'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_rate',     'gapro_advanced', 'advanced', array('id' => 'rate-plugin',    'section' => 'advanced', 'label' => esc_html__('Show support with a 5-star rating&nbsp;&raquo;', 'ga-google-analytics-pro')));
	
	add_settings_section('disable', __('Disable Tracking', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_settings_disable', 'gapro_advanced');
	add_settings_field('disable_post_ids',   __('Post IDs',   'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_advanced', 'disable', array('id' => 'disable_post_ids',   'section' => 'advanced', 'label' => esc_html__('Disable for specific Post IDs (comma-separated)',   'ga-google-analytics-pro')));
	add_settings_field('disable_user_roles', __('User Roles', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_advanced', 'disable', array('id' => 'disable_user_roles', 'section' => 'advanced', 'label' => esc_html__('Disable for specific User Roles (comma-separated)', 'ga-google-analytics-pro')));
	add_settings_field('disable_post_types', __('Post Types', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_advanced', 'disable', array('id' => 'disable_post_types', 'section' => 'advanced', 'label' => esc_html__('Disable for specific Post Types (comma-separated)', 'ga-google-analytics-pro')));
	add_settings_field('disable_archives',   __('Archives',   'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_advanced', 'disable', array('id' => 'disable_archives',   'section' => 'advanced', 'label' => esc_html__('Disable on archive views',  'ga-google-analytics-pro')));
	add_settings_field('disable_search',     __('Search',     'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_advanced', 'disable', array('id' => 'disable_search',     'section' => 'advanced', 'label' => esc_html__('Disable on search results', 'ga-google-analytics-pro')));
	
	// Opt Out
	register_setting('gapro_optout', 'gapro_optout', 'ga_google_analytics_pro_validate_optout');
	
	add_settings_section('optout', __('Opt Out', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_settings_optout', 'gapro_optout');
	add_settings_field('optout_enable',   __('Enable Opt-Out',          'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_optout', 'optout', array('id' => 'optout_enable',  'section' => 'optout', 'label' => esc_html__('Display Opt-Out box on the front end',         'ga-google-analytics-pro')));
	add_settings_field('optin_require',   __('Require Opt-In',          'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_optout', 'optout', array('id' => 'optin_require',  'section' => 'optout', 'label' => esc_html__('Disable all tracking until user opts in',      'ga-google-analytics-pro')));
	add_settings_field('after_optin',     __('After Opt-In/Opt-Out',    'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_select',   'gapro_optout', 'optout', array('id' => 'after_optin',    'section' => 'optout', 'label' => esc_html__('What to do when the user opts in or out',      'ga-google-analytics-pro')));
	add_settings_field('optout_message',  __('Opt-Out Message',         'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_textarea', 'gapro_optout', 'optout', array('id' => 'optout_message', 'section' => 'optout', 'label' => esc_html__('Opt-Out message, must include',                'ga-google-analytics-pro') .' <span class="gapro-code">[ga_pro_optout_link]</span> '. esc_html__('to display the Opt-Out Link', 'ga-google-analytics-pro')));
	add_settings_field('success_optout',  __('Opt-Out Success Message', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_optout', 'optout', array('id' => 'success_optout', 'section' => 'optout', 'label' => esc_html__('Message displayed after user opts out',        'ga-google-analytics-pro')));
	add_settings_field('success_optin',   __('Opt-In Success Message',  'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_optout', 'optout', array('id' => 'success_optin',  'section' => 'optout', 'label' => esc_html__('Message displayed after user opts in',         'ga-google-analytics-pro')));
	add_settings_field('info_text',       __('More Info Text',          'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_optout', 'optout', array('id' => 'info_text',      'section' => 'optout', 'label' => esc_html__('Text for the Information Link',                'ga-google-analytics-pro')));
	add_settings_field('optout_text',     __('Opt-Out Link',            'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_optout', 'optout', array('id' => 'optout_text',    'section' => 'optout', 'label' => esc_html__('Text for the Opt-Out Link',                    'ga-google-analytics-pro')));
	add_settings_field('optin_text',      __('Opt-In Link',             'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_optout', 'optout', array('id' => 'optin_text',     'section' => 'optout', 'label' => esc_html__('Text for the Opt-In Link',                     'ga-google-analytics-pro')));
	add_settings_field('css_location',    __('Box Location',            'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_select',   'gapro_optout', 'optout', array('id' => 'css_location',   'section' => 'optout', 'label' => esc_html__('Location of Opt-Out Box',                      'ga-google-analytics-pro')));
	add_settings_field('disable_hide',    __('Close Button',            'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_optout', 'optout', array('id' => 'disable_hide',   'section' => 'optout', 'label' => esc_html__('When user clicks the close (x) button, minimize the box instead of hiding', 'ga-google-analytics-pro')));
	
	add_settings_section('optbox', __('Box Styles', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_settings_optbox', 'gapro_optout');
	add_settings_field('css_color_text',  __('Text Color',         'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_optout', 'optbox', array('id' => 'css_color_text',  'section' => 'optout', 'label' => esc_html__('Text color',       'ga-google-analytics-pro')));
	add_settings_field('css_color_bg',    __('Background Color',   'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_optout', 'optbox', array('id' => 'css_color_bg',    'section' => 'optout', 'label' => esc_html__('Background color', 'ga-google-analytics-pro')));
	add_settings_field('css_color_link',  __('Link Color',         'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_optout', 'optbox', array('id' => 'css_color_link',  'section' => 'optout', 'label' => esc_html__('Link color',       'ga-google-analytics-pro')));
	add_settings_field('css_color_hover', __('Link Hover',         'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_text',     'gapro_optout', 'optbox', array('id' => 'css_color_hover', 'section' => 'optout', 'label' => esc_html__('Link hover color', 'ga-google-analytics-pro')));
	add_settings_field('css_custom',      __('Custom CSS',         'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_textarea', 'gapro_optout', 'optbox', array('id' => 'css_custom',      'section' => 'optout', 'label' => esc_html__('Optional custom styles for the Opt-Opt Box (do not include any &lt;style&gt; tags)', 'ga-google-analytics-pro')));
	add_settings_field('disable_styles',  __('Disable Stylesheet', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_optout', 'optbox', array('id' => 'disable_styles',  'section' => 'optout', 'label' => esc_html__('Disable Opt-Out Box stylesheet', 'ga-google-analytics-pro')));
	
	add_settings_section('optcode', __('Custom Code', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_settings_optcode', 'gapro_optout');
	add_settings_field('disable_custom1', __('Custom Code #1', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_optout', 'optcode', array('id' => 'disable_custom1', 'section' => 'optout', 'label' => esc_html__('Disable Custom Code #1 if the user opts out', 'ga-google-analytics-pro')));
	add_settings_field('disable_custom2', __('Custom Code #2', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_optout', 'optcode', array('id' => 'disable_custom2', 'section' => 'optout', 'label' => esc_html__('Disable Custom Code #2 if the user opts out', 'ga-google-analytics-pro')));
	add_settings_field('disable_custom3', __('Custom Code #3', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_optout', 'optcode', array('id' => 'disable_custom3', 'section' => 'optout', 'label' => esc_html__('Disable Custom Code #3 if the user opts out', 'ga-google-analytics-pro')));
	add_settings_field('disable_custom4', __('Custom Code #4', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_optout', 'optcode', array('id' => 'disable_custom4', 'section' => 'optout', 'label' => esc_html__('Disable Custom Code #4 if the user opts out', 'ga-google-analytics-pro')));
	add_settings_field('disable_custom5', __('Custom Code #5', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_optout', 'optcode', array('id' => 'disable_custom5', 'section' => 'optout', 'label' => esc_html__('Disable Custom Code #5 if the user opts out', 'ga-google-analytics-pro')));
	add_settings_field('disable_custom6', __('Custom Code #6', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_optout', 'optcode', array('id' => 'disable_custom6', 'section' => 'optout', 'label' => esc_html__('Disable Custom Code #6 if the user opts out', 'ga-google-analytics-pro')));
	add_settings_field('disable_custom7', __('Custom Code #7', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_optout', 'optcode', array('id' => 'disable_custom7', 'section' => 'optout', 'label' => esc_html__('Disable Custom Code #7 if the user opts out', 'ga-google-analytics-pro')));
	add_settings_field('disable_custom8', __('Custom Code #8', 'ga-google-analytics-pro'), 'ga_google_analytics_pro_callback_checkbox', 'gapro_optout', 'optcode', array('id' => 'disable_custom8', 'section' => 'optout', 'label' => esc_html__('Disable Custom Code #8 if the user opts out', 'ga-google-analytics-pro')));
	
}