eventProperties within HTML Code

Does the HTML Code custom field support eventProperties?

I have a script which requires properties from the event but I seem to be getting an error when the event is triggered and it tries to evaluate an eventProperties using the standard syntax {{ client.properyName }}

When swapping out these eventProperties the action fires without error.

It should work.

What error are you getting, and what does your Custom HTML code looks like?

Hi Yoaz,

I’m getting an unexpected token '{' error, in the zaraz.i file.

The custom HTML looks like this:

<script>
var rev = {{ client.totalValue }};
if (rev && rev > 0) {
	ttq.track('CompletePayment', {
		content_type: 'product',
		contents: [{{ client.products }}],
		value: {{ client.totalValue }},
		currency: 'USD'
	});
}
</script>

When I replace all of the {{ ... }} with hardcoded values, the custom HTML appears to run fine.

Cheers
Tom

{{ values }} are replaced as they are, so if any of them isn’t exactly a number, you would need to wrap them with quotes like var rev = "{{ client.totalValue }}", otherwise you might get some broken JS.

1 Like

Ok yeah great thanks.

That’s fixed the totalValue property now I just need to work on the collection of products.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.