Tracking Custom Event on the Target banner using Data Elements & Rules | Community
Skip to main content
Michael_Soprano
New Participant
December 19, 2023
Solved

Tracking Custom Event on the Target banner using Data Elements & Rules

  • December 19, 2023
  • 1 reply
  • 693 views

Hi, 

 

I implemented AEP and Target using AEP Data Collection Web SDK. I implemented cookie banner using Target with 2 buttons which generate two custom events on click: 

a) accept button - acceptedPersonalization

b) decline button - refusedPersonalization 

However there is a problem. I am not able to catch if these buttons were clicked using Data Elements. I implemented Data Element custom code in order to track that event. But that data elements returns nothing (for example when I use 

_satellite.getVar('myDataElement')). Imho it might be connected with order of loading data elements etc. However if I use Rules and Custom Event in that rule AEP catches that Custom Event. However if I want to pass that data to XDM Schema I need to have data element 

 

So there are two 2 questions: 

1. Is it possible to track Custom Event with Data Element which might be fired on click (ex. 10 seconds later - when some element was clicked by user)? Additionally the Custom Event is implemented on the banner which was injected using Target. 
2. Is it possible to generate Data Element after Rule was fired ? 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by VikasChaudhary_

Hi @michael_soprano,

I would need some more details about you target activity, launch rules, data elements and AEP audiences to understand the problem.

If I were to implement such solution, I would have the following setup:

Cookie Banner Activity on Target
Events on button click:

a) accept button - acceptedPersonalization
b) decline button - refusedPersonalization
Audience: Where acceptedPersonalizationCookie exists

 

Rules on Launch:
1) When acceptedPersonalization event is trigerred then set acceptedPersonalizationCookie to true
2) When refusedPersonalization event is trigerred then set acceptedPersonalizationCookie to false
3) When page loaded if acceptedPersonalizationCookie is true then show Personalization else no Personalization.

In this case you need only one data element which captures the value of acceptedPersonalizationCookie cookie, which can then be used in your XDM schema data variable.

To answer your questions:

1. Is it possible to track Custom Event with Data Element which might be fired on click (ex. 10 seconds later - when some element was clicked by user)? Additionally, the Custom Event is implemented on the banner which was injected using Target. 

 

Response: Yes, you can add delay in your actions. Let's say you have a rule configured on click of an element, you can then define the first action as a Custom Code action which basically does nothing, but you add a timeout of 10000 milliseconds under Advanced Options

and then add your action that you want to perform, so you rule would look like:


2. Is it possible to generate Data Element after Rule was fired?
Response: The data elements are like dynamic JavaScript statement, which gets executed every time they are referenced, the values are not persisted.

-Vikas Chaudhary

1 reply

VikasChaudhary_
VikasChaudhary_Accepted solution
New Participant
January 3, 2024

Hi @michael_soprano,

I would need some more details about you target activity, launch rules, data elements and AEP audiences to understand the problem.

If I were to implement such solution, I would have the following setup:

Cookie Banner Activity on Target
Events on button click:

a) accept button - acceptedPersonalization
b) decline button - refusedPersonalization
Audience: Where acceptedPersonalizationCookie exists

 

Rules on Launch:
1) When acceptedPersonalization event is trigerred then set acceptedPersonalizationCookie to true
2) When refusedPersonalization event is trigerred then set acceptedPersonalizationCookie to false
3) When page loaded if acceptedPersonalizationCookie is true then show Personalization else no Personalization.

In this case you need only one data element which captures the value of acceptedPersonalizationCookie cookie, which can then be used in your XDM schema data variable.

To answer your questions:

1. Is it possible to track Custom Event with Data Element which might be fired on click (ex. 10 seconds later - when some element was clicked by user)? Additionally, the Custom Event is implemented on the banner which was injected using Target. 

 

Response: Yes, you can add delay in your actions. Let's say you have a rule configured on click of an element, you can then define the first action as a Custom Code action which basically does nothing, but you add a timeout of 10000 milliseconds under Advanced Options

and then add your action that you want to perform, so you rule would look like:


2. Is it possible to generate Data Element after Rule was fired?
Response: The data elements are like dynamic JavaScript statement, which gets executed every time they are referenced, the values are not persisted.

-Vikas Chaudhary