Tracking Code Manager - Version 2.0.3

Version Description

Release Date - 2021-07-22

  • IWP-50 Enable change of priority in placement of scripts. Add priority setting to admin settings page.
  • IWP-273 Position code at the beginning of the body instead of the end.
Download this release

Release Info

Developer IntellyWP
Plugin Icon 128x128 Tracking Code Manager
Version 2.0.3
Comparing to
See all releases

Code changes from version 2.0.2 to 2.0.3

includes/admin/settings.php CHANGED
@@ -30,9 +30,16 @@ function tcmp_ui_settings() {
30
  $options[$k]=$v;
31
  }
32
  $tcmp->Options->setMetaboxPostTypes($options);
 
 
33
  }
34
 
35
  $tcmp->Form->formStarts();
 
 
 
 
 
36
  $tcmp->Form->p('MetaboxSection');
37
  $metaboxes=$tcmp->Options->getMetaboxPostTypes();
38
 
30
  $options[$k]=$v;
31
  }
32
  $tcmp->Options->setMetaboxPostTypes($options);
33
+
34
+ $tcmp->Options->setHookPriority($tcmp->Utils->iqs('tcmpHookPriority', TCMP_HOOK_PRIORITY_DEFAULT));
35
  }
36
 
37
  $tcmp->Form->formStarts();
38
+ $tcmp->Form->prefix = 'Priority';
39
+ $tcmp->Form->p('PrioritySection');
40
+ $tcmp->Form->number('tcmpHookPriority', $tcmp->Options->getHookPriority());
41
+
42
+ $tcmp->Form->prefix='License';
43
  $tcmp->Form->p('MetaboxSection');
44
  $metaboxes=$tcmp->Options->getMetaboxPostTypes();
45
 
