# Finding Out a Button's CSS Selector

## Why define goals using the selector? <a href="#block-10764b9f845a4990b67f53ba7ec53208" id="block-10764b9f845a4990b67f53ba7ec53208"></a>

Although defining goals using the button text is much easier, sometimes it is not feasible.

1. If there isn't a text on the element you want to define as a goal
2. If the same text is used by multiple different elements on the same page and you only want to select one.

In other cases, we advise non-technical users to define their goals using text.

## How to get the CSS selector of a button <a href="#block-4deb64e8fb3749afb7000d473eee9c86" id="block-4deb64e8fb3749afb7000d473eee9c86"></a>

1. Hover the cursor over the button you want to define as a goal and right-click the mouse to select **Inspect**
2. ![image](https://images.spr.so/cdn-cgi/imagedelivery/j42No7y-dcokJuNgXeA0ig/1eea72a4-4873-49b8-b564-58a45d79c227/Screen_Shot_2021-11-12_at_16.18.58/w=1080,quality=90,fit=scale-down)
3. Right-click on the highlighted code. Select **Copy** > **Copy selector**
4. ![image](https://images.spr.so/cdn-cgi/imagedelivery/j42No7y-dcokJuNgXeA0ig/9f3815c0-91c2-4a46-b01f-2001f09a6ffa/Screen_Shot_2021-11-12_at_16.19.25/w=1080,quality=90,fit=scale-down)
5. Paste it into the 'Click with Selector' input in the Goals tab of your dashboard
6. ![image](https://images.spr.so/cdn-cgi/imagedelivery/j42No7y-dcokJuNgXeA0ig/b4e6ff61-c275-4bb3-9f27-bc67cd2a5069/Screen_Shot_2021-11-12_at_16.20.22/w=1920,quality=90,fit=scale-down)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hockeystack.com/marketing-intelligence/goals/finding-out-a-buttons-css-selector.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
