Changeset 3401960
- Timestamp:
- 11/24/2025 03:15:31 PM (4 months ago)
- Location:
- basecloud-utm-tracker
- Files:
-
- 4 edited
- 1 copied
-
tags/1.2.2 (copied) (copied from basecloud-utm-tracker/trunk)
-
tags/1.2.2/basecloud-utm-tracker.php (modified) (11 diffs)
-
tags/1.2.2/readme.txt (modified) (3 diffs)
-
trunk/basecloud-utm-tracker.php (modified) (11 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
basecloud-utm-tracker/tags/1.2.2/basecloud-utm-tracker.php
r3389980 r3401960 4 4 * Plugin URI: https://www.basecloudglobal.com/plugins/utm-tracker 5 5 * 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. 16 * Version: 1.2.2 7 7 * Author: BaseCloud Team 8 8 * Author URI: https://www.basecloudglobal.com/ … … 25 25 26 26 // Define plugin constants 27 define('BASECLOUD_UTM_VERSION', '1.2. 1');27 define('BASECLOUD_UTM_VERSION', '1.2.2'); 28 28 define('BASECLOUD_UTM_PLUGIN_URL', plugin_dir_url(__FILE__)); 29 29 define('BASECLOUD_UTM_PLUGIN_PATH', plugin_dir_path(__FILE__)); … … 173 173 [ 174 174 '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') 176 176 ] 177 177 ); … … 456 456 $enable_gravity_forms = !empty($options['enable_gravity_forms']); 457 457 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"; 460 460 $parameters_array = array_filter(array_map('trim', explode("\n", $tracked_parameters))); 461 461 … … 513 513 if ($enable_gravity_forms) { 514 514 $script .= " 515 // Enhanced Gravity Forms dynamic population with referrer support515 // Enhanced Gravity Forms dynamic population - CRM/Webhook Ready 516 516 function populateGravityFormFields() { 517 // Map of parameter names to cookie names517 // Map of labels to cookie names (for CRM/webhook integration) 518 518 const fieldMappings = { 519 519 'referrer': 'referrer', 520 'gclid': 'bc_gclid', // Note: parameter name is 'gclid', cookie is 'bc_gclid' 520 'gclid': 'gclid', 521 'gbraid': 'gbraid', 522 'wbraid': 'wbraid', 521 523 'utm_source': 'utm_source', 522 524 'utm_medium': 'utm_medium', … … 525 527 }; 526 528 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 544 530 Object.keys(fieldMappings).forEach(labelText => { 545 531 const cookieValue = getCookie(fieldMappings[labelText]); 546 532 if (cookieValue) { 547 // Find labels with matchingtext533 // Find ALL labels with the specific text 548 534 const labels = Array.from(document.querySelectorAll('label.gfield_label')) 549 535 .filter(label => label.textContent.trim() === labelText); 550 536 537 // Loop through each matching label and populate its corresponding input 551 538 labels.forEach(label => { 552 539 const inputId = label.getAttribute('for'); 553 540 const inputField = document.getElementById(inputId); 554 if (inputField && !inputField.value) {541 if (inputField) { 555 542 inputField.value = cookieValue; 543 // Trigger change event for webhook/CRM integration 556 544 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 })); 574 546 } 575 547 }); … … 595 567 }); 596 568 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...'); 601 581 setTimeout(populateGravityFormFields, 500); 602 582 }); … … 634 614 'utm_campaign' => 'UTM Campaign', 635 615 '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' 637 619 ]; 638 620 … … 672 654 } 673 655 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']; 675 657 676 658 foreach ($form['fields'] as $field) { … … 751 733 } 752 734 753 // Map parameter names to cookie names 735 // Map parameter names to cookie names (for webhook/CRM integration) 754 736 $utm_mappings = [ 755 737 'referrer' => 'referrer', 756 'gclid' => 'bc_gclid', 738 'gclid' => 'gclid', 739 'gbraid' => 'gbraid', 740 'wbraid' => 'wbraid', 757 741 'utm_source' => 'utm_source', 758 742 'utm_medium' => 'utm_medium', … … 786 770 'enable_gravity_forms' => 1, 787 771 '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" 789 773 ); 790 774 add_option('basecloud_utm_settings', $default_options); -
basecloud-utm-tracker/tags/1.2.2/readme.txt
r3389980 r3401960 4 4 Requires at least: 5.0 5 5 Tested up to: 6.8 6 Stable tag: 1.2. 16 Stable tag: 1.2.2 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 50 50 * `utm_campaign` - Campaign name 51 51 * `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. 55 57 56 58 = Technical Features = … … 141 143 142 144 == 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 143 157 144 158 = 1.2.1 = -
basecloud-utm-tracker/trunk/basecloud-utm-tracker.php
r3389980 r3401960 4 4 * Plugin URI: https://www.basecloudglobal.com/plugins/utm-tracker 5 5 * 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. 16 * Version: 1.2.2 7 7 * Author: BaseCloud Team 8 8 * Author URI: https://www.basecloudglobal.com/ … … 25 25 26 26 // Define plugin constants 27 define('BASECLOUD_UTM_VERSION', '1.2. 1');27 define('BASECLOUD_UTM_VERSION', '1.2.2'); 28 28 define('BASECLOUD_UTM_PLUGIN_URL', plugin_dir_url(__FILE__)); 29 29 define('BASECLOUD_UTM_PLUGIN_PATH', plugin_dir_path(__FILE__)); … … 173 173 [ 174 174 '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') 176 176 ] 177 177 ); … … 456 456 $enable_gravity_forms = !empty($options['enable_gravity_forms']); 457 457 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"; 460 460 $parameters_array = array_filter(array_map('trim', explode("\n", $tracked_parameters))); 461 461 … … 513 513 if ($enable_gravity_forms) { 514 514 $script .= " 515 // Enhanced Gravity Forms dynamic population with referrer support515 // Enhanced Gravity Forms dynamic population - CRM/Webhook Ready 516 516 function populateGravityFormFields() { 517 // Map of parameter names to cookie names517 // Map of labels to cookie names (for CRM/webhook integration) 518 518 const fieldMappings = { 519 519 'referrer': 'referrer', 520 'gclid': 'bc_gclid', // Note: parameter name is 'gclid', cookie is 'bc_gclid' 520 'gclid': 'gclid', 521 'gbraid': 'gbraid', 522 'wbraid': 'wbraid', 521 523 'utm_source': 'utm_source', 522 524 'utm_medium': 'utm_medium', … … 525 527 }; 526 528 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 544 530 Object.keys(fieldMappings).forEach(labelText => { 545 531 const cookieValue = getCookie(fieldMappings[labelText]); 546 532 if (cookieValue) { 547 // Find labels with matchingtext533 // Find ALL labels with the specific text 548 534 const labels = Array.from(document.querySelectorAll('label.gfield_label')) 549 535 .filter(label => label.textContent.trim() === labelText); 550 536 537 // Loop through each matching label and populate its corresponding input 551 538 labels.forEach(label => { 552 539 const inputId = label.getAttribute('for'); 553 540 const inputField = document.getElementById(inputId); 554 if (inputField && !inputField.value) {541 if (inputField) { 555 542 inputField.value = cookieValue; 543 // Trigger change event for webhook/CRM integration 556 544 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 })); 574 546 } 575 547 }); … … 595 567 }); 596 568 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...'); 601 581 setTimeout(populateGravityFormFields, 500); 602 582 }); … … 634 614 'utm_campaign' => 'UTM Campaign', 635 615 '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' 637 619 ]; 638 620 … … 672 654 } 673 655 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']; 675 657 676 658 foreach ($form['fields'] as $field) { … … 751 733 } 752 734 753 // Map parameter names to cookie names 735 // Map parameter names to cookie names (for webhook/CRM integration) 754 736 $utm_mappings = [ 755 737 'referrer' => 'referrer', 756 'gclid' => 'bc_gclid', 738 'gclid' => 'gclid', 739 'gbraid' => 'gbraid', 740 'wbraid' => 'wbraid', 757 741 'utm_source' => 'utm_source', 758 742 'utm_medium' => 'utm_medium', … … 786 770 'enable_gravity_forms' => 1, 787 771 '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" 789 773 ); 790 774 add_option('basecloud_utm_settings', $default_options); -
basecloud-utm-tracker/trunk/readme.txt
r3389980 r3401960 4 4 Requires at least: 5.0 5 5 Tested up to: 6.8 6 Stable tag: 1.2. 16 Stable tag: 1.2.2 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 50 50 * `utm_campaign` - Campaign name 51 51 * `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. 55 57 56 58 = Technical Features = … … 141 143 142 144 == 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 143 157 144 158 = 1.2.1 =
Note: See TracChangeset
for help on using the changeset viewer.