> For the complete documentation index, see [llms.txt](https://docs.abtasty.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.abtasty.com/client-side/custom-widgets/widgets-getting-started/custom-widgets-helpers.md).

# Custom Widgets: Helpers

## Introduction

Each script throughout the platform has access to a handful of functions : Account Javascript, targeting code, campaign Javascript, custom script, …

To call them, you need to use the variable `HELPERS` within the code editor.

Each custom script throughout the platform is stored within an anonymous function which holds an instance of this `HELPERS`, so each `HELPERS` is independent and is relative to your current script location.

## Helpers

### ABTastyCookie

Call: `new HELPERS.ABTastyCookie();`

Returns an object containing all the information about AB Tasty cookies in a more human readable way.

<figure><img src="https://lh7-qw.googleusercontent.com/slidesz/AGV_vUeg2tFFgEkGiksvHCJMSnyjiRK6EBoipM6ZAGWgi-_NKOactxGDsLYYa1lrQ8B0A_gJBx_9HitsrOhRUmgkb4srZbwgkq7d9ItUYvVzaKmfh0LMkwy_gFrCV8XTjxMSM9bsTzEneGN0FnZojav3cv-e25ogJBQ=s2048?key=p-ptFKk9TiVs1ERb2_eiYA" alt=""><figcaption></figcaption></figure>

### ABTastyLocalStorage

{% hint style="warning" %}
Not usable at the moment
{% endhint %}

### ABTastySessionCookie

Details about the AB Tasty session cookie.

Already contained within `ABTastyCookie`.

### campaign

Contains data relative to the campaign from which the `HELPERS` was called.

Usage of alreadySeenOneTest: `HELPERS.campaign.alreadySeenOneTest(new HELPERS.ABTastyCookie())();`

{% hint style="info" %}
forceUntracking and stopTargetingPerf are not usable.
{% endhint %}

### campaignId

Contains the campaign id from which the `HELPERS` was called.

### doWhen

Takes two mandatory arguments.

First one is a function that must return a boolean value.

Second argument is callback function that will be called once the first argument returns true.

First argument is called each 100ms, second argument is executed only once.

### getGeoloc

Gives the information about your current geolocation. Data is fetched from the session storage `ABTastyGeoloc` entry.

### getParsedUserAgent

Gives the information about your current user agent. Data is fetched from the session storage `ABTastyUA` entry.

### jsCookie

Embedded package:

Documentation available here: <https://github.com/js-cookie/js-cookie>

### variationId

Contains the variation id from which the `HELPERS` was called.\\


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.abtasty.com/client-side/custom-widgets/widgets-getting-started/custom-widgets-helpers.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
