Skip to main content
Published: October 28 2007, 11:59:00 PMUpdated: September 05 2022, 11:44:58 PM

How can I add my affiliate information to the JavaScript widget samples?

Detailed Description

The JavaScript widget samples do not have affiliate tracking implemented.
It's quite easy to implement this yourself by following these instructions which are specific for the "ItemBadgeWidget":

In the getItem and findItemsByQuery functions in the widget, simply add your affiliate tracking details to the URL.  Here is the line of code in the functions that shows what needs to be added:
After constructing the apiURL add the tracking details to it.
apiUrl = apiUrl + "&trackingid=<your tracking id>&trackingpartnercode=<your partner code>&affiliateuserid=<your custom text>";

1.  For eBay Partner Network users, your tracking id is your campaign id and  your trackingpartnercode is 9.
2. affiliateuserid is applicable only for eBay Partner Network and is optional.

That is all there is to it. The Shopping API calls made by the widget will now return the ViewItem links to eBay with the affiliate details included.
Here is a little more of the surrounding code in the widget showing what needs to be done:
<div id="badgeContent"> </div><script type="text/javascript" src=""> apiUrl = apiUrl + "&trackingid=<your tracking id>&trackingpartnercode=<your partner code>&affiliateuserid=<your affiliate userid>"; </script>

This will also apply to samples based on version 2.0 of the JavaScript toolkit.



How well did this answer your question?
Answers others found helpful