JavaScript get search page title?


I’m using Adsense for search on my osclass site.

Here is the line of code I insert into my site to get the page title:
“query”: “page title” // Make sure that the correct query is placed here!

How do you insert the page title in the JavaScript code? I’ve tried <?php echo meta_title(); ?> but this doesn’t work.

Any help is appreciated

<?php echo meta_title(); ?>

This should work as expected but sometimes few plugins or theme can interfere with this function. Try with plugins disabled.


Thanks for your help, it is much appreciated.

That doesn’t seem to work when it is in the JavaScript code.

Here is my html source code of the parsed page:

    "query": "<?php echo meta_title(); ?>" // Make sure that the correct query is placed here!

Can you suggest anything else as when I try and insert the PHP code in between the JavaScript code it doesn’t seem to work?

Many thanks

Didn’t get your html source, share your site url if possible.