includes/classes/core/Singleton.php CHANGED
@@ -12,6 +12,7 @@ class TCMP_Singleton {
12
  var $Ecommerce;
13
  var $Plugin;
14
  var $Tabs;
 
15
 
16
  function __construct() {
17
  $this->Lang=new TCMP_Language();
@@ -26,6 +27,7 @@ class TCMP_Singleton {
26
  $this->Manager=new TCMP_Manager();
27
  $this->Ecommerce=new TCMP_Ecommerce();
28
  $this->Plugin=new TCMP_Plugin();
 
29
  }
30
  public function init() {
31
  $this->Lang->load('tcmp', TCMP_PLUGIN_DIR.'languages/Lang.txt');
12
  var $Ecommerce;
13
  var $Plugin;
14
  var $Tabs;
15
+ var $BodyWritten;
16
 
17
  function __construct() {
18
  $this->Lang=new TCMP_Language();
27
  $this->Manager=new TCMP_Manager();
28
  $this->Ecommerce=new TCMP_Ecommerce();
29
  $this->Plugin=new TCMP_Plugin();
30
+ $this->BodyWritten = false;
31
  }
32
  public function init() {
33
  $this->Lang->load('tcmp', TCMP_PLUGIN_DIR.'languages/Lang.txt');
includes/classes/ui/Form.php CHANGED
@@ -20,6 +20,11 @@ class TCMP_Form {
20
  //args can be a string or an associative array if you want
21
  private function getTextArgs($args, $defaults, $excludes=array()) {
22
  $result=$args;
 
 
 
 
 
23
  if(is_array($result) && count($result)>0) {
24
  $result='';
25
  foreach($args as $k=>$v) {
@@ -275,19 +280,41 @@ class TCMP_Form {
275
  $this->rightInput($name, $args);
276
  }
277
 
278
- public function text($name, $value='', $options=NULL) {
279
- if(is_array($value) && isset($value[$name])) {
280
- $value=$value[$name];
 
 
 
 
 
 
 
281
  }
282
- $defaults=array('class'=>'tcmp-text');
283
- $other=$this->getTextArgs($options, $defaults);
284
 
285
- $options=array('class'=>'tcmp-label');
286
- $this->leftInput($name, $options);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  ?>
288
- <input type="text" id="<?php echo $name ?>" name="<?php echo $name ?>" value="<?php echo $value ?>" <?php echo $other?> />
289
  <?php
290
- $this->rightInput($name, $options);
291
  }
292
 
293
  public function hidden($name, $value='', $args=NULL) {
20
  //args can be a string or an associative array if you want
21
  private function getTextArgs($args, $defaults, $excludes=array()) {
22
  $result=$args;
23
+
24
+ if (is_string($excludes)) {
25
+ $excludes = explode(',', $excludes);
26
+ }
27
+
28
  if(is_array($result) && count($result)>0) {
29
  $result='';
30
  foreach($args as $k=>$v) {
280
  $this->rightInput($name, $args);
281
  }
282
 
283
+ public function number($name, $value = '', $options = NULL)
284
+ {
285
+ if (!$options) {
286
+ $options = array();
287
+ }
288
+ $options['type'] = 'number';
289
+ $options['autocomplete'] = 'off';
290
+ $options['style'] = 'width:100px;';
291
+ if (!isset($options['min'])) {
292
+ $options['min'] = 0;
293
  }
 
 
294
 
295
+ return $this->text($name, $value, $options);
296
+ }
297
+
298
+ public function text($name, $value = '', $options = NULL)
299
+ {
300
+ if (is_array($value) && isset($value[$name])) {
301
+ $value = $value[$name];
302
+ }
303
+
304
+ $type = 'text';
305
+ if (isset($options['type'])) {
306
+ $type = $options['type'];
307
+ }
308
+
309
+ $defaults = array('class' => 'tcmp-'.$type);
310
+ $other = $this->getTextArgs($options, $defaults, 'type');
311
+
312
+ $args = array('class' => 'tcmp-label');
313
+ $this->leftInput($name, $args);
314
  ?>
315
+ <input type="<?php echo $type?>" id="<?php echo $name ?>" name="<?php echo $name ?>" value="<?php echo $value ?>" <?php echo $other?> />
316
  <?php
317
+ $this->rightInput($name, $args);
318
  }
319
 
320
  public function hidden($name, $value='', $args=NULL) {
includes/classes/utils/Options.php CHANGED
@@ -427,4 +427,15 @@ class TCMP_Options {
427
  public function setMetaboxPostTypes($values) {
428
  $this->setOption('MetaboxPostTypes', $values);
429
  }
 
 
 
 
 
 
 
 
 
 
 
430
  }
427
  public function setMetaboxPostTypes($values) {
428
  $this->setOption('MetaboxPostTypes', $values);
429
  }
430
+
431
+ //hook priority
432
+ public function getHookPriority()
433
+ {
434
+ return $this->getOption('HookPriority', TCMP_HOOK_PRIORITY_DEFAULT);
435
+ }
436
+
437
+ public function setHookPriority($value)
438
+ {
439
+ $this->setOption('HookPriority', $value);
440
+ }
441
  }
includes/core.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  //per agganciarsi ogni volta che viene scritto un contenuto
3
- add_filter('wp_head', 'tcmp_head');
4
  function tcmp_head(){
5
  global $post, $tcmp;
6
 
@@ -10,6 +10,8 @@ function tcmp_head(){
10
  $tcmp->Log->info('POST ID=%s IS SHOWN', $post->ID);
11
  }
12
 
 
 
13
  //future development
14
  //is_archive();
15
  //is_post_type_archive();
@@ -17,11 +19,25 @@ function tcmp_head(){
17
  //is_attachment();
18
  $tcmp->Manager->writeCodes(TCMP_POSITION_HEAD);
19
  }
20
- add_action('wp_footer', 'tcmp_footer');
21
- function tcmp_footer() {
 
 
22
  global $tcmp;
23
- //there isn't a hook when <BODY> starts
24
  $tcmp->Manager->writeCodes(TCMP_POSITION_BODY);
 
 
 
 
 
 
 
 
 
 
 
 
25
  $tcmp->Manager->writeCodes(TCMP_POSITION_CONVERSION);
26
  $tcmp->Manager->writeCodes(TCMP_POSITION_FOOTER);
27
  }
1
  <?php
2
  //per agganciarsi ogni volta che viene scritto un contenuto
3
+ add_filter('wp_head', 'tcmp_head', get_option('TCM_HookPriority', TCMP_HOOK_PRIORITY_DEFAULT));
4
  function tcmp_head(){
5
  global $post, $tcmp;
6
 
10
  $tcmp->Log->info('POST ID=%s IS SHOWN', $post->ID);
11
  }
12
 
13
+ $tcmp->BodyWritten = false;
14
+
15
  //future development
16
  //is_archive();
17
  //is_post_type_archive();
19
  //is_attachment();
20
  $tcmp->Manager->writeCodes(TCMP_POSITION_HEAD);
21
  }
22
+
23
+ add_action('wp_body_open', 'tcmp_body', get_option('TCM_HookPriority', TCMP_HOOK_PRIORITY_DEFAULT));
24
+ function tcmp_body()
25
+ {
26
  global $tcmp;
27
+
28
  $tcmp->Manager->writeCodes(TCMP_POSITION_BODY);
29
+ $tcmp->BodyWritten = true;
30
+ }
31
+
32
+ add_action('wp_footer', 'tcmp_footer', get_option('TCM_HookPriority', TCMP_HOOK_PRIORITY_DEFAULT));
33
+ function tcmp_footer() {
34
+ global $tcmp;
35
+
36
+ if (!$tcmp->BodyWritten) {
37
+ // this is a fallback if wp_body_open() is not called by the theme
38
+ $tcmp->Manager->writeCodes(TCMP_POSITION_BODY);
39
+ }
40
+
41
  $tcmp->Manager->writeCodes(TCMP_POSITION_CONVERSION);
42
  $tcmp->Manager->writeCodes(TCMP_POSITION_FOOTER);
43
  }
index.php CHANGED
@@ -6,7 +6,7 @@ Description: A plugin to manage ALL your tracking code and conversion pixels, si
6
  Author: IntellyWP
7
  Author URI: http://intellywp.com/
8
  Email: info@intellywp.com
9
- Version: 2.0.2
10
  WC requires at least: 3.0.0
11
  WC tested up to: 4
12
  */
@@ -26,7 +26,7 @@ define('TCMP_PLUGIN_PREFIX', 'TCMP_');
26
  define('TCMP_PLUGIN_FILE',__FILE__);
27
  define('TCMP_PLUGIN_SLUG', 'tracking-code-manager');
28
  define('TCMP_PLUGIN_NAME', 'Tracking Code Manager');
29
- define('TCMP_PLUGIN_VERSION', '2.0.2');
30
  define('TCMP_PLUGIN_AUTHOR', 'IntellyWP');
31
 
32
  define('TCMP_PLUGIN_DIR', dirname(__FILE__).'/');
@@ -65,6 +65,8 @@ define('TCMP_DEVICE_TYPE_TABLET', 'tablet');
65
  define('TCMP_DEVICE_TYPE_DESKTOP', 'desktop');
66
  define('TCMP_DEVICE_TYPE_ALL', 'all');
67
 
 
 
68
  define('TCMP_TAB_EDITOR', 'editor');
69
  define('TCMP_TAB_EDITOR_URI', TCMP_PAGE_MANAGER.'&tab='.TCMP_TAB_EDITOR);
70
  define('TCMP_TAB_MANAGER', 'manager');
6
  Author: IntellyWP
7
  Author URI: http://intellywp.com/
8
  Email: info@intellywp.com
9
+ Version: 2.0.3
10
  WC requires at least: 3.0.0
11
  WC tested up to: 4
12
  */
26
  define('TCMP_PLUGIN_FILE',__FILE__);
27
  define('TCMP_PLUGIN_SLUG', 'tracking-code-manager');
28
  define('TCMP_PLUGIN_NAME', 'Tracking Code Manager');
29
+ define('TCMP_PLUGIN_VERSION', '2.0.3');
30
  define('TCMP_PLUGIN_AUTHOR', 'IntellyWP');
31
 
32
  define('TCMP_PLUGIN_DIR', dirname(__FILE__).'/');
65
  define('TCMP_DEVICE_TYPE_DESKTOP', 'desktop');
66
  define('TCMP_DEVICE_TYPE_ALL', 'all');
67
 
68
+ define('TCMP_HOOK_PRIORITY_DEFAULT', 10);
69
+
70
  define('TCMP_TAB_EDITOR', 'editor');
71
  define('TCMP_TAB_EDITOR_URI', TCMP_PAGE_MANAGER.'&tab='.TCMP_TAB_EDITOR);
72
  define('TCMP_TAB_MANAGER', 'manager');
languages/Lang.txt CHANGED
@@ -105,6 +105,9 @@ License.licenseSiteCount=License site count
105
  License.metabox=In "<b>{0}</b>"
106
  LicenseSection=License information
107
  LicenseSectionSubtitle=Insert the activation key received by email in the text below to see all the settings
 
 
 
108
  Manager=
109
  ManagerTitle=Welcome to "<b>Tracking Code Manager</b> (v.{0})", an <a href="https://intellywp.com/" target="_blank"><b>IntellyWP</b></a> plugin.
110
  MetaboxSection=Metabox information
105
  License.metabox=In "<b>{0}</b>"
106
  LicenseSection=License information
107
  LicenseSectionSubtitle=Insert the activation key received by email in the text below to see all the settings
108
+ Priority.tcmpHookPriority=Priority
109
+ PrioritySection=Priority Setting
110
+ PrioritySectionSubtitle=Change the priority used to insert the scripts onto the page. (Default priority is 10, 1 is the highest priority and lower priorities are higher numbers.)
111
  Manager=
112
  ManagerTitle=Welcome to "<b>Tracking Code Manager</b> (v.{0})", an <a href="https://intellywp.com/" target="_blank"><b>IntellyWP</b></a> plugin.
113
  MetaboxSection=Metabox information
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: IntellyWP, data443
3
  Tags: adwords remarketing,analytics conversion tracking,conversion pixel,conversion tracking,conversion tracking adwords,conversion tracking pixel,conversion tracking script,Facebook Ads,facebook conversion pixel,facebook custom audience,facebook retargeting,google adwords,google analytics web tracking code,google tag manager,html snippet,html snippets,html tracking code,javascript snippet,javascript snippets,header and footer,pay per click tracking,pixel tracking code,remarketing,retargeting,snippets,Tag Management,track conversion,track conversions,tracking code,tracking codes,tracking script,woocommerce,edd,easy digital downloads,wp ecommerce,wp e-commerce
4
  Requires at least: 2.7
5
- Tested up to: 5.7
6
 
7
  A plugin to manage ALL your tracking code and conversion pixels. Compatible with Facebook Ads, Google Adwords, WooCommerce, Easy Digital Downloads, ..
8
 
@@ -105,6 +105,12 @@ Have a look at the source code of your page (search for: Tracking Code Manager)
105
 
106
  == Changelog ==
107
 
 
 
 
 
 
 
108
  = 2.0.2 =
109
  *Release Date - 2021-06-17*
110
 
2
  Contributors: IntellyWP, data443
3
  Tags: adwords remarketing,analytics conversion tracking,conversion pixel,conversion tracking,conversion tracking adwords,conversion tracking pixel,conversion tracking script,Facebook Ads,facebook conversion pixel,facebook custom audience,facebook retargeting,google adwords,google analytics web tracking code,google tag manager,html snippet,html snippets,html tracking code,javascript snippet,javascript snippets,header and footer,pay per click tracking,pixel tracking code,remarketing,retargeting,snippets,Tag Management,track conversion,track conversions,tracking code,tracking codes,tracking script,woocommerce,edd,easy digital downloads,wp ecommerce,wp e-commerce
4
  Requires at least: 2.7
5
+ Tested up to: 5.8
6
 
7
  A plugin to manage ALL your tracking code and conversion pixels. Compatible with Facebook Ads, Google Adwords, WooCommerce, Easy Digital Downloads, ..
8
 
105
 
106
  == Changelog ==
107
 
108
+ = 2.0.3 =
109
+ *Release Date - 2021-07-22*
110
+
111
+ * IWP-50 Enable change of priority in placement of scripts. Add priority setting to admin settings page.
112
+ * IWP-273 Position code at the beginning of the body instead of the end.
113
+
114
  = 2.0.2 =
115
  *Release Date - 2021-06-17*
116