Expand my Community achievements bar.

Ability to Manually Type Click Goal Selectors

Avatar

Level 2

4/18/18

Need to be able to set our own click event selectors (or to override the visual editor ones) as we may want less-specific selectors than the visual editor forces us into, or to type in selectors on elements that aren't easily clickable in the visual editor.

For example: tracking clicks on all classes of ".xyz" rather than "div.1 > div.2 > div.xyz"

3 Comments

Avatar

Community Advisor

4/19/18

Hi Kyle, this can be achieved by using trackEvent function if you are using AT.js (you can use mboxUpdate() in case of mobx.js).

How to use trackEvent is defined here: at.js Functions

Steps:

1. In your offer code, bind the click event of specific selector using jQuery code:

$('.xyz').click(function(event){

  adobe.target.trackEvent({

    "mbox": "your_mbox_name",

    "params": {

        "cta": "your-cta-name"

    }

    });

});

2. Now you can use your_mbox_name while setting up Success metric

Reporting source: Target; Metric: Conversion; Action: Viewed an mbox mbox: your_mbox_name

3. Add Targeting Audience with consition cta=your-cta-name. This allows you to  keep the mbox-name used in step 1 same across all activities and just change your-cta-name to track multiple CTAs.

Hope this helps,

Regards,

Rajneesh

Avatar

Level 2

4/20/18

thanks Rajneesh for you answer. Actually there is one disadvantage in this custom goal approach that you cannot track click events beyond the Page delivery criteria of the activity. e.g if you have setup an activity on Homepage, you won't be able to track a click event on any other page since the Page delivery location only matches the Homepage URL.

By having an ability of manually adding a selector, we won't have above mentioned problem. I think its a very basic feature Adobe should have already introduced, especially when the websites are more based on SPA frameworks, the visual editor generates complete wrong selectors. I up-vote this feature.

Avatar

Community Advisor

4/20/18

croNinja Completely agree with the idea as it will make understanding activity setup much easier. Just wanted to share that how goal can be achieved through custom-code today before this idea is implemented by Adobe.

On using clicks on CTAs on a different page as a success-metric is an interesting idea  - I havent personally come across any use-case for this yet but sounds like this may be useful for certain scenarios so will look forward to hear back from you on those. Thanks,

Regards,

Rajneesh