Skip to content

Commit

Permalink
Fix JS code; Change desc. for Stape Analytics support option
Browse files Browse the repository at this point in the history
  • Loading branch information
plance committed Sep 18, 2024
1 parent 1443bb0 commit 41ffb00
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 7 additions & 3 deletions assets/js/admin-javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,17 @@ var pluginGtmServerSide = {
return;
}

var $elCookieKeeper = jQuery( '#gtm_server_side_cookie_keeper' );
this.changeWebIdentifierCheckboxState( $elWebIdentifier, jQuery( '#gtm_server_side_stape_analytics_support' ) );
this.changeWebIdentifierCheckboxState( $elWebIdentifier, jQuery( '#gtm_server_side_cookie_keeper' ) );
},

changeWebIdentifierCheckboxState: function( $elWebIdentifier, $el ) {
if ( 0 === $elWebIdentifier.val().length ) {
$elCookieKeeper
$el
.prop( 'checked', false )
.prop( 'disabled', true );
} else {
$elCookieKeeper.prop( 'disabled', false );
$el.prop( 'disabled', false );
}
},

Expand Down
2 changes: 1 addition & 1 deletion includes/class-gtm-server-side-admin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ function() {
value="yes">';
echo '<br>';
printf(
__( 'Stape container identifier, перед Cookie Keeper - "Tick this checkbox if you are using Stape Analytics. Learn more about it <a href="%s" target="_blank">here</a>."', 'gtm-server-side' ), //phpcs:ignore
__( 'Tick this checkbox if you are using Stape Analytics. Learn more about it <a href="%s" target="_blank">here</a>.', 'gtm-server-side' ), //phpcs:ignore
'https://stape.io/blog/stape-analytics-measure-the-impact-of-your-server-side-tracking?mtm_campaign=wp_app_settings',
);
},
Expand Down
6 changes: 1 addition & 5 deletions includes/class-gtm-server-side-tracking-code.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,7 @@ public function body() {
private function print_default_gtm_code() {
echo "
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'" . esc_js( GTM_Server_Side_Helpers::get_gtm_container_url() ) . '/' . esc_js( GTM_Server_Side_Helpers::get_gtm_container_identifier() ) . '.js?' . esc_js( GTM_Server_Side_Helpers::get_gtm_param_id() ) . "='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','" . esc_js( GTM_Server_Side_Helpers::get_gtm_container_id() ) . "');</script>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s);j.async=true;j.src=\"" . esc_js( GTM_Server_Side_Helpers::get_gtm_container_url() ) . '/' . esc_js( GTM_Server_Side_Helpers::get_gtm_container_identifier() ) . '.js?' . esc_js( GTM_Server_Side_Helpers::get_gtm_param_id() ) . "\"+i;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','" . esc_js( GTM_Server_Side_Helpers::get_gtm_container_id() ) . "');</script>
<!-- End Google Tag Manager -->
";
}
Expand Down

0 comments on commit 41ffb00

Please sign in to comment.