# Selectors

Selectors are predefined values meant for downloading data from the HTML tree, which is later used for automation scenario.

Every selector has its properties:&#x20;

* name&#x20;
* selector path or JavaScript variable&#x20;
* value type&#x20;
* reduction method

A selector can be also described with label-ascribing characteristics. It means that it can append a value to a given subscriber without using scenario automation. It’s a very handy solution that saves time and shortens scenario preparation.

In the above case, in accordance with the [Labels](/subscribers/labels.md) description, a **key**, **TTL**, and ascribing method are defined.

{% hint style="info" %}
Labels created by selectors update segments.
{% endhint %}

Selectors that you will use are:

* id
* class
* DOM tree

To define a selector, go to the Selectors tab.

For each selector, you have to define:

* description - Give a name to the selector. It is visible only to you, in the application panel and in the Condition field of the automation scenario.
* path to the element - Paste the exact path to the element on the page that you want to monitor.
* action - Use this to determine the task of the selector.

<figure><img src="/files/2V0Sfh9a3lDLwLLmgBR3" alt=""><figcaption></figcaption></figure>

There are 9 actions to choose from:

* Get text from element - This action allows you to collect the name of a given element on the page, which can then be used as a so-called variable when creating the notification. The names will be placed in a separate column in the subscribers' tab

Example: #article\_title

* Get the number from the item - This allows you to collect numerical information, like how many products a given subscriber has in a cart, or what the final value of an order is. This selector can be used, for example, in an abandoned cart scenario.

Example: .simpleCart\_total

* Check if the item has been clicked - You can collect the information if the recipient clicked on the element designated by you on the page, like CTA buttons.

Example: #add\_comment

* Get the number of clicks from a given element - The action allows to collect the number of clicks, eg in the add comment button. Thanks to this, we know how often the subscriber shares his opinion on our website

Example: .submit-buy

* Add a tag based on the content of the item - Thanks to this action, you can collect information about, for example, the categories visited on the page in the form of a tag. They allow for the creation of more personalized messages. Within this action, we can put so-called label tags, so that the collected tags will be grouped according to your design.

Example: .category\_list h1

* Get the value from the input - Using this action, you can download the content entered by the recipient to input fields. For example, if your site has a product search engine, we are able to check exactly what phrases visitors have entered.

Example: #city

* Download a variable from the browser window - Using this action, we can send the stored data to your application in Google Tag Manager using Data Layer.
* Add a tag based on a variable from the window object - With data collected on Data Layer in Google Tag Manager, you can assign tags to your recipients.
* Non-standard - This action allows you to use recipient information that is stored in class attributes or identifiers. For example, using this action, you can collect the last visited link by a subscriber.

Example:

* link \[rel = 'canonical'] with the "href" attribute
* link\[rel='alternate']\[hreflang='pl'] with the "href" attribute
* meta\[property='og:url'] with the "content" attribute


---

# 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.pushpushgo.company/automation/selectors.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.
