how to have unique events when using u.addEvent?

Gold Contributor
Gold Contributor
I started using a "advanced" system of tracking for events, so I rely to "u.addEvent" to trigger events instead of tealium data-mapping. Sometimes happens that i call u.addEvent more than one time for the same event, and I wondering if there is any way to avoid duplication of events or to check whether or not an event is already set.
7 REPLIES 7

how to have unique events when using u.addEvent?

Employee Emeritus

Hey Jarno,

From my tests, it shouldn't matter whether you trigger u.addEvent() multiple times for the same event unless you're setting a numeric event.

e.g. if I trigger u.addEvent("event10"); 8 times then I'll still only fire one event10 when the call eventually fires (http://note.io/19To8Ou).

However, if you were setting numeric events then you might have an issue:

e.g. if I trigger u.addEvent("event10=100.00"); and then u.addEvent("event10=200.00"); then I'll get two event10s set with different values (http://note.io/1Iy4EtX) although I do wonder whether SiteCatalyst will handle this for you (possibly not)

One way you could do this is to loop through the variable b.sc_events to see what is set and then don't set it if it is already set (or delete the old value and then use u.addEvent to set a new value):

http://note.io/19Tom86

Hopefully, this should help?

Cheers,

Roshan

how to have unique events when using u.addEvent?

Gold Contributor
Gold Contributor

Hi Roshan, thank you for your support.

 

Probably I faced to duplicate event (no-numeric) when both u.addEvent and data-mapping work on the same tracking call. Anyway, I'm wondering if I can check whether or not an event is placed into the server call, before I call u.addEvent...

how to have unique events when using u.addEvent?

Employee Emeritus

Hi Jarno,

Apologies for the delay, you can check b.sc_events to see what events have been stacked so far by u.addEvent() but if you have any normal mappings in Tealium to trigger events I'm afraid you won't be able to see these.

I'm not sure I understand the purpose of checking though - if it is already set then setting it again wouldn't have any adverse effect as it would just set it again).

Could you confirm?

Thanks,

Roshan

how to have unique events when using u.addEvent?

Gold Contributor
Gold Contributor

Hi Roshan,

thanks for the hit on b.sc_events

I'm turning from data mapping to u.addEvent() method because I'm need to use a custom and more advanced method to get tracking of events, so sometimes happens that I have both the previous and the new method on the same page, so for instance, "cart-to-add" is fired twice instead of once.

Anyway, thanks for your support.

how to have unique events when using u.addEvent?

Employee Emeritus

That's strange Jarno - I can't replicate that. Could you confirm that you're seeing 'scAdd' firing twice in the same call? Also, could you confirm the version of the SiteCatalyst tag you are using and the account/profile and a URL to test?

Thanks,

Roshan

how to have unique events when using u.addEvent?

Bronze Contributor
Bronze Contributor
Is there a method to do this for props and evars too?

how to have unique events when using u.addEvent?

Employee Emeritus

Hi @00pritchard,

 

You should just be able to set the props and eVars directly.  For example, say you have foo mapped to prop1 and eVar 1.  You can set foo to text "bar" using a Set Data Value extension under the same conditions as when you are using the u.addEvent method.

 

Public