---
updatedAt: 2025-11-13T23:50:52.000Z
agentTools:
  projectIndex: https://how.trynow.works/llms.txt
---

# TryNow

TryNow JavaScript SDK

<a name="TryNow"></a>

## TryNow

The public TryNow interface. Accessible via `window.trynow`.

**Kind**: global class

* [TryNow](#TryNow)
  * *instance*
    * [.config](#TryNow+config)
    * [.config](#TryNow+config)
    * [.cartId](#TryNow+cartId)
    * [.cartId](#TryNow+cartId)
    * [.headless](#TryNow+headless)
    * [.initialized](#TryNow+initialized)
    * [.getConfig()](#TryNow+getConfig) ⇒ <code>TryNowInitConfig</code>
    * [.reset()](#TryNow+reset)
    * [.getMyshopifyDomain()](#TryNow+getMyshopifyDomain) ⇒ <code>string</code>
    * [.getVersion()](#TryNow+getVersion) ⇒ <code>string</code>
    * [.getTrialPeriodDays()](#TryNow+getTrialPeriodDays) ⇒ <code>Promise.\<number></code>
    * [.getSellingPlanId()](#TryNow+getSellingPlanId) ⇒ <code>Promise.\<string></code>
    * [.hasPassedTryLink()](#TryNow+hasPassedTryLink) ⇒ <code>Promise.\<boolean></code>
    * [.addToCartClicked()](#TryNow+addToCartClicked) ⇒ <code>Promise.\<void></code>
    * [.getShopperId()](#TryNow+getShopperId) ⇒ <code>Promise.\<string></code>
    * [.addShopperIdToCart()](#TryNow+addShopperIdToCart) ⇒ <code>Promise.\<void></code>
    * [.blockFacebookReferredTraffic()](#TryNow+blockFacebookReferredTraffic) ⇒ <code>Promise.\<boolean></code>
  * *static*
    * [.getInstance()](#TryNow.getInstance)
    * [.updateConfig()](#TryNow.updateConfig)

<a name="TryNow+config"></a>

### tryNow\.config

Gets the current configuration of the TryNow SDK.

**Kind**: instance property of [<code>TryNow</code>](#TryNow)\ <a name="TryNow+config"></a>

### tryNow\.config

Sets the configuration of the TryNow SDK

**Kind**: instance property of [<code>TryNow</code>](#TryNow)\ <a name="TryNow+cartId"></a>

### tryNow\.cartId

Sets the cart ID to be used by the TryNow SDK in headless mode. If in headless mode and no cart ID is provided, a new cart will be created.

**Kind**: instance property of [<code>TryNow</code>](#TryNow)\ <a name="TryNow+cartId"></a>

### tryNow\.cartId

Gets the cart ID currently in use by the TryNow SDK.

**Kind**: instance property of [<code>TryNow</code>](#TryNow)\ <a name="TryNow+headless"></a>

### tryNow\.headless

Whether the TryNow SDK is running in headless mode. This is determined by the presence of a Storefront API access token.\
Some features may be disabled in headless mode.

**Kind**: instance property of [<code>TryNow</code>](#TryNow)\ <a name="TryNow+initialized"></a>

### tryNow\.initialized

Whether the TryNow SDK has been initialized with a myshopifyDomain.

**Kind**: instance property of [<code>TryNow</code>](#TryNow)\ <a name="TryNow+getConfig"></a>

### tryNow\.getConfig() ⇒ <code>TryNowInitConfig</code>

Gets the current configuration of the TryNow SDK.

**Kind**: instance method of [<code>TryNow</code>](#TryNow)\
**Returns**: <code>TryNowInitConfig</code> - config\ <a name="TryNow+reset"></a>

### tryNow\.reset()

Clears and reloads product page data.

**Kind**: instance method of [<code>TryNow</code>](#TryNow)\ <a name="TryNow+getMyshopifyDomain"></a>

### tryNow\.getMyshopifyDomain() ⇒ <code>string</code>

Gets the myshopify domain of the store.

**Kind**: instance method of [<code>TryNow</code>](#TryNow)\
**Returns**: <code>string</code> - domain\ <a name="TryNow+getVersion"></a>

### tryNow\.getVersion() ⇒ <code>string</code>

Gets the SDK version. Tries to find from app embed settings, otherwise uses the version set in the config.

**Kind**: instance method of [<code>TryNow</code>](#TryNow)\
**Returns**: <code>string</code> - version\ <a name="TryNow+getTrialPeriodDays"></a>

### tryNow\.getTrialPeriodDays() ⇒ <code>Promise.\<number></code>

Gets the number of trial period days.

**Kind**: instance method of [<code>TryNow</code>](#TryNow)\
**Returns**: <code>Promise.\<number></code> - days\ <a name="TryNow+getSellingPlanId"></a>

### tryNow\.getSellingPlanId() ⇒ <code>Promise.\<string></code>

Gets the selling plan ID number as a string.

**Kind**: instance method of [<code>TryNow</code>](#TryNow)\
**Returns**: <code>Promise.\<string></code> - selling plan ID\ <a name="TryNow+hasPassedTryLink"></a>

### tryNow\.hasPassedTryLink() ⇒ <code>Promise.\<boolean></code>

Checks if the user has passed through a TryLink gate.

**Kind**: instance method of [<code>TryNow</code>](#TryNow)\
**Returns**: <code>Promise.\<boolean></code> - boolean indicating if a TryLink has been passed\ <a name="TryNow+addToCartClicked"></a>

### tryNow\.addToCartClicked() ⇒ <code>Promise.\<void></code>

Utility method to log TryNow CTA click analytics event.\
This method is called automatically by the TryNow CTA button component, and should only be used\
if you are manually creating a CTA button.

**Kind**: instance method of [<code>TryNow</code>](#TryNow)\ <a name="TryNow+getShopperId"></a>

### tryNow\.getShopperId() ⇒ <code>Promise.\<string></code>

Gets a unique identifier for the shopper from the server.

**Kind**: instance method of [<code>TryNow</code>](#TryNow)\
**Returns**: <code>Promise.\<string></code> - Unique shopper ID\ <a name="TryNow+addShopperIdToCart"></a>

### tryNow\.addShopperIdToCart() ⇒ <code>Promise.\<void></code>

Adds the shopper ID to the cart attributes.\
This ensures that orders created from this cart will include the shopper ID.

**Kind**: instance method of [<code>TryNow</code>](#TryNow)\ <a name="TryNow+blockFacebookReferredTraffic"></a>

### tryNow\.blockFacebookReferredTraffic() ⇒ <code>Promise.\<boolean></code>

Checks if Facebook referred traffic should be blocked for this user.\
Returns true if the platform data indicates Facebook blocking is enabled\
and the current shopper came from Facebook.

**Kind**: instance method of [<code>TryNow</code>](#TryNow)\
**Returns**: <code>Promise.\<boolean></code> - True if Facebook traffic should be blocked\ <a name="TryNow.getInstance"></a>

### TryNow\.getInstance()

Gets the singleton instance of TryNow

**Kind**: static method of [<code>TryNow</code>](#TryNow)\ <a name="TryNow.updateConfig"></a>

### TryNow\.updateConfig()

Updates config and returns the singleton instance

**Kind**: static method of [<code>TryNow</code>](#TryNow)