Programmatically create new projects and share them with users
Last updated: 1st August, 2018
This support doc covers how to add multiple projects in GoSquared programmatically with the GoSquared API. This doc is for anyone that wants to integrate hundreds of sites at once or offer GoSquared Analytics to their customers.
With the GoSquared API you can programmatically create new projects and share them with new users.
For example, if you want to integrate GoSquared with your website building platform, you can use the GoSquared Account API to create tracking codes for each site on your platform. With this integration, every time a new user creates a new site on your platform, you can create a new project in GoSquared, generate a tracking code and invite that user to the project. You can also use this integration to embed a GoSquared dashboard for the site in your own admin portal or area.
This functionality can be extremely powerful and is available to all GoSquared customers at no extra cost. Customers use this feature to integrate thousands of sites at a time.
Note: this guide is intended for developers.
Creating a new project/site with the API
The first step is to create a new project and the docs can be found here: gosquared.com/developer/api/account/v1/sites/post/
Please note, this is a POST
method.
Note on time zones
When posting to the API endpoint the new project's default time zone will be set to GMT (UTC).
If you know the time zones of your users you can set the time zone by appending &timezone=TIMEZONE
to the API call.
For example:
https://api.gosquared.com/account/v1/sites?api_key=YOURAPIKEY&name=Simon's%20site&url=http%3A%2F%2Fsimontabor.com&timezone=Australia/Sydney
A list of time zones can be found here.
Sharing the data with your users
Create a shared account
Once you have created a project, you can use the sharedUsers
function to add that user to the project so they can access their own analytics. To understand how shared users work in GoSquared, see our doc here.
Create a new shared user under your GoSquared account and share the site with them. Shared users can access all the features of GoSquared, including email reports. You can add multiple users to the same site or share multiple sites with one user.
The sharedUsers
function allows you to add and remove shared users with the API.
Docs: sharedUsers documentation
Embed the GoSquared Dashboard
Show the GoSquared dashboard in your own user admin area. The embed works as an iframe and it will allow you to give your users a fully functional analytics dashboard with minimal work on your end.
Docs: Embedding GoSquared Dashboard
Use the API to power custom visualisations
Use the GoSquared Now and Trends API to build your own custom visualisations. This option offers the most flexibility and will allow you to supplement GoSquared analytics data with additional data that you might have.
Docs: API Reference
Further Help
All API and Tracker documentation can be found at our developer documentation. If you need further assistance please don't hesitate to contact our support team and we'll walk you through the process.