Frequent Visitor
Posts: 7
Registered: ‎10-26-2017

Push custom event into a tag

[ Edited ]
_tcaq.push(['captureIdentity', '<value>', '<identity-type>']);

how do insert this custom event into a tag 

  • <value> -this is a utag data

  • <identity-type> -text

    i tried doing this through javascript extension but getting an error
  • var x=b.customer_email;
    _tcaq.push(['captureIdentity',x, 'email'])
0 Kudos
Occasional Contributor
Posts: 44
Registered: ‎04-20-2016

Re: Push custom event into a tag

[ Edited ]

What error are you getting, @XCCX?

What scope does the JS extension have?

For the rest of the answer I'm goign to assume you're getting a _tcaq is not defined error, and you have scoped your extension to the tag that creates and uses the _tcaq object...


Extensions run before tags, so if your _tcaq object is created by code in a tag then it won't be declared when the extension runs.

It's usually best to declare the variable first, something like:

var _tcaq = _tcaq || [];

that will use the existing object if it exists, and create a new array object if not.

Or you could scope the JS extension to "after tags" which should mean the object has been created by the time the code runs.