PRODUCT

Amazon Ad Server will be sunset in Q4 2024, please visit this page (AAS offboarding information) for offboarding support resources and sunset FAQs. Details shared on that page represent the most up to date information in the Help Center, if you find disparate information in other resources please default to the information in the AAS offboarding information page accordingly.

Follow

The following article details the Tag Manager integration with Google Tag Manager (GTM).

Configure and implement Tag Manager with GTM

This guide outlines the steps to configure and implement Tag Manager with Google Tag Manager (GTM). The integration allows you to use AAS Tag Manager's functionality across different GTM containers.

General Procedure

  1. Configure and Generate Tag Manager Code in AAS
    Begin by configuring and generating the Tag Manager code within your Ad Server (AAS). Refer from this article for reference: Work with Tag Manager
  2. Share the Tag Manager Code
    Provide the generated Tag Manager code to the GTM administrator.
  3. GTM Administrator Actions
    In Google Tag Manager, the administrator should perform the following steps:
    1. Open the GTM account associated with your website.
      image (17).png
    2. Create a new tag by following these steps:
      image (18).png
      • Name the tag "Tag Manager"
      • Select "Custom HTML" as the tag type.
    3. Paste the Tag Manager code, provided by AAS, into the HTML box.
    4. Select the Support document.write check box.

      Note:
      The Support document.write option is not required for implementing Tag Manager because it does not use document.write directly. However, third-party scripts, that are executed by a rule match, might contain document.write, therefore, it is recommended to select this check box to avoid any unexpected runtime errors.

    5. Select the default All Pages in the Triggering section.

    6. Publish the GTM.

image (19).png

Passing Variables to Tag Manager

It is possible to pass variables to Tag Manager to use for sales conversion activities and dynamic retargeting activities.

GTM Setup

  1. Follow the steps under Configure and Implement Tag Manager with GTM.
  2. GTM admin adds the following data layer before the existing implementation of tag manager code. Have the GTM admin use the correct variable name where {{GTMvariableName}} should be replaced.
    <script type = "text/javascript">
    var SizmekDataLayer = {
    "OrderID": "{{GTMvariableName}}",
    "ProductID": "{{GTMvariableName}}",
    "ProductInfo": "{{GTMvariableName}}",
    "Quantity": "{{GTMvariableName}}",
    "Value": "{{GTMvariableName}}",
    "Variable 1":{{GTMvariableName}}",
    "Variable 2":{{GTMvariableName}}",
    "Variable 3":{{GTMvariableName}}"
    }
    </script>
  3. Publish in GTM.

AAS Setup

  1. Create Variables each named OrderID, ProductID, ProductInfo, Quantity & Value. Select Data Layer Variable as type. Set Variable Name in Data Layer to be the same with the Variable name. Tag Manager also supports passing custom variables (Variable_1, _2 and _3 on the sample code above). To setup Custom variables, create them under the Tag Manager, as described here, and add them to the code for the SizmekDataLayer.
  2. Assign the created variables to activity parameters in your conversion activity. Make sure your conversion activity is attached to an activity rule.
  3. Publish Tag Manager.

Fire Tag Manager on Button Clicks and Pass Data using GTM

In this process, the AAS Tag Manager is triggered when a website button is clicked. The data linked to this button click event is collected and transmitted through Google Tag Manager (GTM). This outlines how to effectively manage data tracking on a website using both AAS Tag Manager and GTM, ensuring seamless data flow and analysis.

GTM Setup

  1. In GTM, the administrator creates a User-Defined Variable.
    1. Give the variable a name.
    2. Select the Auto-Event Variable as the variable type.
    3. Select Element ID from the Variable Type list, and click SAVE.
  2. In GTM, administrator creates a new tag.
    1. Name the Tag TM_generateRequest and choose Custom HTML as tag type.
    2. Paste the following into the HTML box. Have the GTM admin use the correct variable name where {{GTMvariableName}} should be replaced. Note that adding variables is optional, and the sample code below is used for illustration purposes.
      <script>
      versaTagObj.onready(function () {
      versaTagObj.clearActivityParam();
      versaTagObj.setActivityParam("OrderID", {{GTMvariableName}});
      versaTagObj.setActivityParam("ProductID", {{GTMvariableName}});
      versaTagObj.setActivityParam("ProductInfo", {{GTMvariableName}});
      versaTagObj.setActivityParam("Quantity", {{GTMvariableName}});
      versaTagObj.setActivityParam("Value", {{GTMvariableName}});
      versaTagObj.generateRequest("http://www.{{Page Hostname}}/{{VariableName}}");
      });
      </script>
      1. GTM automatically replaces {{Page Hostname}} with the site’s domain (and subdomain, if applicable).
      2. The reference {{VariableName}} is used to illustrate the example. The actual value within the brackets {{}} should be replaced by the name given to the variable in step 1. For example, If the variable was named SubmitButtonClick, then the reference to it in the generateRequest method would be:
        versaTagObj.generateRequest("http://{{Page Hostname}}/{{SubmitButtonClick}}");
  3. Under Advanced Settings > Tag Sequencing perform the following actions:
    1. Select Fire a tag before TM_generateRequest fires and select Tag Manager as the setup tag.

    2. Select Don’t fire TM_generateRequest() if Tag Manager fails.
      This will ensure that TM_generateRequest() only fires after Tag Manager has successfully fired.

  4. Add a trigger to initiate the firing of the TM_generateRequest tag, commonly on user clicks:
    1. Add a new trigger using All Elements type.

    2. Select Some Clicks.

    3. Define firing conditions based on the elementID (taken from the Page source/HTML tag properties) that is stored by the variable created in step 1.

    4. Select Save.

  5. Publish the GTM.

AAS Setup

  1. Create an activity rule, in the IF section select Page URL and Equals one of the following. Input the elementID defined in step 4c of the GTM setup.
  2. Add a conversion activity to the rule. Make sure the type is Amazon Ad Server’s Conversion - Sales
  3. Publish Tag Manager

 

Was this article helpful?
0 out of 1 found this helpful
Have more questions? Submit a request

Comments