TryNow JavaScript SDK
TryNow
The public TryNow interface. Accessible via window.trynow.
Kind: global class
- TryNow
- instance
- .config
- .config
- .cartId
- .cartId
- .headless
- .initialized
- .getConfig() ⇒
TryNowInitConfig - .reset()
- .getMyshopifyDomain() ⇒
string - .getVersion() ⇒
string - .getTrialPeriodDays() ⇒
Promise.<number> - .getSellingPlanId() ⇒
Promise.<string> - .hasPassedTryLink() ⇒
Promise.<boolean> - .addToCartClicked() ⇒
Promise.<void> - .getShopperId() ⇒
Promise.<string> - .addShopperIdToCart() ⇒
Promise.<void> - .blockFacebookReferredTraffic() ⇒
Promise.<boolean>
- static
- instance
tryNow.config
Gets the current configuration of the TryNow SDK.
Kind: instance property of TryNow\
tryNow.config
Sets the configuration of the TryNow SDK
Kind: instance property of TryNow\
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 TryNow\
tryNow.cartId
Gets the cart ID currently in use by the TryNow SDK.
Kind: instance property of TryNow\
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 TryNow\
tryNow.initialized
Whether the TryNow SDK has been initialized with a myshopifyDomain.
Kind: instance property of TryNow\
tryNow.getConfig() ⇒ TryNowInitConfig
TryNowInitConfigGets the current configuration of the TryNow SDK.
Kind: instance method of TryNow
Returns: TryNowInitConfig - config\
tryNow.reset()
Clears and reloads product page data.
Kind: instance method of TryNow\
tryNow.getMyshopifyDomain() ⇒ string
stringGets the myshopify domain of the store.
Kind: instance method of TryNow
Returns: string - domain\
tryNow.getVersion() ⇒ string
stringGets the SDK version. Tries to find from app embed settings, otherwise uses the version set in the config.
Kind: instance method of TryNow
Returns: string - version\
tryNow.getTrialPeriodDays() ⇒ Promise.<number>
Promise.<number>Gets the number of trial period days.
Kind: instance method of TryNow
Returns: Promise.<number> - days\
tryNow.getSellingPlanId() ⇒ Promise.<string>
Promise.<string>Gets the selling plan ID number as a string.
Kind: instance method of TryNow
Returns: Promise.<string> - selling plan ID\
tryNow.hasPassedTryLink() ⇒ Promise.<boolean>
Promise.<boolean>Checks if the user has passed through a TryLink gate.
Kind: instance method of TryNow
Returns: Promise.<boolean> - boolean indicating if a TryLink has been passed\
tryNow.addToCartClicked() ⇒ Promise.<void>
Promise.<void>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 TryNow\
tryNow.getShopperId() ⇒ Promise.<string>
Promise.<string>Gets a unique identifier for the shopper from the server.
Kind: instance method of TryNow
Returns: Promise.<string> - Unique shopper ID\
tryNow.addShopperIdToCart() ⇒ Promise.<void>
Promise.<void>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 TryNow\
tryNow.blockFacebookReferredTraffic() ⇒ Promise.<boolean>
Promise.<boolean>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 TryNow
Returns: Promise.<boolean> - True if Facebook traffic should be blocked\
TryNow.getInstance()
Gets the singleton instance of TryNow
Kind: static method of TryNow\
TryNow.updateConfig()
Updates config and returns the singleton instance
Kind: static method of TryNow