Skip to content

Commit

Permalink
Added a new section for GTM templates
Browse files Browse the repository at this point in the history
  • Loading branch information
TorbenLundsgaard committed Mar 14, 2024
1 parent 1ba3b44 commit 5ddce8a
Show file tree
Hide file tree
Showing 12 changed files with 121 additions and 14 deletions.
2 changes: 1 addition & 1 deletion assets/admin/settings.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '918cd00c99181c5052ca');
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'baa09cc5199cdd5a4c88');
2 changes: 1 addition & 1 deletion assets/admin/settings.css

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions assets/admin/settings.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/admin/wizard.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '50640e302b51985018ae');
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '255eecb819a4fc7efdfc');
2 changes: 1 addition & 1 deletion assets/admin/wizard.css

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions inc/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use TLA_Media\GTM_Kit\Admin\IntegrationsOptionsPage;
use TLA_Media\GTM_Kit\Admin\MetaBox;
use TLA_Media\GTM_Kit\Admin\SetupWizard;
use TLA_Media\GTM_Kit\Admin\TemplatesOptionsPage;
use TLA_Media\GTM_Kit\Common\RestAPIServer;
use TLA_Media\GTM_Kit\Common\Util;
use TLA_Media\GTM_Kit\Frontend\BasicDatalayerData;
Expand Down Expand Up @@ -147,6 +148,7 @@ function gtmkit_admin_init(): void {
SetupWizard::register();
GeneralOptionsPage::register();
IntegrationsOptionsPage::register();
TemplatesOptionsPage::register();
HelpOptionsPage::register();

do_action( 'gtmkit_admin_init', $options, $util );
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Release date: 2024-MM-DD
Find out about what's new in our [our release post](https://gtmkit.com/gtm-kit-1-20/).

#### Enhancements:
* Added a new section for GTM templates that you can use to configure the necessary Tags, Triggers and Variables in Google Tag Manager.
* Added support for the 'new_customer' parameter on the 'purchase' event, which is used for customer acquisition reporting and Google Smart Shopping campaigns.
* Added a debug log for debugging the 'purchase' event without make a purchase.

Expand Down
98 changes: 98 additions & 0 deletions src/Admin/TemplatesOptionsPage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?php
/**
* GTM Kit plugin file.
*
* @package GTM Kit
*/

namespace TLA_Media\GTM_Kit\Admin;

/**
* IntegrationsOptionsPage
*/
final class TemplatesOptionsPage extends AbstractOptionsPage {

/**
* The option group.
*
* @var string
*/
protected $option_group = 'templates';

/**
* Configure the options page.
*/
public function configure(): void {
register_setting( $this->get_menu_slug(), $this->option_name );
}

/**
* Get the options page menu slug.
*
* @return string
*/
protected function get_menu_slug(): string {
return 'gtmkit_templates';
}

/**
* Get the admin page menu title.
*
* @return string
*/
protected function get_menu_title(): string {
return __( 'GTM Templates', 'gtm-kit' );
}

/**
* Get the options page title.
*
* @return string
*/
protected function get_page_title(): string {
return __( 'GTM Templates', 'gtm-kit' );
}

/**
* Get the parent slug of the options page.
*
* @return string
*/
protected function get_parent_slug(): string {
return 'gtmkit_general';
}

/**
* Enqueue admin page scripts and styles.
*
* @param string $hook Current hook.
*/
public function enqueue_page_assets( string $hook ): void {
if ( \strpos( $hook, $this->get_menu_slug() ) !== false ) {
$this->enqueue_assets( 'templates', 'settings' );
}
}

/**
* Localize script.
*
* @param string $page_slug The page slug.
* @param string $script_handle The script handle.
*/
public function localize_script( string $page_slug, string $script_handle ): void {

\wp_localize_script(
'gtmkit-' . $script_handle . '-script',
'gtmkitSettings',
[
'rootId' => 'gtmkit-settings',
'currentPage' => $page_slug,
'root' => \esc_url_raw( rest_url() ),
'nonce' => \wp_create_nonce( 'wp_rest' ),
'dashboardUrl' => \menu_page_url( 'gtmkit_general', false ),
'integrationsUrl' => \menu_page_url( 'gtmkit_integrations', false ),
'templatesUrl' => \menu_page_url( 'gtmkit_templates', false ),
]
);
}
}
14 changes: 9 additions & 5 deletions src/scss/_tailwind-compiled.scss
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,10 @@ video {
gap: 1.5rem;
}

.gtmkit-gap-8 {
gap: 2rem;
}

.gtmkit-space-x-9 > :not([hidden]) ~ :not([hidden]) {
--tw-space-x-reverse: 0;
margin-right: calc(2.25rem * var(--tw-space-x-reverse));
Expand Down Expand Up @@ -1048,6 +1052,11 @@ video {
padding-right: 1.25rem;
}

.gtmkit-px-6 {
padding-left: 1.5rem;
padding-right: 1.5rem;
}

.gtmkit-px-8 {
padding-left: 2rem;
padding-right: 2rem;
Expand Down Expand Up @@ -1078,11 +1087,6 @@ video {
padding-bottom: 1.5rem;
}

.gtmkit-py-8 {
padding-top: 2rem;
padding-bottom: 2rem;
}

.gtmkit-pb-6 {
padding-bottom: 1.5rem;
}
Expand Down
1 change: 1 addition & 0 deletions vendor/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'TLA_Media\\GTM_Kit\\Admin\\IntegrationsOptionsPage' => $baseDir . '/src/Admin/IntegrationsOptionsPage.php',
'TLA_Media\\GTM_Kit\\Admin\\MetaBox' => $baseDir . '/src/Admin/MetaBox.php',
'TLA_Media\\GTM_Kit\\Admin\\SetupWizard' => $baseDir . '/src/Admin/SetupWizard.php',
'TLA_Media\\GTM_Kit\\Admin\\TemplatesOptionsPage' => $baseDir . '/src/Admin/TemplatesOptionsPage.php',
'TLA_Media\\GTM_Kit\\Common\\RestAPIServer' => $baseDir . '/src/Common/RestAPIServer.php',
'TLA_Media\\GTM_Kit\\Common\\Util' => $baseDir . '/src/Common/Util.php',
'TLA_Media\\GTM_Kit\\Frontend\\BasicDatalayerData' => $baseDir . '/src/Frontend/BasicDatalayerData.php',
Expand Down
1 change: 1 addition & 0 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class ComposerStaticInit3b585b55966a016a3d1b071eb261592a
'TLA_Media\\GTM_Kit\\Admin\\IntegrationsOptionsPage' => __DIR__ . '/../..' . '/src/Admin/IntegrationsOptionsPage.php',
'TLA_Media\\GTM_Kit\\Admin\\MetaBox' => __DIR__ . '/../..' . '/src/Admin/MetaBox.php',
'TLA_Media\\GTM_Kit\\Admin\\SetupWizard' => __DIR__ . '/../..' . '/src/Admin/SetupWizard.php',
'TLA_Media\\GTM_Kit\\Admin\\TemplatesOptionsPage' => __DIR__ . '/../..' . '/src/Admin/TemplatesOptionsPage.php',
'TLA_Media\\GTM_Kit\\Common\\RestAPIServer' => __DIR__ . '/../..' . '/src/Common/RestAPIServer.php',
'TLA_Media\\GTM_Kit\\Common\\Util' => __DIR__ . '/../..' . '/src/Common/Util.php',
'TLA_Media\\GTM_Kit\\Frontend\\BasicDatalayerData' => __DIR__ . '/../..' . '/src/Frontend/BasicDatalayerData.php',
Expand Down
4 changes: 2 additions & 2 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => 'tlamedia/gtm-kit',
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => '406818bc25fd2c83ea467251f9effc2e3efa1ac8',
'reference' => 'ad0bea6e692e6f062b59588c7bc2fdb42b9018f4',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand All @@ -13,7 +13,7 @@
'tlamedia/gtm-kit' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => '406818bc25fd2c83ea467251f9effc2e3efa1ac8',
'reference' => 'ad0bea6e692e6f062b59588c7bc2fdb42b9018f4',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down

0 comments on commit 5ddce8a

Please sign in to comment.