Getting Started
The Grow JavaScript SDK provides programmatic access to Grow services. This section features information on how developers can use the SDK with their Grow-enabled sites.
Before You Begin
- Sign up for a Grow publisher account.
- (Optional) Set up a development site for coding.
- Install the Grow script and ensure it is operational. See the Grow Help Center for specific instructions on script installation.
Note
If you configure a development site, make sure you have it configured properly and with enough content for Grow to work. For more information, see Troubleshooting.Installation
The Grow JavaScript SDK is automatically installed as part of the core Grow scripts. No further installation is necessary.
Using the SDK
To make calls to the Grow SDK, wrap your methods in a window.growMe(() ⇒ {})
function.
Important
All Grow SDK methods must start withwindow.growMe
in order to work.
For example, in the following code a growBookmarked
variable is created to hold the status of the current page. The .getIsBookmarked()
method then returns a boolean value that indicates whether the current user has bookmarked the page in Grow.
The .on()
method then listens for a Grow event that fires off when the user adds or removes a bookmark via Grow. The variable is then updated to the appropriate value.
let growBookmarked = null;
window.growMe(() => {
growBookmarked = window.growMe.getIsBookmarked();
window.growMe.on("isBookmarkedChanged", (params) => {
growBookmarked = params.isBookmarked;
});
});
What’s Next
- View the Methods section for a listing of all available Grow methods.
- See HTML Classes and IDs if you’re interested in creating your own HTML elements that trigger Grow widget functions.