Avatar of Randy Cole
Randy Cole
Flag 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;
}
JavaScriptE-CommerceGoogle WorkspaceInternet MarketingWeb Development

Avatar of undefined
Last Comment
Randy Downs

8/22/2022 - Mon
Randy Downs

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.
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.
Randy Downs

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.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Randy Cole

ASKER
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
Randy Downs

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.