Link to home
Start Free TrialLog in
Avatar of Randy Cole
Randy ColeFlag for United States of America

asked on

enhanced ecommerce and GTM UA

Using GTM and Enhanced eCommerce: I need to track eCommerce on a third-party system and the required ID field is not called ID or transactionID ... it is called confirmID. I'm trying to retrieve a few values from the purchase including transaction amount and cannot use the dataLayer so I'm using a custom JavaScript variable in GTM and have built a tag to read data from the custom variable.

How can I make this work if my ID field name does not match the required ID field name? Here's my JavaScript variable:

    function() {
  var ecommerceData = {
    'ecommerce': {
      'purchase': {
        'actionField': {'confirmid':'T123456',
          'tik_value':'500.00',
          'pids':'800911',
          'discounts':'chipster' }


        }
      }
  };
   return ecommerceData;
}
Avatar of Randy Downs
Randy Downs
Flag of United States of America image

Do you get anything if you use the standard javascript?

// A custom JavaScript macro that returns an ecommerceData object
// that follows the data layer syntax.
function() {
  var ecommerceData = {
    'ecommerce': {
      'purchase': {
        'actionField': {'id': 'T12345'},
        'products': [
            // List of productFieldObjects
        ],
        ... // Rest of the code should follow the data layer syntax.
     }
  };
  return ecommerceData;
}

Open in new window


If you choose to use a custom JavaScript macro instead of the data layer, select Enable Enhanced Ecommerce Features and set the Read data from macro option.
Avatar of Randy Cole

ASKER

No, I don't get anything at all. I'm considering hiring someone to fix this for me as it seems to be above my level of expertise and is taking more of my time than I have to give to it.
Did you do this?

If you choose to use a custom JavaScript macro instead of the data layer, select Enable Enhanced Ecommerce Features and set the Read data from macro option.
Yes, I did. I'm thinking this is not something I can solve without the assistance of a developer or the IT team at the third party system. I think my firing rules are being trumped by the virtual pageload and I can't get the tags to fire as desired.
ASKER CERTIFIED SOLUTION
Avatar of Randy Downs
Randy Downs
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial