ctm_host = "https://api.calltrackingmetrics.com"; add_action('admin_init', array(&$this, 'init_plugin')); add_action('admin_menu', array(&$this, 'create_ctm_options')); } function init_plugin() { register_setting("call-tracking-metrics", "ctm_api_key"); register_setting("call-tracking-metrics", "ctm_api_secret"); register_setting("call-tracking-metrics", "ctm_api_active_key"); register_setting("call-tracking-metrics", "ctm_api_active_secret"); register_setting("call-tracking-metrics", "ctm_api_auth_account"); register_setting("call-tracking-metrics", "call_track_account_script"); register_setting("call-tracking-metrics", "ctm_api_dashboard_enabled"); register_setting("call-tracking-metrics", "ctm_api_tracking_enabled"); register_setting("call-tracking-metrics", "ctm_api_cf7_enabled"); register_setting("call-tracking-metrics", "ctm_api_gf_enabled"); register_setting("call-tracking-metrics", "ctm_api_cf7_logs"); register_setting("call-tracking-metrics", "ctm_api_gf_logs"); } function dashboard_enabled() { return get_option('ctm_api_dashboard_enabled', true); } function tracking_enabled() { return get_option('ctm_api_tracking_enabled', true); } function cf7_enabled() { return get_option('ctm_api_cf7_enabled', true); } function cf7_active() { return is_plugin_active('contact-form-7/wp-contact-form-7.php'); } function gf_enabled() { return get_option('ctm_api_gf_enabled', true); } function gf_active() { return is_plugin_active('gravityforms/gravityforms.php'); } function get_tracking_script() { if ( !$this->authorizing() || !$this->authorized() ) { if ( substr(get_option('call_track_account_script'),0,2) == '//' ) { $ctm_s = ''; } else { $ctm_s = get_option('call_track_account_script'); } return $ctm_s; } else { return ''; } } function authorizing() { return ( get_option("ctm_api_key") && get_option("ctm_api_secret") ); } function authorized() { $this->update_account(); return ( get_option("ctm_api_auth_account") || !get_option("ctm_api_key") || !get_option("ctm_api_secret") ); } function unauthorized_msg() { return 'Invalid credentials. Please check your Account Settings and try again.'; } function update_account() { if ( get_option("ctm_api_auth_account") && ( get_option("ctm_api_key") == get_option("ctm_api_active_key") ) && ( get_option("ctm_api_secret") == get_option("ctm_api_active_secret") ) && $this->authorizing() ) { return; } else { update_option("ctm_api_active_key", get_option("ctm_api_key")); update_option("ctm_api_active_secret", get_option("ctm_api_secret")); update_option("ctm_api_auth_account", ""); if (!$this->authorizing()) { return; } else { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $this->ctm_host . "/api/v1/accounts/current.json"); curl_setopt($curl, CURLOPT_TIMEOUT, 30); curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Basic " . base64_encode(get_option('ctm_api_key') . ":" . get_option('ctm_api_secret')))); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $res = curl_exec($curl); if (!is_bool($res)) { $data = json_decode($res, true); if ($data && isset($data["account"])) update_option("ctm_api_auth_account", $data["account"]); } curl_close($curl); } } }//update_account public function create_ctm_options() { if (current_user_can('manage_options')) { add_options_page( 'CallTrackingMetrics', 'CallTrackingMetrics', 'administrator', 'call-tracking-metrics', array(&$this,'create_ctm_settings_page') ); } } function create_ctm_settings_page() { if ( !current_user_can('manage_options') ) { wp_die( 'You do not have sufficient permissions to access this page.' ); } $authorizing = $this->authorizing(); $authorized = $this->authorized(); ?>

Settings saved

'; } } ?>

Account enter your account details to use this plugin

Enter your CallTrackingMetrics account details below to get started.

Don't have an account? Sign up now — it only takes a few minutes.

unauthorized_msg(); ?>


These can found in the API Integration section of your Account Settings.
style="display:none">

Tracking Code Manually install the tracking code on this website

If you do not wish to use the API, you may manually enter your account's tracking code below.

' ); } else { echo htmlspecialchars( get_option('call_track_account_script') ); } ?>" style="width:100%;text-align:center;padding:7px;font-size:13px;max-width:400px">
style="display:none">

Settings customize the behavior of this plugin

Displays a simple widget in your WordPress Dashboard showing call volume by day for the last 30 days.
This code can also be found on your Tracking Code page.
style="display:none">

Integrations send your WordPress forms into CallTrackingMetrics automatically

These integrations do not require any extra setup — simply create a form with a phone number field, submit the form at least once, and a FormReactor will appear in your CallTrackingMetrics account automatically so you can customize how to react to form submissions.

Contact Form 7 uses a simple markup structure to embed forms anywhere on your WordPress website. cf7_active()) { ?>InstallSettings Website Supportcf7_active()) { ?> Logs ▾
cf7_enabled() ) : ?>

Note: It is required to use a form that captures a telephone number (input type="tel") in order for Contact Form 7 to integrate properly with our FormReactor. For more information, see Using the CallTrackingMetrics WordPress Plugin

Note: If you will request international (non-U.S.) phone numbers with your Contact Form 7 forms, we recommend using the plugin International Telephone Input for Contact Form 7 to avoid possible formatting issues with our FormReactor. Both [tel] and [intl_tel] are now supported as phone inputs.

Gravity Forms are created using a drag-and-drop editor with support for over 30 input types. gf_active()) { ?>InstallSettings Website Supportgf_active()) { ?> Logs ▾
gf_enabled() ) : ?>

Note: It is required to use a form that captures a telephone number (input type="tel") in order for Gravity Forms to integrate properly with our FormReactor. For more information, see Using the CallTrackingMetrics WordPress Plugin