This article gives instructions on how to set up and use policies based on CSS selectors.
Automate and standardize website content policies and ensure compliance to brand, legal, style, and regulatory standards.
CSS (Cascading Style Sheet) is a stylesheet language that is used to control the format and/or layout of web documents and pages.
CSS Selectors are expressions that are used to target specific HTML elements to style on a website. Use CSS selectors to improve policy definition, limit searches, and/or exclude content in a policy efficiently. After they are set up, CSS selectors can be used to select elements. In other words, selectors are patterns that are used to select the element(s) to style.
Configure a new policy and specify certain CSS selectors, or patterns of elements, to flag. The browser searches for or excludes the CSS properties only within the targeted HTML elements.
For a video that explains policies and CSS selectors, see the following:
This section gives instructions on how to set up a basic policy. Skip to CSS Selectors if you have done this part already.
Click Select Domain. from the Acquia Optimize Domain Overview page. The Domain Overview page opens.
Click Open on the same row as the domain name.
The Dashboard for the domain opens.
Click Global Policies Overview, the button (mallet icon) on the top menu bar.
Alternatively, click on the header of the Content Policies section.
The Global Policies page opens.
Click Add new policy.
The New Policy page opens.
Click Create your own policy.
The New Policy creation page opens.
Click to select HTML pages.
The New Policy configuration pane opens.
Select Settings.
Configure the settings.
For more information, see the User Guide chapter:
Regular Expressions in source-code exclusions are not 100% compatible with Acquia Optimize Policies. The languages are different (Java and Ruby).
Select +Add rule to policy: Click to add a rule to the policy. The rules selection list opens.
Save the changes. A dialog box opens.
In the dialog box, enter the policy Name (required) and Note if needed and then click Save.
Enter the CSS selector in the Policy Creation steps, when it is requested.
To locate all elements with the class intro, use the .class CSS selector:
.intro
To locate all elements with the id aero1, use the #id CSS selector:
#aero1
To locate all <h2> elements, use the element CSS Selector example:
h2
To locate all <h2> and <a> elements, use:
h2,a
These are separated with a comma and no space between the elements.
To locate all <p> elements inside <div> elements, use:
div p
There is a space between div and p.
For a full list of CSS Selectors, see the external site:
The Browser Extension does not yet support CSS selectors and therefore does not take any user-defined CSS selectors into consideration when highlighting matches.
For more information, see the User Guide chapters:
For more information about the topics covered in this chapter, see the User Guide articles:
See Acquia Optimize for Developers for documentation and advanced help files including SDK information for developers.
If this content did not answer your questions, try searching or contacting our support team for further assistance.
Mon Oct 28 2024 18:46:42 GMT+0000 (Coordinated Universal Time)