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: In Event API Keys table on Administration > API Credentials > Event API tab,

    • Check if the Status column has changed to green. This means that Zengain has received the first event.

    • Click the expand icon to view up to 100 of the most recent tracked events. Learn more

Go to the home page and confirm that the step for the Zengain Onboarding panel has changed to green. This indicates that Zengain has received the first event (first-time setup).


Viewing the Incoming Events Log

After completing the setup and verification, you can monitor incoming events for your API keys directly from the Event API Keys dashboard. This event log provides administrators with immediate visibility into event tracking activity, making verifying integration and troubleshooting issues easier.

An events log feature lets you view the last 100 events received by each API key.

Adblockers and browsers are making it harder and harder to track users on the client-side. Front-end event tracking could be missing between 15% and 30% of blocked events that never reached Zengain.

How to use the Events Log:

  1. Navigate to the API Credentials page in the Administration section

  2. Locate your API key in the Event API Keys table

  3. Use the checkbox in the leftmost column to show or hide the events log

Events Log Information:

When enabled, the events log displays a table with the following information for the last 100 events:

  • Event Name: The name of the tracked event

  • Event Type: The type/category of the event

  • Event Timestamp: When the event was received by our system (with date and time)

  • Payload: The data payload sent with the event

  • User Email: Email address associated with the event (if available)

  • IP Address: The IP address from which the event was sent

When to use this feature:

  • Debug event tracking by verifying that events are being received correctly

  • Monitor real-time activity to see recent user interactions

  • Troubleshoot payload issues by examining the data being sent

  • Verify user identification by checking email and IP information

  • Audit event flow during the development and testing phases

Last updated

Was this helpful?