Methods
enableDebug
Enables debug mode, which will output console logs to help verify changes made.
RebuyExperiments.enableDebug()
disableDebug
Disables debug mode, which will silence console logs.
RebuyExperiments.disableDebug()
run
Runs an experiment and applies the provided changes immediately. This method accepts two arguments experiment and useCookie.
RebuyExperiments.run(experiment, useCookie)
|
Argument
|
Description
|
|
experiment
|
Required. This can be a string identifying an object to enable such as 'smart cart' or '12345'. Alternatively, this can be an object with two mandatory properties (`key` and `settings`), where `key` is a string identifying the object to target such as 'smart cart' or '12345', and `settings` is an object containing the modifications you would like applied.
|
|
useCookie
|
Optional. Boolean flag to use a session based cookie to automatically apply the experiment on subsequent page loads. This defaults to `false`, however passing in `true` will automatically run the experiment for the duration of the session. This is useful when keying off ephemeral states, such as utm_campaign URL arguments that are only present upon session start.
|
---
title: Methods
excerpt: ''
deprecated: false
hidden: false
metadata:
title: ''
description: ''
robots: index
next:
description: ''
---
## enableDebug
Enables debug mode, which will output console logs to help verify changes made.
```javascript title="RebuyExperiments.enableDebug()"
```
## disableDebug
Disables debug mode, which will silence console logs.
```javascript title="RebuyExperiments.disableDebug()"
```
## run
Runs an experiment and applies the provided changes immediately. This method accepts two arguments `experiment` and `useCookie`.
```text title="RebuyExperiments.run(experiment, useCookie)"
```
<Table align={["left","left"]}>
<thead>
<tr>
<th>
Argument
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
experiment
</td>
<td>
Required. This can be a string identifying an object to enable such as 'smart cart' or '12345'. Alternatively, this can be an object with two mandatory properties (`key` and `settings`), where `key` is a string identifying the object to target such as 'smart cart' or '12345', and `settings` is an object containing the modifications you would like applied.
</td>
</tr>
<tr>
<td>
useCookie
</td>
<td>
Optional. Boolean flag to use a session based cookie to automatically apply the experiment on subsequent page loads. This defaults to `false`, however passing in `true` will automatically run the experiment for the duration of the session. This is useful when keying off ephemeral states, such as utm_campaign URL arguments that are only present upon session start.
</td>
</tr>
</tbody>
</Table>