Skip to content

Google Tag Manager (GTM) for Conversion Tracking

To implement Server-to-Server (S2S) tracking via Google Tag Manager, please ensure the following prerequisites are met:

  1. Unified Domain: All tracking actions must occur on the same website/domain.
  2. GTM Installation: A correctly configured GTM container must be installed on your website.
  3. Configured Triggers: Trigger points for target events (e.g., Registration, Purchase, or Lead) must be pre-configured in GTM.
  4. Cookie Setup: A script must be deployed to capture and store the MyBid Visitor ID in a browser cookie.
  5. Postback Script: A secondary script must be configured to retrieve the stored ID and fire the postback to MyBid upon event completion.

How to Set Up Google Tag Manager

1. Create a GTM Account

  • Visit the Google Tag Manager website.
  • Click Start for free and sign in with your Google account.
  • Create a new account by entering an account name and setting up a container (select "Web" for website tracking).

2. Install GTM on Your Website

  • After creating your container, GTM will provide two code snippets.
  • Snippet 1: Paste this as high in the <head> of your website pages as possible.
  • Snippet 2: Paste this immediately following the opening <body> tag.
  • Save and publish your container.

3. Verify Installation

  • Use GTM’s Preview mode to confirm the container is active.
  • Click Preview, enter your website URL, and select Connect.
  • A debug panel will appear, indicating which tags are firing on your site.

Create a Conversion Goal in MyBid

  1. Log in to your MyBid advertiser account and navigate to the Goals tab.

  1. Click the + Create conversion goal button.

  1. The configuration form will appear, requiring the following details:

    • Name: Assign a clear and descriptive name that reflects the specific action (e.g., "Registration" or "Sale").
    • Conversion Type: Select the category that best matches the user's action.
    • Value Type: Define the payout for the conversion. This value is used to calculate your campaign's Revenue and ROI (Return on Investment). You can choose from:
      • No Value: No specific monetary amount will be attributed to the conversion.
      • Fixed: Assign a static amount for every conversion of this type.
      • Dynamic: The conversion value will be passed dynamically through your postback URL.
  2. Once configured, click Next.

  3. A Postback URL will be generated. Note the goal_id parameter in this URL.

  1. Click Copy & done to save your new goal and copy the postback URL for integration.

IMPORTANT

Every Conversion Goal is assigned a unique goal_id. This ID is required to correctly associate user actions with the specific goal in your dashboard. Your postback URL should follow this structure:

md
https://postback.mb-d.com/api/v1/postback?click_id={external_id}&goal_id=186&cost={cost}

Create a New Custom HTML Tag

  1. In your GTM dashboard, navigate to Tags and click New.
  2. Name the tag "MyBid - Visitor ID Collection".
  3. Under Tag Configuration, select Custom HTML.

Add the Script

Paste the following Javascript into the HTML field:

js
<script>
var value = new URL(location.href).searchParams.get("utm_mbid");
if (value) {
    var date = new Date();
    date.setTime(date.getTime() + (30*24*60*60*1000));
    document.cookie = "mybid_visitor_id=" + (value || "")  + "; expires=" + date.toUTCString() + "; path=/";
}
</script>

Set the Trigger

  1. Click Triggering and select All Pages.
  2. Save and publish your changes.

EXPLANATION

This script extracts the utm_mbid parameter from your landing page URL and stores it in a cookie named mybid_visitor_id for 30 days.

Deploy the Event Tracking Script

Create an Event Tag

  1. In GTM, create a second Custom HTML Tag.
  2. Name it "MyBid - [Event Name] Postback" (e.g., "MyBid - Registration").

Add the Postback Script

Paste the following script into the HTML field:

js
<script>
var visitorId = ('; ' + document.cookie).split('; mybid_visitor_id=').pop().split(';')[0];
if (visitorId) {
    var xhr = new XMLHttpRequest();
    // Replace the placeholders below with your actual data
    var goalId = 'ADD_YOUR_GOAL_ID_HERE';
    var costValue = 'ADD_YOUR_VALUE_HERE';
    xhr.open('GET', 'https://postback.mb-d.com/api/v1/postback?goal_id=' + goalId + '&cost=' + costValue + '&click_id=' + encodeURIComponent(visitorId), true);
    xhr.send();
}
</script>

Configure Variables

  1. GOAL_ID: Replace ADD_YOUR_GOAL_ID_HERE with your unique goal_id.
  2. VALUE: Replace ADD_YOUR_VALUE_HERE with your conversion value:
    • Use {cost} for Dynamic value types.
    • Use the exact number for Fixed value types.
    • If using No Value, remove the &cost= parameter entirely.

EXPLANATION

This script retrieves the Visitor ID from the stored cookie and transmits it back to the MyBid server when the event trigger fires.

Set the Trigger

  1. Select the trigger that corresponds to your target action (e.g., a "Thank You" page load or a specific button click).
  2. Save and publish the tag.

Campaign Target URL Configuration

Ensure your MyBid campaign Target URL correctly passes the click ID using the utm_mbid parameter:

md
https://your-site.com/?utm_mbid={%click_id%}

IMPORTANT

The domain used in your campaign must be identical to the domain where the conversion events occur for the cookie to be accessible.