Plugin Directory

Changeset 3401960


Ignore:
Timestamp:
11/24/2025 03:15:31 PM (4 months ago)
Author:
basecloud
Message:

Update to version 1.2.2 from GitHub

Location:
basecloud-utm-tracker
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • basecloud-utm-tracker/tags/1.2.2/basecloud-utm-tracker.php

    r3389980 r3401960  
    44 * Plugin URI:        https://www.basecloudglobal.com/plugins/utm-tracker
    55 * Description:       Track UTM parameters and GCLID from marketing campaigns. Automatically stores UTM data in secure cookies and seamlessly populates Gravity Forms fields for enhanced campaign attribution and lead tracking analytics.
    6  * Version: 1.2.1
     6 * Version: 1.2.2
    77 * Author:            BaseCloud Team
    88 * Author URI:        https://www.basecloudglobal.com/
     
    2525
    2626// Define plugin constants
    27 define('BASECLOUD_UTM_VERSION', '1.2.1');
     27define('BASECLOUD_UTM_VERSION', '1.2.2');
    2828define('BASECLOUD_UTM_PLUGIN_URL', plugin_dir_url(__FILE__));
    2929define('BASECLOUD_UTM_PLUGIN_PATH', plugin_dir_path(__FILE__));
     
    173173            [
    174174                'name' => 'tracked_parameters',
    175                 'desc' => __('One parameter per line. Default: referrer, utm_source, utm_medium, utm_campaign, utm_term, gclid', 'basecloud-utm-tracker')
     175                'desc' => __('One parameter per line. Default: referrer, utm_source, utm_medium, utm_campaign, utm_term, gclid, gbraid, wbraid', 'basecloud-utm-tracker')
    176176            ]
    177177        );
     
    456456        $enable_gravity_forms = !empty($options['enable_gravity_forms']);
    457457       
    458         // Get tracked parameters (including referrer)
    459         $tracked_parameters = isset($options['tracked_parameters']) ? $options['tracked_parameters'] : "referrer\nutm_source\nutm_medium\nutm_campaign\nutm_term\ngclid";
     458        // Get tracked parameters (including referrer, gbraid, wbraid)
     459        $tracked_parameters = isset($options['tracked_parameters']) ? $options['tracked_parameters'] : "referrer\nutm_source\nutm_medium\nutm_campaign\nutm_term\ngclid\ngbraid\nwbraid";
    460460        $parameters_array = array_filter(array_map('trim', explode("\n", $tracked_parameters)));
    461461       
     
    513513        if ($enable_gravity_forms) {
    514514            $script .= "
    515             // Enhanced Gravity Forms dynamic population with referrer support
     515            // Enhanced Gravity Forms dynamic population - CRM/Webhook Ready
    516516            function populateGravityFormFields() {
    517                 // Map of parameter names to cookie names
     517                // Map of labels to cookie names (for CRM/webhook integration)
    518518                const fieldMappings = {
    519519                    'referrer': 'referrer',
    520                     'gclid': 'bc_gclid',         // Note: parameter name is 'gclid', cookie is 'bc_gclid'
     520                    'gclid': 'gclid',
     521                    'gbraid': 'gbraid',
     522                    'wbraid': 'wbraid',
    521523                    'utm_source': 'utm_source',
    522524                    'utm_medium': 'utm_medium',
     
    525527                };
    526528
    527                 // Method 1: Populate by parameter name (for dynamically populated fields)
    528                 Object.keys(fieldMappings).forEach(paramName => {
    529                     const cookieValue = getCookie(fieldMappings[paramName]);
    530                     if (cookieValue) {
    531                         // Find inputs with matching parameter names (Gravity Forms dynamic population)
    532                         const inputs = document.querySelectorAll(\`input[name*=\"\${paramName}\"]\`);
    533                         inputs.forEach(input => {
    534                             if (input && !input.value) { // Only populate if empty
    535                                 input.value = cookieValue;
    536                                 // Trigger change event for any listeners
    537                                 input.dispatchEvent(new Event('change', { bubbles: true }));
    538                             }
    539                         });
    540                     }
    541                 });
    542 
    543                 // Method 2: Populate by label text (fallback for manually created fields)
     529                // Loop through the mappings and populate fields
    544530                Object.keys(fieldMappings).forEach(labelText => {
    545531                    const cookieValue = getCookie(fieldMappings[labelText]);
    546532                    if (cookieValue) {
    547                         // Find labels with matching text
     533                        // Find ALL labels with the specific text
    548534                        const labels = Array.from(document.querySelectorAll('label.gfield_label'))
    549535                            .filter(label => label.textContent.trim() === labelText);
    550536
     537                        // Loop through each matching label and populate its corresponding input
    551538                        labels.forEach(label => {
    552539                            const inputId = label.getAttribute('for');
    553540                            const inputField = document.getElementById(inputId);
    554                             if (inputField && !inputField.value) {
     541                            if (inputField) {
    555542                                inputField.value = cookieValue;
     543                                // Trigger change event for webhook/CRM integration
    556544                                inputField.dispatchEvent(new Event('change', { bubbles: true }));
    557                             }
    558                         });
    559                     }
    560                 });
    561 
    562                 // Method 3: Direct field ID approach (most reliable for auto-created fields)
    563                 const formFields = document.querySelectorAll('.gform_wrapper input[type=\"text\"]');
    564                 formFields.forEach(field => {
    565                     const fieldName = field.getAttribute('name');
    566                     if (fieldName) {
    567                         Object.keys(fieldMappings).forEach(paramName => {
    568                             if (fieldName.includes(paramName) || field.getAttribute('data-parameter') === paramName) {
    569                                 const cookieValue = getCookie(fieldMappings[paramName]);
    570                                 if (cookieValue && !field.value) {
    571                                     field.value = cookieValue;
    572                                     field.dispatchEvent(new Event('change', { bubbles: true }));
    573                                 }
     545                                inputField.dispatchEvent(new Event('input', { bubbles: true }));
    574546                            }
    575547                        });
     
    595567                });
    596568
    597                 // Support for other popup triggers (generic approach)
    598                 const popupTriggers = document.querySelectorAll('[data-popup], .popup-trigger, .modal-trigger');
    599                 popupTriggers.forEach(trigger => {
    600                     trigger.addEventListener('click', () => {
     569            // Populate Gravity Forms fields after the DOM is loaded
     570            document.addEventListener('DOMContentLoaded', populateGravityFormFields);
     571
     572            // Enhanced popup support for Elementor and other builders
     573            document.addEventListener('DOMContentLoaded', populateGravityFormFieldsForPopups);
     574
     575            function populateGravityFormFieldsForPopups() {
     576                let triggerButtons = document.querySelectorAll('.elementor-button[href^=\"#elementor-action%3Aaction%3Dpopup\"]');
     577               
     578                triggerButtons.forEach(e => {
     579                    e.addEventListener('click', () => {
     580                        console.log('BaseCloud UTM: Popup clicked - populating fields...');
    601581                        setTimeout(populateGravityFormFields, 500);
    602582                    });
     
    634614            'utm_campaign' => 'UTM Campaign',
    635615            'utm_term' => 'UTM Term',
    636             'bc_gclid' => 'Google Click ID'
     616            'gclid' => 'Google Click ID',
     617            'gbraid' => 'Google Brand Engagement',
     618            'wbraid' => 'Web to App Brand Engagement'
    637619        ];
    638620
     
    672654        }
    673655
    674         $utm_field_names = ['referrer', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'bc_gclid'];
     656        $utm_field_names = ['referrer', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'gclid', 'gbraid', 'wbraid'];
    675657       
    676658        foreach ($form['fields'] as $field) {
     
    751733        }
    752734
    753         // Map parameter names to cookie names
     735        // Map parameter names to cookie names (for webhook/CRM integration)
    754736        $utm_mappings = [
    755737            'referrer' => 'referrer',
    756             'gclid' => 'bc_gclid',
     738            'gclid' => 'gclid',
     739            'gbraid' => 'gbraid',
     740            'wbraid' => 'wbraid',
    757741            'utm_source' => 'utm_source',
    758742            'utm_medium' => 'utm_medium',
     
    786770        'enable_gravity_forms' => 1,
    787771        'auto_create_fields' => 1,
    788         'tracked_parameters' => "referrer\nutm_source\nutm_medium\nutm_campaign\nutm_term\ngclid"
     772        'tracked_parameters' => "referrer\nutm_source\nutm_medium\nutm_campaign\nutm_term\ngclid\ngbraid\nwbraid"
    789773    );
    790774    add_option('basecloud_utm_settings', $default_options);
  • basecloud-utm-tracker/tags/1.2.2/readme.txt

    r3389980 r3401960  
    44Requires at least: 5.0
    55Tested up to: 6.8
    6 Stable tag: 1.2.1
     6Stable tag: 1.2.2
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    5050* `utm_campaign` - Campaign name
    5151* `utm_term` - Campaign keywords
    52 * `bc_gclid` - Google Click ID for Google Ads tracking
    53 
    54 **Manual Setup:** Create form fields with these exact labels for automatic population if not using auto-creation.
     52* `gclid` - Google Click ID for Google Ads tracking
     53* `gbraid` - Google Brand Engagement (iOS 14+)
     54* `wbraid` - Web to App Brand Engagement
     55
     56**Manual Setup:** Create text fields with these exact labels, set visibility to "Hidden", and enable "Allow field to be populated dynamically" if not using auto-creation.
    5557
    5658= Technical Features =
     
    141143
    142144== Changelog ==
     145
     146= 1.2.2 =
     147**🚀 Enhanced Secret Sauce - CRM/Webhook Integration Update**
     148
     149• **NEW: Google Brand Engagement Tracking** - Added gbraid and wbraid parameter support for iOS 14+ tracking
     150• **IMPROVED: Enhanced Secret Sauce Code** - Updated core tracking engine with latest best practices
     151• **FIXED: GCLID Cookie Naming** - Removed bc_ prefix for better CRM/webhook compatibility
     152• **ENHANCED: CRM Integration** - Optimized field population for seamless webhook data transfer
     153• **IMPROVED: Event Triggering** - Added input and change events for better form integration
     154• **UPDATED: Default Parameters** - Now includes referrer, utm_source, utm_medium, utm_campaign, utm_term, gclid, gbraid, wbraid
     155• **OPTIMIZED: Label-Based Population** - Streamlined field detection for text fields set to hidden visibility
     156• **ENHANCED: Popup Integration** - Improved Elementor popup support with better event handling
    143157
    144158= 1.2.1 =
  • basecloud-utm-tracker/trunk/basecloud-utm-tracker.php

    r3389980 r3401960  
    44 * Plugin URI:        https://www.basecloudglobal.com/plugins/utm-tracker
    55 * Description:       Track UTM parameters and GCLID from marketing campaigns. Automatically stores UTM data in secure cookies and seamlessly populates Gravity Forms fields for enhanced campaign attribution and lead tracking analytics.
    6  * Version: 1.2.1
     6 * Version: 1.2.2
    77 * Author:            BaseCloud Team
    88 * Author URI:        https://www.basecloudglobal.com/
     
    2525
    2626// Define plugin constants
    27 define('BASECLOUD_UTM_VERSION', '1.2.1');
     27define('BASECLOUD_UTM_VERSION', '1.2.2');
    2828define('BASECLOUD_UTM_PLUGIN_URL', plugin_dir_url(__FILE__));
    2929define('BASECLOUD_UTM_PLUGIN_PATH', plugin_dir_path(__FILE__));
     
    173173            [
    174174                'name' => 'tracked_parameters',
    175                 'desc' => __('One parameter per line. Default: referrer, utm_source, utm_medium, utm_campaign, utm_term, gclid', 'basecloud-utm-tracker')
     175                'desc' => __('One parameter per line. Default: referrer, utm_source, utm_medium, utm_campaign, utm_term, gclid, gbraid, wbraid', 'basecloud-utm-tracker')
    176176            ]
    177177        );
     
    456456        $enable_gravity_forms = !empty($options['enable_gravity_forms']);
    457457       
    458         // Get tracked parameters (including referrer)
    459         $tracked_parameters = isset($options['tracked_parameters']) ? $options['tracked_parameters'] : "referrer\nutm_source\nutm_medium\nutm_campaign\nutm_term\ngclid";
     458        // Get tracked parameters (including referrer, gbraid, wbraid)
     459        $tracked_parameters = isset($options['tracked_parameters']) ? $options['tracked_parameters'] : "referrer\nutm_source\nutm_medium\nutm_campaign\nutm_term\ngclid\ngbraid\nwbraid";
    460460        $parameters_array = array_filter(array_map('trim', explode("\n", $tracked_parameters)));
    461461       
     
    513513        if ($enable_gravity_forms) {
    514514            $script .= "
    515             // Enhanced Gravity Forms dynamic population with referrer support
     515            // Enhanced Gravity Forms dynamic population - CRM/Webhook Ready
    516516            function populateGravityFormFields() {
    517                 // Map of parameter names to cookie names
     517                // Map of labels to cookie names (for CRM/webhook integration)
    518518                const fieldMappings = {
    519519                    'referrer': 'referrer',
    520                     'gclid': 'bc_gclid',         // Note: parameter name is 'gclid', cookie is 'bc_gclid'
     520                    'gclid': 'gclid',
     521                    'gbraid': 'gbraid',
     522                    'wbraid': 'wbraid',
    521523                    'utm_source': 'utm_source',
    522524                    'utm_medium': 'utm_medium',
     
    525527                };
    526528
    527                 // Method 1: Populate by parameter name (for dynamically populated fields)
    528                 Object.keys(fieldMappings).forEach(paramName => {
    529                     const cookieValue = getCookie(fieldMappings[paramName]);
    530                     if (cookieValue) {
    531                         // Find inputs with matching parameter names (Gravity Forms dynamic population)
    532                         const inputs = document.querySelectorAll(\`input[name*=\"\${paramName}\"]\`);
    533                         inputs.forEach(input => {
    534                             if (input && !input.value) { // Only populate if empty
    535                                 input.value = cookieValue;
    536                                 // Trigger change event for any listeners
    537                                 input.dispatchEvent(new Event('change', { bubbles: true }));
    538                             }
    539                         });
    540                     }
    541                 });
    542 
    543                 // Method 2: Populate by label text (fallback for manually created fields)
     529                // Loop through the mappings and populate fields
    544530                Object.keys(fieldMappings).forEach(labelText => {
    545531                    const cookieValue = getCookie(fieldMappings[labelText]);
    546532                    if (cookieValue) {
    547                         // Find labels with matching text
     533                        // Find ALL labels with the specific text
    548534                        const labels = Array.from(document.querySelectorAll('label.gfield_label'))
    549535                            .filter(label => label.textContent.trim() === labelText);
    550536
     537                        // Loop through each matching label and populate its corresponding input
    551538                        labels.forEach(label => {
    552539                            const inputId = label.getAttribute('for');
    553540                            const inputField = document.getElementById(inputId);
    554                             if (inputField && !inputField.value) {
     541                            if (inputField) {
    555542                                inputField.value = cookieValue;
     543                                // Trigger change event for webhook/CRM integration
    556544                                inputField.dispatchEvent(new Event('change', { bubbles: true }));
    557                             }
    558                         });
    559                     }
    560                 });
    561 
    562                 // Method 3: Direct field ID approach (most reliable for auto-created fields)
    563                 const formFields = document.querySelectorAll('.gform_wrapper input[type=\"text\"]');
    564                 formFields.forEach(field => {
    565                     const fieldName = field.getAttribute('name');
    566                     if (fieldName) {
    567                         Object.keys(fieldMappings).forEach(paramName => {
    568                             if (fieldName.includes(paramName) || field.getAttribute('data-parameter') === paramName) {
    569                                 const cookieValue = getCookie(fieldMappings[paramName]);
    570                                 if (cookieValue && !field.value) {
    571                                     field.value = cookieValue;
    572                                     field.dispatchEvent(new Event('change', { bubbles: true }));
    573                                 }
     545                                inputField.dispatchEvent(new Event('input', { bubbles: true }));
    574546                            }
    575547                        });
     
    595567                });
    596568
    597                 // Support for other popup triggers (generic approach)
    598                 const popupTriggers = document.querySelectorAll('[data-popup], .popup-trigger, .modal-trigger');
    599                 popupTriggers.forEach(trigger => {
    600                     trigger.addEventListener('click', () => {
     569            // Populate Gravity Forms fields after the DOM is loaded
     570            document.addEventListener('DOMContentLoaded', populateGravityFormFields);
     571
     572            // Enhanced popup support for Elementor and other builders
     573            document.addEventListener('DOMContentLoaded', populateGravityFormFieldsForPopups);
     574
     575            function populateGravityFormFieldsForPopups() {
     576                let triggerButtons = document.querySelectorAll('.elementor-button[href^=\"#elementor-action%3Aaction%3Dpopup\"]');
     577               
     578                triggerButtons.forEach(e => {
     579                    e.addEventListener('click', () => {
     580                        console.log('BaseCloud UTM: Popup clicked - populating fields...');
    601581                        setTimeout(populateGravityFormFields, 500);
    602582                    });
     
    634614            'utm_campaign' => 'UTM Campaign',
    635615            'utm_term' => 'UTM Term',
    636             'bc_gclid' => 'Google Click ID'
     616            'gclid' => 'Google Click ID',
     617            'gbraid' => 'Google Brand Engagement',
     618            'wbraid' => 'Web to App Brand Engagement'
    637619        ];
    638620
     
    672654        }
    673655
    674         $utm_field_names = ['referrer', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'bc_gclid'];
     656        $utm_field_names = ['referrer', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'gclid', 'gbraid', 'wbraid'];
    675657       
    676658        foreach ($form['fields'] as $field) {
     
    751733        }
    752734
    753         // Map parameter names to cookie names
     735        // Map parameter names to cookie names (for webhook/CRM integration)
    754736        $utm_mappings = [
    755737            'referrer' => 'referrer',
    756             'gclid' => 'bc_gclid',
     738            'gclid' => 'gclid',
     739            'gbraid' => 'gbraid',
     740            'wbraid' => 'wbraid',
    757741            'utm_source' => 'utm_source',
    758742            'utm_medium' => 'utm_medium',
     
    786770        'enable_gravity_forms' => 1,
    787771        'auto_create_fields' => 1,
    788         'tracked_parameters' => "referrer\nutm_source\nutm_medium\nutm_campaign\nutm_term\ngclid"
     772        'tracked_parameters' => "referrer\nutm_source\nutm_medium\nutm_campaign\nutm_term\ngclid\ngbraid\nwbraid"
    789773    );
    790774    add_option('basecloud_utm_settings', $default_options);
  • basecloud-utm-tracker/trunk/readme.txt

    r3389980 r3401960  
    44Requires at least: 5.0
    55Tested up to: 6.8
    6 Stable tag: 1.2.1
     6Stable tag: 1.2.2
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    5050* `utm_campaign` - Campaign name
    5151* `utm_term` - Campaign keywords
    52 * `bc_gclid` - Google Click ID for Google Ads tracking
    53 
    54 **Manual Setup:** Create form fields with these exact labels for automatic population if not using auto-creation.
     52* `gclid` - Google Click ID for Google Ads tracking
     53* `gbraid` - Google Brand Engagement (iOS 14+)
     54* `wbraid` - Web to App Brand Engagement
     55
     56**Manual Setup:** Create text fields with these exact labels, set visibility to "Hidden", and enable "Allow field to be populated dynamically" if not using auto-creation.
    5557
    5658= Technical Features =
     
    141143
    142144== Changelog ==
     145
     146= 1.2.2 =
     147**🚀 Enhanced Secret Sauce - CRM/Webhook Integration Update**
     148
     149• **NEW: Google Brand Engagement Tracking** - Added gbraid and wbraid parameter support for iOS 14+ tracking
     150• **IMPROVED: Enhanced Secret Sauce Code** - Updated core tracking engine with latest best practices
     151• **FIXED: GCLID Cookie Naming** - Removed bc_ prefix for better CRM/webhook compatibility
     152• **ENHANCED: CRM Integration** - Optimized field population for seamless webhook data transfer
     153• **IMPROVED: Event Triggering** - Added input and change events for better form integration
     154• **UPDATED: Default Parameters** - Now includes referrer, utm_source, utm_medium, utm_campaign, utm_term, gclid, gbraid, wbraid
     155• **OPTIMIZED: Label-Based Population** - Streamlined field detection for text fields set to hidden visibility
     156• **ENHANCED: Popup Integration** - Improved Elementor popup support with better event handling
    143157
    144158= 1.2.1 =
Note: See TracChangeset for help on using the changeset viewer.