Rob
Rob

Reputation: 6380

Correct syntax for multiple product ID's for Google Ads in GTM

I'm using Google Tag Manager to pull in some data for my Google Ads. When I goto a product page, I've just hard coded some product ID's as an example, but I get the following error:

enter image description here

This is how I've defined the product ID's, it's saying multiple ID's need to be in an array, to my understanding they are.

Where am I going wrong? enter image description here

Upvotes: 2

Views: 558

Answers (1)

Michele Pisani
Michele Pisani

Reputation: 14179

Try to use your GTM variables {{order-items}} (that contains in your case 193, 194, 195) in a Custom Javascript Variable to generate an array from your comma-separated string, like this:

function() {
  var products = {{order-items}};
  return products.split(",");
}

Upvotes: 1

Related Questions