Moments
JS SDK (for Websites)

Google Ad Manager (GAM)

9min

Introduction

This guide simplifies the integration of MomentScience with Google Ad Manager (GAM). Follow these steps for a quick and effective setup to enhance your website's advertising capabilities.

Requirements

  1. Your JS SDK snippet (obtainable through the Dashboard).
  2. Access to your Google Tag Manager account.
  3. Information on the page link/URL structure where you'll display the MomentScience unit (e.g., order confirmation page)

Steps Overview

  1. Navigate to Google Ad Manager and select Delivery > Creatives.
  2. Under Display Creatives, click "New Creative."
  3. Choose your advertiser and select "Third party."
  4. Enter a name for your creative (e.g., MomentScience – banner – 1x1 - 1).
  5. Set the Target ad unit size size to 1x1 for universal compatibility.
  6. Select "Standard" for the Code type and paste the JS SDK snippet.
  7. Save your settings.

For additional guidance on setting up third-party creatives, refer to this Google Ad Manager support article.



Passing Payload Values (Optional)

To pass payload values with a GAM-driven implementation of MomentScience, you have two options:

  1. Declare the payload object before loading MomentScience via GAM
  2. Set payload values and refresh the MomentScience unit afterward

Option 1: Declare Payload Object Before Loading MomentScience via GAM

  1. Determine the payload values you want to pass.
  2. Use the following code snippet to pass your payload, Just replace the customAttribute with the desired attribute(s) and value(s).
Passing Payload Values


To set multiple payload attributes at once, use:

Passing Multiple Payload Attributes Once


When a payload attribute is set, it overwrites any existing value for that attribute. For example, if both snippets are used, the final value for the payload attribute "customAttribute" would be set to "newValue".

Option 2: Set Payload Values After MomentScience Initialization via GAM

To set payload values after MomentScience is initialized via GAM, follow these steps:

  1. Modify the Moments JS SDK Snippet to prevent MomentScience from loading on initialization by setting autoLoad: false.
  2. This allows payload values to be added on page load.
  3. To launch the unit and refresh/display it with the updated payload values, call window.Adpx.refresh().

The MomentScience JS SDK Snippet provided displays MomentScience at run-time by default. To delay its display and add payload values on page load, set autoLoad: false. Afterwards, you can launch the unit with the updated payload values by calling window.Adpx.refresh().



📢 If you're running into any issues while going through the integration process, feel free to contact us at [email protected]