Note: Access to this article does not require a login on Amazon Ad Server (AAS).

The article can be shared with webmasters and other users who do not have a login for AAS.

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

Configure and implement Tag Manager with GTM

Tag Manager can be integrated with GTM. Single Tag Manager can be implemented across different GTM containers.

  1. Configure and generate the Tag Manager code in AAS.

  2. Send the Tag Manager code to the GTM administrator.

  3. In the GTM, the administrator does the following:

    1. Open the account.

    2. Create a new tag.

    3. Name the tag Tag Manager and select Custom HTML for the tag type.

    4. Paste the Tag Manager code, provided by AAS, into the HTML box.

    5. Select the Support document.write check box.


      Note: The Support document.write option is probably not needed since OneTag does not use document.write directly anymore. However, third-party scripts, that are executed by a rule match, might contain document.write, so we recommend selecting this check box to avoid any unexpected bugs.

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

    7. Publish the GTM.

Advanced scenarios

You can pass variables to Tag Manager to use for sales conversion activities and dynamic retargeting activities.

  1. Administrator creates a new User-Defined Variable for each parameter to be collected.

    1. Give the variable a name; variable name should match the conversion activity reporting name.

    2. Select a variable type (either Data Layer Variable, JavaScript Variable or URL Query String Param) and set the data layer or global variable name.

  2. Reference this user-defined variable by Overriding Existing Configuration.

  3. Follow the steps under Configure and Implement Tag Manager with GTM.

Fire Tag Manager onClicks and Buttons within GTM

  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:

      <script> versaTagObj.onready(function() { versaTagObj.generateRequest("http://www.{{Page Hostname}}/{{VariableName}}");     }); </script>



      • GTM automatically replaces {{Page Hostname}} with the site’s domain (and subdomain, if applicable).

      • 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://www.{{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.

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