Manage ads and more for websites in the Mai Publisher network.
- Visit Dashboard > Mai Ads > Settings and configure the settings.
- Visit Dashboard > Mai Ads and configure and default ads or add your own.
- Make sure the client network code is set in the settings.
- Run the following filter to add existing ads from GAM.
/**
* Add a new client to the publisher config.
* This will populate the options for the Mai Client GAM Ad Unit block.
*
* @param array $config The existing config.
*
* @return array
*/
add_filter( 'mai_publisher_config', function( $config ) {
$config['client'] = [
'label' => 'Website or Company Name', // Use for the block label in the editor.
'ad_units' => [
'test' => [
'sizes' => [ [300, 50], [300, 100], [300, 250], [320, 50], [336, 280], [580, 400], [728, 90], [750, 100], [750, 200], [750, 300] ],
'sizes_desktop' => [ [580, 400], [728, 90], [750, 100], [750, 200], [750, 300] ],
'sizes_tablet' => [ [300, 50], [300, 100], [300, 250], [320, 50], [336, 280], [580, 400], [728, 90] ],
'sizes_mobile' => [ [300, 50], [300, 100], [300, 250], [320, 50], [336, 280], [580, 400] ],
],
'withprefix/Test/' => [
'sizes' => [ [300, 50], [300, 100], [300, 250], [320, 50], [336, 280], [580, 400], [728, 90], [750, 100], [750, 200], [750, 300], [970, 90], [970, 250] ],
'sizes_desktop' => [ [580, 400], [728, 90], [750, 100], [750, 200], [750, 300], [970, 90], [970, 250] ],
'sizes_tablet' => [ [300, 50], [300, 100], [300, 250], [320, 50], [336, 280], [580, 400] ],
'sizes_mobile' => [ [300, 50], [300, 100], [300, 250], [320, 50], [336, 280] ],
],
'nestedwithprefix/Test/Nested.withPeriod' => [
'sizes' => [ [240, 400], [250, 250], [300, 250], [300, 600], [320, 480], [336, 280], [480, 320], [580, 400], [768, 1024], [1024, 768] ],
'sizes_desktop' => [ [480, 320], [580, 400], [768, 1024], [1024, 768] ],
'sizes_tablet' => [ [320, 480], [468, 60], [480, 320], [580, 400] ],
'sizes_mobile' => [ [240, 400], [250, 250], [300, 250], [300, 600], [320, 480], [336, 280] ],
],
],
];
return $config;
});
This document outlines the steps to set up the development environment, run tasks, and manage the plugin.
-
Node.js: Ensure that you have Node.js installed. You can download and install it from nodejs.org.
-
npm: npm (Node Package Manager) is included with Node.js. Verify its installation with:
bash
npm -v
npm install
If you need to update Node.js to the latest version, you can use nvm (Node Version Manager).
- Install nvm: Follow the installation instructions on (nvm’s GitHub page)[https://github.com/nvm-sh/nvm].
- Update Node.js: Use nvm to install the latest version:
nvm install node
nvm use node
- Development Build: To compile and minify assets for development:
npm run dev
- Production Build: To compile and minify assets for production:
npm run production
- Watch for Changes: To continuously watch and rebuild assets on file changes:
npm run watch
- assets/js: JavaScript source files.
- assets/css: CSS source files.
- blocks: Block-specific source files for JavaScript and CSS.
- build/js: Full (non-minified) and minified JavaScript files.
- build/css: Full (non-minified) and minified CSS files.