Skip to content

Commit d516f59

Browse files
committed
Adjust getUrlParams documentation slightly.
1 parent 711d60c commit d516f59

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

source/includes/_utilities.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,30 +108,31 @@ This fetches the <a href="#page-event">Page Event object</a> for the current web
108108

109109
## API.utils.getUrlParams()
110110

111-
NOTE: This method returns immediately, not as a Promise, because the URL Params are already available and do not require asynchronous behavior.
111+
> Usage:
112+
113+
```javascript
114+
(function(WIAPI) {
115+
var API = new WIAPI('test-integration'); // Note: Replace 'test-integration' with your actual integration identifier.
116+
var urlParams = API.utils.getUrlParams(); // Returns the current URL parameters as object attributes, so you can easily access the values.
117+
API.log(urlParams); // Log the entire object.
118+
API.log(urlParams.query); // Access just the `query` parameter, for example.
119+
})(window.DDC.API);
120+
```
121+
122+
NOTE: This method returns synchronously, not as a Promise, because the URL Params are already available and do not require asynchronous behavior for performance.
112123

113124
Running this function at a URL such as this:
114125

115126
[https://www.roimotors.com/?query=This%20is%20the%20query&hello=world&foo=bar](https://www.roimotors.com/?query=This%20is%20the%20query&hello=world&foo=bar)
116127

117128
Will return the following object:
118129

119-
```{
130+
```javascript
131+
{
120132
query: "This is the query",
121133
hello: "world",
122134
foo: "bar"
123-
}```
124-
125-
126-
> Usage:
127-
128-
```javascript
129-
(function(WIAPI) {
130-
var API = new WIAPI('test-integration'); // Note: Replace 'test-integration' with your actual integration identifier.
131-
var urlParams = API.utils.getUrlParams(); // Returns the current URL parameters as object attributes, so you can easily access the values.
132-
API.log(urlParams); // Log the entire object.
133-
API.log(urlParams.query); // Access just the `query` parameter, for example.
134-
})(window.DDC.API);
135+
}
135136
```
136137

137138
## API.utils.getVehicleData()

0 commit comments

Comments
 (0)