Reply
Highlighted
Frequent Visitor
Posts: 14
Registered: ‎10-26-2017
Accepted Solution

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'])
Reply
0 Kudos
Contributor
Posts: 64
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.

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

Re: Push custom event into a tag

thats one error i corrected and the second is the to scope the extension to after tags .This solved my issue thanks