Skip to main content
Published: October 28 2007, 11:59:00 PMUpdated: November 28 2020, 4:01:52 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>";

Note: 
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="http://w-1.ebay.com/js/1.0/ItemBadgeWidget.js?&g_queryKeywords=wii"> 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.

$point_to_epn

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