Expand my Community achievements bar.

SOLVED

Hi , Is there a way to count a button clicks using Visitor profile scripts? Because I want to use that count as audience and target the test.

Avatar

Level 2
 
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 5

Hi @subhaD,

 

You can add a count for button clicks using custom code, profile scripts, and audience builder.

 

Here are the steps:

 

1) Add adobe.target.trackEvent to the close button you want a count for. Give it a unique name like "myCloseButton" or something like that.

2) Test that you see the delivery call firing when you click the close button using your browser's network tab.

3) Once you know the trackEvent is firing, navigate to the profile scripts section in the Adobe Target UI and click on "+ Create Script."

4) Enter the code that will count the close button click as follows:

 

 

 

if (mbox.name == 'myCloseButton') {
  return (user.get('clickedMyCloseButton') | 0) + 1;
}

 

 

 

  • Make sure to name the profile script something like "clickedMyCloseButton" so you know what the profile script is for.
  • Make sure to save and activate the profile script.

5) Now, you can use the visitor profile within an audience. Once built, you can use it within a target activity.

 

I hope that helps.

 

Matthew Ravlich | ACG Digital | albertacg.com

View solution in original post

3 Replies

Avatar

Correct answer by
Level 5

Hi @subhaD,

 

You can add a count for button clicks using custom code, profile scripts, and audience builder.

 

Here are the steps:

 

1) Add adobe.target.trackEvent to the close button you want a count for. Give it a unique name like "myCloseButton" or something like that.

2) Test that you see the delivery call firing when you click the close button using your browser's network tab.

3) Once you know the trackEvent is firing, navigate to the profile scripts section in the Adobe Target UI and click on "+ Create Script."

4) Enter the code that will count the close button click as follows:

 

 

 

if (mbox.name == 'myCloseButton') {
  return (user.get('clickedMyCloseButton') | 0) + 1;
}

 

 

 

  • Make sure to name the profile script something like "clickedMyCloseButton" so you know what the profile script is for.
  • Make sure to save and activate the profile script.

5) Now, you can use the visitor profile within an audience. Once built, you can use it within a target activity.

 

I hope that helps.

 

Matthew Ravlich | ACG Digital | albertacg.com

Avatar

Community Advisor

Hi @subhaD,

I agree with @Matthew_Ravlich_ACG - it was also saved in the user profile (possibly also with a max limit) and build an Audience from it accordingly.