How to track clicks in Target using web sdk and see clicks in reportings | Community
Skip to main content
March 12, 2025
Question

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

  • March 12, 2025
  • 1 reply
  • 798 views

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.

 

 

1 reply

Vaibhav_Mathur
Community Advisor
Community Advisor
March 17, 2025

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

ArslanNaAuthor
May 12, 2025

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?

Vaibhav_Mathur
Community Advisor
Community Advisor
May 12, 2025

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