Plugin Directory

Changeset 3152626


Ignore:
Timestamp:
09/16/2024 12:34:33 PM (19 months ago)
Author:
flag92
Message:

Add Google Analytics 3 & 4

Location:
click-n-chat/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • click-n-chat/trunk/README.txt

    r3151526 r3152626  
    55Tested up to: 6.6
    66Requires PHP: 5.6.4
    7 Stable tag: 1.0.0
     7Stable tag: 1.0.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5959   - Boosted Engagement: By providing multiple contact options and responsive auto-replies, the plugin helps boost user engagement and satisfaction, leading to better customer interaction and potential conversions.
    6060
    61 7. **Future-Proof and Extensible**:
     617. **Google Analytics**
     62   - Google Analytics 4 and Universal Analytics (Analytics 3) track widget clicks in your WordPress plugin, providing insights on user interactions and engagement.
     63
     648. **Future-Proof and Extensible**:
    6265   - Regular Updates: The plugin is regularly updated to ensure compatibility with the latest versions of WordPress and the supported social platforms.
    6366   - Extensible Architecture: Developers can extend the plugins functionality through hooks and filters, allowing for further customization and integration with other tools and services.
     
    108111== Changelog ==
    109112
     113= 1.0.1 16 September 2024 =
     114Add Google Analytics 3 & 4
     115
    110116= 1.0.0 09 September 2024 =
    111117* Add availability for week days
  • click-n-chat/trunk/admin/assets/css/admin-style.css

    r3149305 r3152626  
    319319    bottom: 90px;
    320320    right: 40px;
    321     width: 350px;
     321    width: 300px;
    322322    background-color: #ffffff;
    323323    border-radius: 40px 40px 5px 5px;
  • click-n-chat/trunk/admin/includes/click_n_chat_menu.php

    r3149305 r3152626  
    5656                </li>
    5757                <li class="nav-item">
     58                    <a href="?page=wa-clicknchat&tab=analytics" class="nav-tab <?php echo esc_html($active_tab == 'analytics' ? 'nav-tab-active' : ''); ?>">Analytics</a>
     59                </li>
     60                <li class="nav-item">
    5861                    <a href="?page=wa-clicknchat&tab=woocommerce" class="nav-tab <?php echo esc_html($active_tab == 'woocommerce' ? 'nav-tab-active' : ''); ?>">WooCommerce</a>
    5962                </li>
     
    6366                <li class="nav-item">
    6467                    <a href="?page=wa-clicknchat&tab=autoreply" class="nav-tab <?php echo esc_html($active_tab == 'autoreply' ? 'nav-tab-active' : ''); ?>">Auto Reply</a>
    65                 </li>
    66                 <li class="nav-item">
    67                     <a href="?page=wa-clicknchat&tab=analytics" class="nav-tab <?php echo esc_html($active_tab == 'analytics' ? 'nav-tab-active' : ''); ?>">Analytics</a>
    6868                </li>
    6969                <li class="nav-item">
  • click-n-chat/trunk/admin/includes/pages/click_n_chat_analytics.php

    r3149305 r3152626  
    55
    66function click_n_chat_analytics() {
     7    global $wpdb;
     8    $nonce = 'setting-user';
     9    if (isset($_POST['action'])) {
     10        if (  ! wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['_wpnonce'])), $nonce) ) {
     11             die( 'Security check' );
     12        }
     13        $click_n_chat_setting_analytics = new click_n_chat_setting_analytics();
     14        $click_n_chat_setting_analytics->analytic_type = sanitize_text_field($_POST['analytic_type']);
     15        $click_n_chat_setting_analytics->is_active = $_POST['is_active'] == "on" ? 1 : 0;
     16        $click_n_chat_setting_analytics->label = sanitize_text_field($_POST['label']);
     17        $click_n_chat_setting_analytics->category = sanitize_text_field($_POST['category']);
     18        $click_n_chat_setting_analytics->gaid = sanitize_text_field($_POST['gaid']);
     19       
     20        update_option('click_n_chat_setting_analytics', $click_n_chat_setting_analytics);
     21           
     22    }
     23   
     24    $click_n_chat_setting_analytics = get_option('click_n_chat_setting_analytics');
     25
    726?>
    827    <p><b>Google Analytics</b> <a class="right" href="#help">Help</a><hr /></p>
     28    <form id="userForm" method="post" enctype="multipart/form-data">
     29        <?php wp_nonce_field($nonce, '_wpnonce'); ?>
    930        <input type="hidden" name="action" value="setting">
    1031       
     
    1536                    <select name="analytic_type" class="form-select">
    1637
    17                         <option>Google Analytics 3</option>
    18                         <option>Google Analytics 4</option>
     38                        <option value="GA3" <?php echo esc_html($click_n_chat_setting_analytics->analytic_type == "GA3" ? "selected" : "") ?>>Google Analytics 3</option>
     39                        <option value="GA4" <?php echo esc_html($click_n_chat_setting_analytics->analytic_type == "GA4" ? "selected" : "")?>>Google Analytics 4</option>
    1940                    </select>
    2041                </td>
     
    2546                <td>
    2647                    <label class="cnc-switch">
    27                         <input type="checkbox" />
     48                        <input name="is_active" id="is_active" class="cnc-user-status" type="checkbox" <?php echo esc_html(($click_n_chat_setting_analytics->is_active == "1" ? "checked" : ""));  ?> >
    2849                        <span class="cns-switch-slider"></span>
    2950                    </label>
     
    3556                <th><label for="name">Label: </label></th>
    3657                <td>
    37                     <input type="text" id="label" class="form-control" placeholder="AI Chat">
     58                    <input name="label" type="text" id="label" value="<?php echo esc_html($click_n_chat_setting_analytics->label); ?>" class="form-control" placeholder="AI Chat">
    3859                </td>
    3960            </tr>
     
    4263                <th><label for="name">Category: </label></th>
    4364                <td>
    44                     <input type="text" id="category" class="form-control" placeholder="AI Auto Chat">
     65                    <input name="category" type="text" id="category" value="<?php echo esc_html($click_n_chat_setting_analytics->category); ?>" class="form-control" placeholder="AI Auto Chat">
    4566                </td>
    4667            </tr>
     
    4970                <th><label for="name">Google Analytics ID: </label></th>
    5071                <td>
    51                     <input type="text" id="gaid" class="form-control" placeholder="UA-0000000-0">
     72                    <input name="gaid" type="text" id="gaid" value="<?php echo esc_html($click_n_chat_setting_analytics->gaid); ?>" class="form-control" placeholder="UA-0000000-0">
    5273                </td>
    5374            </tr>             
    5475        </table>
    55         <div style="width:100%"  class="cnc-pro-label">
    56             <input type="button" disabled="disabled" class="w-100 btn btn-outline-primary cnc-pro-label" value="Update">
    57         </div>
     76        <input type="submit" name="submit" id="submit" class="w-100 btn btn-outline-primary" value="Update">
     77        <hr />
     78        <h5 id="help">How to Find Your Google Analytics v3 (Universal Analytics) Property Tracking ID</h5>
     79        <ol>
     80            <li><strong>Sign In to Google Analytics</strong>
     81                <ol>
     82                    <li>Go to <a href="https://analytics.google.com/" target="_blank">Google Analytics</a>.</li>
     83                    <li>Log in using your Google account.</li>
     84
     85                </ol>
     86            </li>
     87            <li><strong>Access the Admin Section</strong>
     88                <ol>
     89                    <li>Select your account and property.</li>
     90                    <li>Click on the <strong>Admin</strong> gear icon in the bottom-left corner.</li>
     91                </ol>
     92            </li>
     93            <li><strong>Find Your Tracking ID</strong>
     94                <ol>
     95                    <li>Under the "Property" column, click on <strong>Tracking Info</strong>, then click on <strong>Tracking Code</strong>.</li>
     96                    <li>Your Tracking ID (e.g., <code>UA-XXXXXXXXX-X</code>) will be displayed at the top.</li>
     97                </ol>
     98            </li>
     99            <li><strong>Use the Tracking ID</strong>
     100                <ol>
     101                    <li>Copy the Tracking ID and paste it into <b>Google Analytics ID</b>.</li>
     102                </ol>
     103            </li>
     104        </ol>
     105        <hr />
     106        <h5>How to Find Your Google Analytics 4 (GA4) Data Stream Measurement ID</h5>
     107        <ol>
     108            <li><strong>Sign In to Google Analytics</strong>
     109                <ol>
     110                    <li>Visit <a href="https://analytics.google.com/" target="_blank">Google Analytics</a>.</li>
     111                    <li>Log in with your Google account.</li>
     112                </ol>
     113            </li>
     114            <li><strong>Select the Correct Property</strong>
     115                <ol>
     116                    <li>Ensure you are in the correct account.</li>
     117                    <li>In the property selector, choose the GA4 property you want to find the Measurement ID for.</li>
     118                </ol>
     119            </li>
     120            <li><strong>Go to Data Streams</strong>
     121                <ol>
     122                    <li>Click on the <strong>Admin</strong> gear icon in the bottom-left corner of the screen.</li>
     123                    <li>Under the <strong>Property</strong> column, select <strong>Data Streams</strong>.</li>
     124                </ol>
     125            </li>
     126            <li><strong>Find Your Measurement ID</strong>
     127                <ol>
     128                    <li>Click on the relevant data stream (e.g., Web, iOS, Android) you are using for tracking.</li>
     129                    <li>Your Measurement ID will be displayed at the top right corner. It will look something like <code>G-XXXXXXXXXX</code>.</li>
     130                </ol>
     131            </li>
     132            <li><strong>Use the Measurement ID</strong>
     133                <ol>
     134                    <li>Copy the Measurement ID and paste it into <b>Google Analytics ID</b>.</li>
     135                </ol>
     136            </li>
     137        </ol>
     138       
     139    </form>
    58140<?php
    59141}
  • click-n-chat/trunk/assets/css/style.css

    r3149305 r3152626  
    8686    bottom: 95px;
    8787    right: 3%;
    88     min-width: 350px;
     88    min-width: 300px;
    8989    background-color: #ffffff;
    9090    border-radius: 30px 30px 15px 15px;
  • click-n-chat/trunk/assets/js/script.js

    r3149305 r3152626  
    2828            }, 300);
    2929            popup.fadeIn();
     30        }
     31       
     32        if (typeof cncanalytics === 'function') {
     33            cncanalytics();
    3034        }
    3135       
  • click-n-chat/trunk/click-n-chat.php

    r3149305 r3152626  
    44Plugin URI: http://www.flag92.com/
    55Description: Chat n Click allows you to connect with website visitors through their favorite social channels by displaying a floating chat icon at the bottom of your site. With features like auto-reply, widget customization, and social user availability, you can ensure seamless communication and enhance visitor engagement across multiple platforms.
    6 Version: 1.0.0
     6Version: 1.0.1
    77Author: Flag92
    88Domain Path: /languages
  • click-n-chat/trunk/includes/click_n_chat_activate.php

    r3149305 r3152626  
    7474            $click_n_chat_setting_popup = new click_n_chat_setting_popup();
    7575            update_option('click_n_chat_setting_popup', $click_n_chat_setting_popup);
     76            $click_n_chat_setting_analytics = new click_n_chat_setting_analytics();
     77            update_option('click_n_chat_setting_analytics', $click_n_chat_setting_analytics);
    7678            update_option('click_n_chat_premium', false);
    7779            update_option('click_n_chat_greetings_message', 'Welcome to <a href="https://flag92.com/">Click n Chat</a>');
     
    8890            delete_option('click_n_chat_setting_popup');
    8991            delete_option('click_n_chat_greetings_message');
     92            delete_option('click_n_chat_setting_analytics');
    9093            delete_option('click_n_chat_is_enable');
    9194            delete_option('click_n_chat_premium');
  • click-n-chat/trunk/includes/click_n_chat_home.php

    r3149305 r3152626  
    1515    }
    1616    include_once( CLICK_N_CHAT_DIR_PATH . 'includes/parts/click_n_chat_popup.php');
     17    include_once( CLICK_N_CHAT_DIR_PATH . 'includes/parts/click_n_chat_analytics.php');
    1718}
    1819
Note: See TracChangeset for help on using the changeset viewer.