Skip to main content
New Member
Mar 12, 2025 12:41 PM UTC
Question

How to track clicks in Target using web sdk and see clicks in reportings

Hi, 
I want to track the number of clicks on the Add-to-Basket CTA via custom events. How can I achieve this using JS code, and how should I set up my reporting so I can see the number coming? Below is the screenshot of my reporting, I have tried different code examples but none of them are working.

 

 

3 replies

Vaibhav_Mathur
Community Advisor
Community Advisor
Mar 17, 2025 11:12 PM UTC

Hi @arslanna , 

 

In case of WebSdk, On click of the Add-to-Basket CTA, you can try firing the JS code given below :

 

window.alloy("sendEvent", {

    "renderDecisions": false,

    decisionScopes: ["buy-now"],

    "xdm": {

        "web": {

            "webPageDetails": {

                "paramName": "buttonClicked"

            }

        }

    }

})

 

In the Adobe Target Activity, your setup of the goals and settings section in the screenshot looks correct. (Make sure you track the same mbox that you fire in the JS code.) 

 

I hope it helps. 

 

Best regards, 

Vaibhav Mathur

Translate
ArslanNaAuthor
New Member
May 12, 2025 7:59 AM UTC

Thanks @vaibhav_mathur ; if I use the above code, will the reporting automatically pick the events or there is something extra I need to setup in Target in order to capture events?

Translate
Vaibhav_Mathur
Community Advisor
Community Advisor
May 12, 2025 8:30 AM UTC

Yes @arslanna , 

The reporting events should work correctly. You'll just need to specify your mbox name in the goals and settings section of the activity. 

 

Best regards, 

Vaibhav Mathur

Translate