• I’m trying to use Google Tag manager to pass a conversion value back to Google Analytics for AdWords conversion tracking on this page.

    https://www.autovaultmn.com/msp-airport-parking/

    Within my form, there’s an estimated cost of booking that I believe is noted as a java variable with id “booking_hint10”

    I have a tag set up through tag manager that will listen for form submit and can pass a value on submit. I’m just not sure how to set up the action to actually send the transaction value through to Google Analytics for conversion tracking.

    Here’s the code with the variable I want to pass…

    Estimated Cost of Booking: <span style=”color: #f3cc52;”><span id=”booking_hint10″>$ 0.00</span><input style=”display:none;” type=”text” value=”0.00″ id=”cost_hint10″ name=”cost_hint10″ /></span>

    https://www.ads-software.com/plugins/duracelltomi-google-tag-manager/

Viewing 1 replies (of 1 total)
  • Plugin Author Thomas Geiger

    (@duracelltomi)

    It is a bit tricky since if you want to track a transaction into Google Analytics you first need to prepare the necessary dataLayer variables:

    https://support.google.com/tagmanager/answer/3002596?hl=en

    This means that if you catch the form submit, first you have to fire a custom HTML tag that pushes transaction data into the dataLayer:

    <script>
    dataLayer.push({
      'event': 'doGATrans',
      'transactionId': 1, // you have to generate a unique ID here !!!
      'transactionAffiliation': '',
      'transactionTotal': {{estimated-cost}},
      'transactionTax': 0,
      'transactionShipping': 0,
      'transactionProducts': [{
            'sku': 'AAA111',
            'name': 'Name of service',
            'category': '',
            'price': {{estimated-cost}},
            'quantity': 1
        }]
    });
    </script>

    The {{estimated-cost}} macro can be set up as a JS macro that reads the id “booking_hint10” and removes money formatting:

    function () {
      return jQuery("#booking_hint10").text().replace("$", "").replace(" ", "");
    }

    I did not test this setup so there might be some bugs ??

    Cheers,
    Thomas

Viewing 1 replies (of 1 total)
  • The topic ‘Push Transaction Value’ is closed to new replies.