Optimize
3.1K members online now
3.1K members online now
Everything you need to know about setting up Optimize including creating your account and container, linking to Google Analytics and how to tag your site.
Guide Me
star_border
Reply

Is it possible to edit <head> code in optimize experiments?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

We are trying to change a meta tag based variation to render without the meta tag in <head> for a variation but can't seem to render the variation correctly for some reason.  Is it possible to change <head> info in experiments?

1 Expert replyverified_user

Is it possible to edit &lt;head&gt; code in optimize experiments?

Google Employee
# 2
Google Employee

Yes you can change <head> info, for example one can change the page title by changing the text of <title>.

 

This can be done using the "Select elements" dialog (button on top-left of the editor) where one can just type the CSS selector (i.e. "title") and choose what kind of change would like to add (i.e. a "text change").

 

About <meta> tags, what you can do pretty much depends on what the browser allows to be changed dynamically (after the page has been parsed).

 

I would be very surprised for example if browsers would allow js code to change the content security policy meta tag, since this would be a big security hole.

 

Which meta tag would you like to change?