Changeset 2658193
- Timestamp:
- 01/15/2022 08:54:39 PM (4 years ago)
- Location:
- targeted-actions
- Files:
-
- 12 edited
- 10 copied
-
tags/1.1 (copied) (copied from targeted-actions/trunk)
-
tags/1.1/.gitignore (copied) (copied from targeted-actions/trunk/.gitignore)
-
tags/1.1/LICENSE.txt (copied) (copied from targeted-actions/trunk/LICENSE.txt)
-
tags/1.1/TargetedUserActions.php (copied) (copied from targeted-actions/trunk/TargetedUserActions.php) (1 diff)
-
tags/1.1/assets (copied) (copied from targeted-actions/trunk/assets)
-
tags/1.1/assets/js/admin.js (modified) (1 diff)
-
tags/1.1/features (copied) (copied from targeted-actions/trunk/features)
-
tags/1.1/features/admin/RuleFields.php (modified) (2 diffs)
-
tags/1.1/features/admin/TUAAdmin.php (modified) (5 diffs)
-
tags/1.1/features/formhandlers/SaveEditRule.php (modified) (2 diffs)
-
tags/1.1/features/rules/Rules.php (modified) (3 diffs)
-
tags/1.1/gulpfile.js (copied) (copied from targeted-actions/trunk/gulpfile.js)
-
tags/1.1/index.php (copied) (copied from targeted-actions/trunk/index.php)
-
tags/1.1/package-lock.json (copied) (copied from targeted-actions/trunk/package-lock.json)
-
tags/1.1/readme.txt (copied) (copied from targeted-actions/trunk/readme.txt) (2 diffs)
-
trunk/TargetedUserActions.php (modified) (1 diff)
-
trunk/assets/js/admin.js (modified) (1 diff)
-
trunk/features/admin/RuleFields.php (modified) (2 diffs)
-
trunk/features/admin/TUAAdmin.php (modified) (5 diffs)
-
trunk/features/formhandlers/SaveEditRule.php (modified) (2 diffs)
-
trunk/features/rules/Rules.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
targeted-actions/tags/1.1/TargetedUserActions.php
r2649595 r2658193 5 5 Plugin Name: Targeted User Actions 6 6 description: A plugin that allows you to target users of your website and perform custom actions, including showing a pop-up or setting a cookie, only for matching users. 7 Version: 1. 07 Version: 1.1 8 8 Author: StrategicPlugins.com 9 9 Author URI: https://strategicplugins.com -
targeted-actions/tags/1.1/assets/js/admin.js
r2649595 r2658193 29 29 // CodeMirror 30 30 31 if($('#modal-html-codemirror').length > 0) { 32 wp.codeEditor.initialize($('#modal-html-codemirror'), cm_settings); 31 if($('.js-tua-codemirror').length > 0) { 32 $( ".js-tua-codemirror" ).each(function( index ) { 33 wp.codeEditor.initialize($(this), cm_settings); 34 }); 33 35 } 34 36 -
targeted-actions/tags/1.1/features/admin/RuleFields.php
r2649595 r2658193 215 215 public static function ruleType($value = "") { 216 216 217 $available_actions = []; 218 $available_actions["show_modal"] = 'Show a Modal / Popup Window'; 219 $available_actions["set_cookie"] = 'Set a cookie on the user\'s browser'; 220 221 // Use the tua_define_actions hook to add a new option 222 $available_actions = apply_filters( 'tua_define_actions', $available_actions); 223 217 224 $html = ' 218 225 <div class="form-row settings-row"> … … 221 228 <div class="form-rule-select"> 222 229 ' . Form::radio("rule_action", 223 [ 224 'show_modal' => 'Show a Modal / Popup Window', 225 'set_cookie' => 'Set a cookie on the user\'s browser' 226 ], 230 $available_actions, 227 231 [ 228 232 'label' => 'Select Rule Action', -
targeted-actions/tags/1.1/features/admin/TUAAdmin.php
r2649595 r2658193 252 252 $rule_to_edit = ""; 253 253 $update_rule = ""; 254 $rule_data = ""; 254 255 255 256 if(Form::getArg("ruleID") != "" AND is_numeric(Form::getArg("ruleID"))) { … … 331 332 (isset($rule_data["required_visit_count"]) ? $rule_data["required_visit_count"] : '') 332 333 ) . ' 334 335 <!-- TUA Rule Triggers --> 333 336 334 337 </div> … … 552 555 'label' => 'Modal HTML', 553 556 'id' => 'modal-html-codemirror', 557 'field_class' => 'js-tua-codemirror', 554 558 'value' => (isset($rule_data["modal_html"]) ? html_entity_decode($rule_data["modal_html"]) : '') 555 559 ]) .' … … 664 668 </div> 665 669 670 <!-- TUA Add Rule Settings --> 671 666 672 </div> 667 673 … … 678 684 '; 679 685 686 $html = apply_filters( 'tua_update_rule_html', $html, $rule_data); 687 680 688 echo wp_kses($html, $this->allowedHTML); 681 689 -
targeted-actions/tags/1.1/features/formhandlers/SaveEditRule.php
r2649595 r2658193 204 204 $values["cookie_php_only"] = Form::getArg("cookie_php_only"); 205 205 $values["cookie_no_overwrite"] = Form::getArg("cookie_no_overwrite"); 206 207 // Get any custom values for any custom rules created using hooks / outside plugins 208 $values = apply_filters( 'tua_save_rule_values', $values); 206 209 210 // Define values that are required for all rules 207 211 $required_values = ["rule_name", "rule_action"]; 212 213 // Allow adding values that are required for all rules 214 // If you're creating a custom plugin using hooks, this usually isn't the place to validate your custom rules 215 $required_values = apply_filters( 'tua_define_global_required_values', $required_values); 208 216 209 217 if($update === true) { … … 326 334 } 327 335 336 // If you are creating a custom trigger or action, use this hook to validate any required fields are present 337 $response = apply_filters( 'tua_validate_and_respond', $response, $values); 338 328 339 if(isset($response["errors"]) AND count($response["errors"]) > 0) { 329 340 $is_valid = false; -
targeted-actions/tags/1.1/features/rules/Rules.php
r2649595 r2658193 129 129 $rule_trigger_conditions["number_of_website_visits"] = $session_info["visit_count"]; 130 130 131 $rule_trigger_conditions = apply_filters( 'tua_current_conditions', $rule_trigger_conditions); 132 131 133 // Ensure that only one modal rule triggers per iteration 132 134 $modal_rule_will_fire = false; … … 257 259 // echo "<p>Evaluating rule: " . $rule["rule_name"] . "</p>"; 258 260 261 // Hook for validating that custom trigger conditions are met 262 $conditions_met = apply_filters( 'tua_conditions_met', $conditions_met, $rule, $rule_trigger_conditions); 263 259 264 $all_conditions_met = true; 260 265 … … 280 285 $this->executeSetCookie($rule); 281 286 } 287 288 // Custom action for executing custom rules 289 do_action("tua_execute_actions", $rule["rule_action"], $rule, $modal_rule_will_fire); 282 290 283 291 } -
targeted-actions/tags/1.1/readme.txt
r2649595 r2658193 5 5 Tested up to: 5.8.2 6 6 Requires PHP: 5.6.40 7 Stable tag: 1. 07 Stable tag: 1.1 8 8 License: Expat 9 9 License URI: https://directory.fsf.org/wiki/License:Expat … … 14 14 Targeted User Actions is a plugin that allows you to perform actions on your website, such as showing a modal (pop-up) window or setting a cookie, only for users who match criteria that you define. For instance, with this plugin you can target users who have visited a specific product page on your website more than once across multiple browser sessions, and then show those users a pop-up window that offers them a discount code on the product. 15 15 16 Easily set up rules to find users who match specific criteria and fire actions only for those users. You can target users by the current page URL, number of times the user has viewed a page, a user \'s logged in status as well as how many total visits a user has made to your site. Combine these targeting criteria for even more powerful user targeting.16 Easily set up rules to find users who match specific criteria and fire actions only for those users. You can target users by the current page URL, number of times the user has viewed a page, a user's logged in status as well as how many total visits a user has made to your site. Combine these targeting criteria for even more powerful user targeting. 17 17 18 If a user matches one of the rules you have defined, you can then perform an action only on that user. Actions you can perform are launching a modal (pop-up) window or setting a cookie on the user \'s browser. Our goal is to add more actions in future versions of the plugin, as well as eventually give developers tools to add their own custom targeting metrics and actions via Wordpress hooks.18 If a user matches one of the rules you have defined, you can then perform an action only on that user. Actions you can perform are launching a modal (pop-up) window or setting a cookie on the user's browser. Our goal is to add more actions in future versions of the plugin, as well as eventually give developers tools to add their own custom targeting metrics and actions via Wordpress hooks. 19 19 20 20 The plugin can also be configured to not track any users until a specific cookie is present for the user, which makes the plugin compatible with cookie notice plugins that set a cookie only after a user gives consent to be tracked. 21 21 22 == Frequently Asked Questions == 23 24 = How does this plugin work? = 25 26 When a user first visits your website, this plugin creates a unique session ID for that user and stores that session ID in the database. It also stores a cookie on the user's browser that contains this session ID. As a user browses your website, each page they load is logged in the database and compared against the targeting rules you define. If a match is found, your targeting rule fires for that user. If a user ends their session and comes back, the plugin reads their previous session ID from the saved cookie and associates that previous session ID with that user, allowing users to be tracked across sessions. 27 28 = What if I cannot track users until they consent? = 29 30 If you need to obtain consent before tracking users, you can obtain consent using a cookie bar plugin. You can configure Targeted User Actions to not track users before this consent is obtained, however the plugin also will not be able to execute any actions for a user until consent is obtained. Determine the name of the cookie your cookie consent plugin saves when a user gives consent, then enter that cookie name in the *Required Cookie Name* box under the Targeted User Actions plugin settings and ensure the *Require that the following cookie be set before tracking users* checkbox is selected. This will ensure that users are only tracked once they give consent to being tracked. 31 32 = My rules are not firing, or are firing for every user. What is wrong? = 33 34 Ensure that you do not have any caching enabled that may interfere with the Targeted User Actions plugin. Aggressive caching may serve up the same content for multiple users, which is a problem if you have a rule you want to fire only for specific users. 35 36 = I am trying to use custom HTML for my modal but some of it is being removed. Why? = 37 38 For security reasons, only common HTML tags and attributes are allowed in the code shown in the modal. We have tried to allow the major common HTML tags and attributes, but if there is one that you require please contact us and we will consider adding it in a future release. 39 40 == Screenshots == 41 42 1. Show a modal window only to targeted users. Use this plugin to give users an additional nudge to complete a purchase by showing a promo code or other content unique to them. 43 2. Easily view, edit, disable or delete all of your targeted rules. 44 3. Create a new rule and use triggers to determine for which users this rule will fire. 45 4. Use the modal builder to easily add content for your modal. Add text and change the colors of the modal text, button and background. 46 5. Are you a developer? Use custom HTML content inside of your modal to create something unique. 47 6. Need to obtain consent before tracking users? Set a cookie that must be present before the plugin will track your users. 48 22 49 == Changelog == 50 1.1 - Added custom hooks so that developers can create their own targeting rules and actions. 23 51 1.0 - Initial Plugin Release -
targeted-actions/trunk/TargetedUserActions.php
r2649595 r2658193 5 5 Plugin Name: Targeted User Actions 6 6 description: A plugin that allows you to target users of your website and perform custom actions, including showing a pop-up or setting a cookie, only for matching users. 7 Version: 1. 07 Version: 1.1 8 8 Author: StrategicPlugins.com 9 9 Author URI: https://strategicplugins.com -
targeted-actions/trunk/assets/js/admin.js
r2649595 r2658193 29 29 // CodeMirror 30 30 31 if($('#modal-html-codemirror').length > 0) { 32 wp.codeEditor.initialize($('#modal-html-codemirror'), cm_settings); 31 if($('.js-tua-codemirror').length > 0) { 32 $( ".js-tua-codemirror" ).each(function( index ) { 33 wp.codeEditor.initialize($(this), cm_settings); 34 }); 33 35 } 34 36 -
targeted-actions/trunk/features/admin/RuleFields.php
r2649595 r2658193 215 215 public static function ruleType($value = "") { 216 216 217 $available_actions = []; 218 $available_actions["show_modal"] = 'Show a Modal / Popup Window'; 219 $available_actions["set_cookie"] = 'Set a cookie on the user\'s browser'; 220 221 // Use the tua_define_actions hook to add a new option 222 $available_actions = apply_filters( 'tua_define_actions', $available_actions); 223 217 224 $html = ' 218 225 <div class="form-row settings-row"> … … 221 228 <div class="form-rule-select"> 222 229 ' . Form::radio("rule_action", 223 [ 224 'show_modal' => 'Show a Modal / Popup Window', 225 'set_cookie' => 'Set a cookie on the user\'s browser' 226 ], 230 $available_actions, 227 231 [ 228 232 'label' => 'Select Rule Action', -
targeted-actions/trunk/features/admin/TUAAdmin.php
r2649595 r2658193 252 252 $rule_to_edit = ""; 253 253 $update_rule = ""; 254 $rule_data = ""; 254 255 255 256 if(Form::getArg("ruleID") != "" AND is_numeric(Form::getArg("ruleID"))) { … … 331 332 (isset($rule_data["required_visit_count"]) ? $rule_data["required_visit_count"] : '') 332 333 ) . ' 334 335 <!-- TUA Rule Triggers --> 333 336 334 337 </div> … … 552 555 'label' => 'Modal HTML', 553 556 'id' => 'modal-html-codemirror', 557 'field_class' => 'js-tua-codemirror', 554 558 'value' => (isset($rule_data["modal_html"]) ? html_entity_decode($rule_data["modal_html"]) : '') 555 559 ]) .' … … 664 668 </div> 665 669 670 <!-- TUA Add Rule Settings --> 671 666 672 </div> 667 673 … … 678 684 '; 679 685 686 $html = apply_filters( 'tua_update_rule_html', $html, $rule_data); 687 680 688 echo wp_kses($html, $this->allowedHTML); 681 689 -
targeted-actions/trunk/features/formhandlers/SaveEditRule.php
r2649595 r2658193 204 204 $values["cookie_php_only"] = Form::getArg("cookie_php_only"); 205 205 $values["cookie_no_overwrite"] = Form::getArg("cookie_no_overwrite"); 206 207 // Get any custom values for any custom rules created using hooks / outside plugins 208 $values = apply_filters( 'tua_save_rule_values', $values); 206 209 210 // Define values that are required for all rules 207 211 $required_values = ["rule_name", "rule_action"]; 212 213 // Allow adding values that are required for all rules 214 // If you're creating a custom plugin using hooks, this usually isn't the place to validate your custom rules 215 $required_values = apply_filters( 'tua_define_global_required_values', $required_values); 208 216 209 217 if($update === true) { … … 326 334 } 327 335 336 // If you are creating a custom trigger or action, use this hook to validate any required fields are present 337 $response = apply_filters( 'tua_validate_and_respond', $response, $values); 338 328 339 if(isset($response["errors"]) AND count($response["errors"]) > 0) { 329 340 $is_valid = false; -
targeted-actions/trunk/features/rules/Rules.php
r2649595 r2658193 129 129 $rule_trigger_conditions["number_of_website_visits"] = $session_info["visit_count"]; 130 130 131 $rule_trigger_conditions = apply_filters( 'tua_current_conditions', $rule_trigger_conditions); 132 131 133 // Ensure that only one modal rule triggers per iteration 132 134 $modal_rule_will_fire = false; … … 257 259 // echo "<p>Evaluating rule: " . $rule["rule_name"] . "</p>"; 258 260 261 // Hook for validating that custom trigger conditions are met 262 $conditions_met = apply_filters( 'tua_conditions_met', $conditions_met, $rule, $rule_trigger_conditions); 263 259 264 $all_conditions_met = true; 260 265 … … 280 285 $this->executeSetCookie($rule); 281 286 } 287 288 // Custom action for executing custom rules 289 do_action("tua_execute_actions", $rule["rule_action"], $rule, $modal_rule_will_fire); 282 290 283 291 } -
targeted-actions/trunk/readme.txt
r2649595 r2658193 5 5 Tested up to: 5.8.2 6 6 Requires PHP: 5.6.40 7 Stable tag: 1. 07 Stable tag: 1.1 8 8 License: Expat 9 9 License URI: https://directory.fsf.org/wiki/License:Expat … … 12 12 13 13 == Description == 14 Targeted User Actions is a plugin that allows you to perform actions on your website, such as showing a modal (pop-up) window or setting a cookie, only for users who match criteria that you define. For instance, with this plugin you can target users who have visited a specific product page on your website more than once across multiple browser sessions, and then show those users a pop-up window that offers them a discount code on the product.15 14 16 Easily set up rules to find users who match specific criteria and fire actions only for those users. You can target users by the current page URL, number of times the user has viewed a page, a user\'s logged in status as well as how many total visits a user has made to your site. Combine these targeting criteria for even more powerful user targeting. 17 18 If a user matches one of the rules you have defined, you can then perform an action only on that user. Actions you can perform are launching a modal (pop-up) window or setting a cookie on the user\'s browser. Our goal is to add more actions in future versions of the plugin, as well as eventually give developers tools to add their own custom targeting metrics and actions via Wordpress hooks. 19 20 The plugin can also be configured to not track any users until a specific cookie is present for the user, which makes the plugin compatible with cookie notice plugins that set a cookie only after a user gives consent to be tracked. 21 22 == Changelog == 23 1.0 - Initial Plugin Release 15 This readme file is used by the Wordpress repo to pull the proper version using the stable tag. View the plugin description and changelog in the newest plugin version's readme file.
Note: See TracChangeset
for help on using the changeset viewer.