Meta tags and scripts


Hey everyone,

does anyone know how to add the meta tags and scripts like analyctics.js etc..??



Alternatively, there is the Google Analytics Dashboard for WP plugin. Notwithstanding first impressions, it's not a plugin to just display an Analytics widget in the dashboard and throw in the GA script. It's real perks are in its ability to finetune script functionality in tune with Search Console, Google Analytics configurations (as well as adherence to legal requirements depending on where the service area of the website is located, for example EU).

Another option which may very well be even more interesting is to use Google Tag Manager. Since Beans provides such an excellent structured data layer, it's an enormous waste to not provide that with a flexible data information layer. You can use Google's Tag Manager to manage GA script & settings, but it also enables you to link actions (page load, page action, etc) up with insertion-on-the-fly of JSON-LD scripts (pretty much a requirement for things like KnowledgeGraph, LocalBusiness, Product / Service & Catalog Offers et alii). There is a simple but very functional WP plugin for it here.


Hey Jochen and J.C.

thank you for your help but i'd love to add the script manually. And analyctics is not the only script there are other scripts whhich you have to add manually. We can use the Header Footer Script plugin but i want to know if i can add the script without any plugin.

well to add metas i use

beans_add_smart_action( 'beans_head', 'hyperindian_meta', 1 );

function hyperindian_meta() {

    echo 'meta tag' . "\n";

}

if anyone is looking for the code here it is.


Sure you can add code in that way. But I would suggest a SEO plugin for every Wordpress blog. At least, if you want traffig from search engines.

In that way, I add also GA and and verification codes with my SEO plugin.


and how do i add scripts..??


Oh my bad. I use a german SEO plugin (https://wpseo.de/), where you can add scripts to the header. I was sure the Yoast plugin can do that too.

Update: Many themes provide a text field to enter scripts in the header and in the footer. I think what would be also a good idea fo the Beans Settings.


Yoast doesn't allows to add scripts it only allows users to add the varification meta tags.

Yes Jochen i was thinking about the same thing a feild to add metas and scripts.


I am interested was Thierry thinks about that, if that can be a standard Beans setting. Thierry?


Hey Guys,

This can be done in a stadard WP fashion using the wp_head action hook to add scripts in the head and wp_footer to add scripts at the bottom of the page as per the example below:

// Scripts, styles or meta tags added in the <head>.
add_action( 'wp_head', 'example_head_scripts' );

function example_head_scripts() {
  // CSS, JS or Meta tags.
}

// Scripts added at the bottom of the page.
add_action( 'wp_footer', 'example_footer_scripts' );

function example_footer_scripts() {
 // JS.
}

This won't be added to Beans Core because it is plugin territory. That said, there is an SEO plugin on the Beans plugins read map but I don't have any ETA for that.

Thanks guys,


About the plugins. Maybe it is a good idea, that you start with a minimum/blueprint plugin. With that one we can easier start with our Beans plugins.


Great idea, I have made a note to build a boilerplate plugin which includes Beans booting etc.

Thanks,


Would be neat for Widgets too - there's a heck of a lot possible with even widget based extensibility.

Write a reply

Login or register to write a reply, it's free!