API Credentials

To set up your API, you must navigate to the "admin" section of the platform.

  • Click the menu icon, then select "administration."

  • Once there, select "API Credentials".

The admin page for event API setup has a six-step process to set up your API and also allows you to add a new product if one doesn't yet exist on the platform.

Step 1: Create Your API Key (and Product)

  • Once on this page, click the "add API key" button.

  • This will show a dropdown list, if you have existing products in Zentitle2 or Zengain they will show here. There are no existing products in this case, so we need to add one using the "add product" button found when clicking the arrow in the dropdown box.

  • Enter a unique name and click save

  • Add a short but unique "key name" to reference this API later.

  • Click "create".

  • Now we have the API key ready to copy using the copy button on the right of the box.

  • Click close to return to the API page.


Step 2: Copy Your Snippet

  • Next, click the copy snippet button to see the script to attach to your application

  • Copy the JS Snippet using the copy button on the right of the box.

  • Click "next".


Step 3: Add the Snippet to Your Site

  • Open your application in your editor.

Add the snippet directly before the closing tag in your HTML template. This ensures it loads early and runs as soon as possible. Make sure not to alter any part of the code unless specified.

  • Paste the snippet you copied into this location.

  • Click Next in the Zengain setup page.


Step 4: Configure the Initialization Parameters

  • Next, copy and then edit the config. script.

The API key is set product-by-product, so ensure you pick the correct product when coding.

  • Replace 'YOUR_API_KEY' in the snippet 'initialize' method with the API key you created in the previous step, and configure additional parameters in the initialization call to set up essential tracking data.

  • Click Next in the Zengain setup page.


Step 5: Track Your Custom Events

You can track custom events in the app using the track method, allowing you to monitor specific user actions like button clicks or form submissions. Standard events pageView are tracked automatically, and tracking provides flexibility for capturing key interactions.

  • Add custom event tracking to your app. If you are using it (recommended).

  • Click Next in the Zengain setup page.


Step 6: Verify

  • After adding and configuring the snippet, verify that it's correctly installed.

  • Click End in the Zengain setup page.

Testing steps:

  • Step 1: Open your site in a browser.

  • Step 2: Open the browser's Developer Tools (F12 on Windows, Cmd+Opt+| on Mac).

  • Step 3: Check the Console tab for any errors related to the Zengain JS Snippet.

  • Step 4: Go to the home page to check if the Status has changed to green, which means that Zengain has received the first event.

Last updated

Was this helpful?