Sklik API Connector for Google Apps Script

This connector allows you to access data in Sklik Accounts through Sklik API.

The connector can be used as an Google Apps Script library. You can include the library to apps script project using the Resources > Manage Libraries in menu. Project ID of the library is: MNjmH8c2kpahN3cCWuwFO-edGiZ7KcTVk

For more information about managing libraries, see Google's Managing libraries guide.

Quick Start

  1. Include the library in the project.

    Add it in the Resources > Manage Libraries, using the project ID MNjmH8c2kpahN3cCWuwFO-edGiZ7KcTVk. After adding the library, select the latest version. Keep the default library identifier: SklikAPI.

  2. Set user credentials for authenticating to the API.

    Create the following properties in File > Project Properties > User Properties:

    • sklik_user: Your Sklik username.
    • sklik_pass: Your Sklik password. Unfortunately, you have to specify your password in plain text, so be careful!
  3. Create the instance.

    Before making API calls, you have to create an instance of the Connector. After creating the instance, you have to login to API. This can be done using the following code:

     var sklik = SklikAPI.Connect();
  4. Make some calls and automate your workflow!

    Use the instance you created in the previous step (the sklik variable) to make API calls. The calls are structured in the same way as described in the API. For instance, if you want to call the campaigns.list operation, use the following code:

     var campaignList = sklik.Campaigns.list();

    Return values are objects constructed directly from the API response. Therefore, they have the same structure as described in the Sklik API documentation.

  5. Log-out.

    When your script finishes, it should log-out from the API. This will invalidate session tokens. Use the following code:



Google Apps Script has really slow traversing through XML tree. Sklik API uses XML-RPC protocol which, as the name suggests, uses XML to represnet requests and responses. This performance impact can be seen even when retrieveing relatively small subsets of data, for example: size of 50 keyword suggestions with statistics is approximately 130Kb. The response takes 30+ seconds to parse.

To improve the processing speed, we have created an proxy script which enables Google Apps Scripts to send and retrieve data in JSON. Use of the proxy can be enabled using the following code:

sklik.setSklik2JsonUrl("<proxy url>");

Where <proxy url> is the URL of the script. The script can be obtained from Jan Smitka ( and requires PHP 5.3+ with XMLRPC extension. The script can be deployed even on shared hosting server like WEDOS. HTTPS deployment is strongly recommended.

Security Considerations

Please take the following facts into consideration when working with the connector:

  1. Sklik API requires you to log-in using your username and password. Both must be accessible for the script and stored on Google servers.

    Storing the password in User Properties is a little bit safer than specifying them directly in the code, but they can still be easily retrieved when the project is opened from your computer.

    We suggest to create another account with very strong password and minimum required privileges: read-only access to certain accounts only.

  2. All API calls, including their contents, are logged on Google servers. These logs therefore contains your username/password and session ID.

    Your password should be changed regulary and your script should log-out from the Sklik API when it finishes. This reduces possibility of compromising your account.

All described facts are given by limitations of the Google Scripts API or Sklik API.