Abram
Abram

Reputation: 41954

Referencing 1st Party Cookie variable in Custom HTML in GTM

I have the following in a custom html tag:

window.intercomSettings = {
  app_id: "xxxxxx",
  "utm_source"       : {{ UTM Source }},
  "utm_medium"       : {{ UTM Medium }},
  "utm_campaign"     : {{ UTM Campaign }}
};

When I try to publish the workspace I get this validation error:

Unknown variable ' UTM Campaign ' found in a tag. Edit the tag and remove the reference to the unknown variable.

I have 1st party cookie variables with the names set above, each of which has corresponding cookie names like utm_campaign

Upvotes: 0

Views: 407

Answers (1)

Abram
Abram

Reputation: 41954

The solution to my problem turned out to be removing the spaces from around my variables in the custom html as follows:

window.intercomSettings = {
  app_id: "xxxxxx",
  "utm_source"       : {{UTM Source}},
  "utm_medium"       : {{UTM Medium}},
  "utm_campaign"     : {{UTM Campaign}}
};

Upvotes: 0

Related Questions