public static function print_on_blank_field() { $field_name = 'on_blank'; printf('<select id="%1$s" name="nelioab_settings[%1$s]" %2$s>', $field_name, self::get_basic_details()); ?> <option value='1'><?php _e('Force New Tab (add «target="_blank"» attribute)', 'nelioab'); ?> </option> <option value='0'<?php if (!NelioABSettings::use_outwards_navigations_blank()) { echo ' selected="selected"'; } ?> ><?php _e('Do Not Force New Tab', 'nelioab'); ?> </option> </select> <div class="the-descr" style="display:none;"><span class="description"><?php _e('When using external page conversion actions, a conversion should be counted when users access the external page. However, Nelio A/B Testing has no access to pages outside WordPress, which means it has to count a conversion when a user clicks on the link that will take the user to that page. Whenever such a click occurs, Nelio A/B Testing will detect it and send the tracking information to Nelio\'s servers (which takes a few miliseconds). If you want the website to be as responsive as possible, select «Force New Tab». This way, links will be opened in a new tab and the synchronization process will occur in the original tab. If, on the other hand, you don\'t want pages to be opened in new tabs, select «Do Not Force New Tab».', 'nelioab'); ?> </span></div><?php }
/** * This function registers Nelio tracking scripts. * * Our tracking scripts are: * * * `nelioab_appengine_script`: a script pointing to Google Cloud Storage, * with all the information about running experiments. * * `nelioab_tracking_script`: our tracking script. * * It also initializes some params that will be used by our tracking * script. They'll be available by means of the object `NelioABParams`. * * @return void * * @see self::load_tracking_script * * @since 3.3.2 */ public function register_tracking_script() { wp_register_script('nelioab_appengine_script', '//storage.googleapis.com/' . NELIOAB_BACKEND_NAME . '/' . NelioABAccountSettings::get_site_id() . '.js', array(), NELIOAB_PLUGIN_VERSION); wp_register_script('nelioab_tracking_script', nelioab_asset_link('/js/tracking.min.js', false), array('jquery', 'nelioab_appengine_script'), NELIOAB_PLUGIN_VERSION); // Prepare some information for our tracking script (such as the page we're in) /** @var $aux NelioABAlternativeExperimentController */ $aux = $this->controllers['alt-exp']; $current_id = $this->get_queried_post_id(); if ($aux->is_post_in_a_post_alt_exp($current_id)) { $current_actual_id = intval($aux->get_post_alternative($current_id)); } elseif ($aux->is_post_in_a_headline_alt_exp($current_id)) { $headline_data = $aux->get_headline_experiment_and_alternative($current_id); /** @var NelioABAlternative $alternative */ $alternative = $headline_data['alt']; $val = $alternative->get_value(); $current_actual_id = $val['id']; } else { $current_actual_id = $current_id; } $current_page_ids = array('currentId' => $current_id, 'currentActualId' => $current_actual_id); // OUTWARDS NAVIGATIONS USING TARGET="_BLANK" $misc['useOutwardsNavigationsBlank'] = NelioABSettings::use_outwards_navigations_blank(); $this->tracking_script_params = array('ajaxurl' => admin_url('admin-ajax.php', is_ssl() ? 'https' : 'http'), 'version' => NELIOAB_PLUGIN_VERSION, 'customer' => NelioABAccountSettings::get_customer_id(), 'site' => NelioABAccountSettings::get_site_id(), 'backend' => array('domain' => NELIOAB_BACKEND_DOMAIN, 'version' => NELIOAB_BACKEND_VERSION), 'misc' => $misc, 'sync' => array('headlines' => array()), 'info' => $current_page_ids, 'ieUrl' => preg_replace('/^https?:/', '', NELIOAB_URL . '/ajax/iesupport.php'), 'wasPostRequest' => 'POST' === $_SERVER['REQUEST_METHOD']); }