helick /
gtm
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | namespace Helick\GTM; |
||||||
| 4 | |||||||
| 5 | use Helick\Contracts\Bootable; |
||||||
| 6 | |||||||
| 7 | final class EventTracking implements Bootable |
||||||
| 8 | { |
||||||
| 9 | /** |
||||||
| 10 | * Boot the service. |
||||||
| 11 | * |
||||||
| 12 | * @return void |
||||||
| 13 | */ |
||||||
| 14 | public static function boot(): void |
||||||
| 15 | { |
||||||
| 16 | $self = new static; |
||||||
| 17 | |||||||
| 18 | add_action('wp_enqueue_scripts', [$self, 'enqueueScripts']); |
||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 19 | } |
||||||
| 20 | |||||||
| 21 | /** |
||||||
| 22 | * Enqueue scripts. |
||||||
| 23 | * |
||||||
| 24 | * @return void |
||||||
| 25 | */ |
||||||
| 26 | public function enqueueScripts(): void |
||||||
| 27 | { |
||||||
| 28 | /** |
||||||
| 29 | * Control whether to load the data attribute tracking script. |
||||||
| 30 | * |
||||||
| 31 | * @param bool $isEnabled |
||||||
| 32 | */ |
||||||
| 33 | $isEnabled = apply_filters('helick_gtm_enable_event_tracking', true); |
||||||
|
0 ignored issues
–
show
The function
apply_filters was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 34 | |||||||
| 35 | if (!$isEnabled) { |
||||||
| 36 | return; |
||||||
| 37 | } |
||||||
| 38 | |||||||
| 39 | wp_enqueue_script( |
||||||
|
0 ignored issues
–
show
The function
wp_enqueue_script was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 40 | 'helick-gtm-event-tracking', |
||||||
| 41 | plugin_dir_url(dirname(__FILE__)) . 'resources/js/event-tracking.js', |
||||||
|
0 ignored issues
–
show
The function
plugin_dir_url was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 42 | [], |
||||||
| 43 | filemtime(plugin_dir_path(dirname(__FILE__)) . 'resources/js/event-tracking.js'), |
||||||
|
0 ignored issues
–
show
The function
plugin_dir_path was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 44 | true |
||||||
| 45 | ); |
||||||
| 46 | } |
||||||
| 47 | } |
||||||
| 48 |