Singular Web SDK (Google Tag Manager integration)

Use the Singular Web SDK to have Singular track and analyze conversions, transactions, and other user actions and events in your website.

For your convenience, the Singular Web SDK is integrated with Google Tag Manager.

Follow the steps below to implement the Singular Web SDK in your site.

Prerequisites

  • Have Google Tag Manager configured on your site.
  • Set up Google Tag Manager triggers as needed for the events that you want to send to Singular (your conversion event and any custom events). See About Triggers in the Google documentation.
  • Set up Google Tag Manager variables as needed for the events that you want to send to Singular. For example, if you want to send transaction events and include the transaction revenue, you need to set up variables for the transaction sum and currency. See About Variables in the Google documentation.

Step 1: Add a Singular Initialization Tag

To use the Singular Web SDK in your website, you must add the Singular initialization tag. We recommend setting this event to be triggered as soon as your website loads (e.g., on window load).

To add a Singular initialization tag:

  1. In your Google Tag Manager account, click Tags > New.
  2. In the Tag Configuration window, click Tag Configuration, and in the Tag Type menu, select “Singular Web Tracking”.
  3. Under Track Type, select “Initialization”.
  4. Fill in the other required parameters:
    • API Key: Your Singular SDK API key, e.g. “example_api_key1”.
    • Secret: Your Singular SDK secret, e.g. “ff3bfbce70b42a70fe920f42737d2123”.
    • Package Name: A name for your website or application. We recommend using reverse DNS notation, e.g. “com.example.site”.
  5. Click Triggering and add the trigger “Window Loaded”.
  6. Click Save.

Step 2: Set Up Event Tracking

Conversion Event

The definition of “conversion” varies from website to website: a conversion can mean the user buys a product, registers as a member, downloads your app, etc. Choose the event that represents a conversion for you and have Google Tag Manager send it to Singular by following the steps below.

Once you’ve set up conversion tracking, you will be able to track and analyze your conversions using Singular’s reports. Singular will also use the date of the conversion event as the basis for cohort analysis (see What are cohort metrics?).

To track conversion events:

  1. In your Google Tag Manager account, click Tags > New.
  2. In the Tag Configuration window, click Tag Configuration, and in the Tag Type menu, select “Singular Web Tracking”.
  3. Under Track Type, select “Conversion Event”.
  4. Under Event Name, enter a name for the event or enter a Google Tag Manager variable that you have defined previously.
  5. Click Triggering and add the triggering event.
  6. Click Save.

Custom Events (Optional)

The Singular Web SDK lets you track any user event you want. The events will be counted and displayed in your Singular reports.

To track a custom event:

  1. In your Google Tag Manager account, click Tags > New.
  2. In the Tag Configuration window, click Tag Configuration, and in the Tag Type menu, select “Singular Web Tracking”.
  3. Under Track Type, select “Custom Event”.
  4. Under Event Name, enter a name for the event or enter a Google Tag Manager variable that you have defined previously.
  5. Click Triggering and add the triggering event.
  6. Click Save.

Revenue Events (Optional)

The Singular Web SDK lets you track the revenue gained on your site. The revenue is aggregated and displayed in your Singular reports.

To track revenue events:

  1. In your Google Tag Manager account, click Tags > New.
  2. In the Tag Configuration window, click Tag Configuration, and in the Tag Type menu, select “Singular Web Tracking”.
  3. Under Track Type, select “Revenue Event”.
  4. Under Event Name, enter a name for the event or enter a Google Tag Manager variable that you have defined previously.
  5. Under Currency, enter a variable that contains the currency of the transaction.
  6. Under Revenue, enter a variable that contains the transaction amount.
  7. Click Triggering and add the triggering event.
  8. Click Save.

3. Set Up User Identity

As long as the user performs actions in your website without being logged in, events are sent to Singular with a Singular-generated user ID. But after the user registers or logs in, you can have events sent to Singular along with the user ID that is used in your website, e.g. an email address.

To share the user ID with Singular, add a Singular tag with the “Login” track type:

  1. In your Google Tag Manager account, click Tags > New.
  2. In the Tag Configuration window, click Tag Configuration, and in the Tag Type menu, select “Singular Web Tracking”.
  3. Under Track Type, select “Login”.
  4. Under Custom User Id, enter the Google Tag Manager variable that contains the user ID.
  5. Click Triggering and add the triggering event: user login or registration.
  6. Click Save.

Then add a tag with the “Logout” track type:

  1. In your Google Tag Manager account, click Tags > New.
  2. In the Tag Configuration window, click Tag Configuration, and in the Tag Type menu, select “Singular Web Tracking”.
  3. Under Track Type, select “Logout”.
  4. Click Triggering and add the triggering event: user logout.
  5. Click Save.

Was this article helpful?
0 out of 0 found this helpful