> For the complete documentation index, see [llms.txt](https://attr.sygnal.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://attr.sygnal.com/sa5-data/data-sources/url-data-source.md).

# URL Part Data Source

## Use Cases

* Grab the current path of the page, and push it into a hidden field in your contact form so that you can track which page ( or collection page ) the form was submitted from.&#x20;

## Usage Notes

* Use with the `wfu-bind`  attribute to inject the URL part into;
  * Any text element as the content&#x20;
  * Any input element as the value&#x20;
    * Use `<input type=hidden>` to capture URL parts in form submission data&#x20;

## Options & Examples

{% hint style="info" %}
Examples here use the following URL for reference;\
`https://example.com:8080/path/to/resource?query=value#section2`
{% endhint %}

<table><thead><tr><th width="192.33333333333331">Data Path</th><th width="310">Description</th><th>Example</th></tr></thead><tbody><tr><td><code>$url.href</code></td><td>The entire URL</td><td><code>https://example.com:8080/path/to/resource?query=value#section2</code></td></tr><tr><td><code>$url.origin</code></td><td>The origin of the URL, combining the protocol, domain, and port</td><td><code>https://example.com:8080</code></td></tr><tr><td><code>$url.pathname</code></td><td>The path section of the URL, which comes after the domain and before the query string</td><td><code>/path/to/resource</code></td></tr><tr><td><code>$url.search</code></td><td><p>The entire query portion of the URL, including the leading question mark.</p><p><em>See</em> <a href="/pages/Lln9zwwypqEe1OH8ZH5b"><em>Query Params</em></a> <em>to get individual params.</em></p></td><td><code>?query=value</code></td></tr><tr><td><code>$url.protocol</code></td><td>The protocol of the URL</td><td><code>https:</code></td></tr><tr><td><code>$url.host</code></td><td>Combines the hostname and the port ( if a port is specified )</td><td><code>example.com:8080</code></td></tr><tr><td><code>$url.hostname</code></td><td>The domain name or IP address part of the URL</td><td><code>example.com</code></td></tr><tr><td><code>$url.port</code></td><td>The port number of the URL, if specified</td><td><code>8080</code></td></tr></tbody></table>

## Technical Notes

{% embed url="<https://developer.mozilla.org/en-US/docs/Web/API/URL>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://attr.sygnal.com/sa5-data/data-sources/url-data-source.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
