A data feed is a XML file containing details on the advertiser’s products. Each product is a new record in the file and includes the product name, description, URL, image links, categories, and prices. The information in a data feed may vary from advertiser to advertiser as there is no standard way of creating them. Having the feed of data return in an XML format provides a universal, easy to parse solution for affiliates to pull the data from the advertiser and display them on their own sites, and appending affiliate tracking links to the product pages provided in the feed.
For example, if an affiliate has several websites that review clothing and decides to promote different clothes from Nordstrom, instead of loading an offer for each individual piece of clothing, Nordstrom would create one offer with an affiliate data feed in XML format. This way the affiliate doesn’t have to hunt through thousands offers, instead, they simply pull the XML feed and use their own code to show the right products to the right users. The links for the products in the XML feed would include the affiliate’s tracking code so the affiliate would get credit for any sales generated and paid accordingly.
Setting up an XML Feed for affiliates saves the advertiser a massive amount of time by linking to all the included products in their store and containing all the products in one offer instead of potentially thousands of different offers.
XML Feeds come in a simple URL that contains all the XML data, similar to the one below:
When you visit this URL, you can view the feed XML in your browser. Here is an example of what the feed data can look like:
Adding a XML Feed Creative
Before we start adding the XML Feed into your HasOffers account, we need to enable Website Links in the offer. This will allow the tracking link to append a custom URL in which it sends the traffic to. Since each product will have a different URL, this feature MUST be enabled for the XML feed to work.
Once you have enabled website links for the offer, you can go to Offers > Creative Files and click ‘Add Creative’. Select the offer(s) that you want to add this feed to, and give the XML Feed a name. Make sure to select the ‘XML Feed’ option from the creative types. You can also opt to make the feed private so affiliates can’t grab the URL in their own interface.
The objective of the XML Feed is to find the product URLs in the XML file and swap them out for your networks affiliate tracking links that redirect to the product page. To accomplish this the feed parses through the XML tags and looks for a place where the URL tag holds the product page URL. By default the parser looks for an XML file that is structured like this:
Products > Product > URL
It looks in the root tag that is named ‘Products’, where all the products are nested inside. Then it looks for the next child tag: ‘Product’, which contains all the tags that attribute for a specific product. Inside this tag should be a ‘URL’ tag that contains the URL of the product. This value is swapped out with an affiliate tracking link; appending the original URL at the end.
If your XML feed is structured with this structure, you can generate an XML feed URL in the offer page by selecting it from the creative dropdown in the generate tracking section. You will end up with a hosted URL like this:
When you open the URL, you will see the URL tag will have the updated links:
Parsing Custom XML Feed Tags
With the example above, the HasOffers XML Feed tool looks for the Products > Product > URL structure of an XML file to find the product page URL, but many instances this is not how the tag structure is setup by the advertiser. Perhaps the URL tag is named different like ‘’ or all the tags have different names. In either situation, you can specify what tags to look out for so the tool knows where to look in the XML tag hierarchy. Lets say for example just the URL tag is named ‘ProductURL’ like you see here:
In this case we can tell the tool to find that tag by specifying its replacement. When setting up the XML feed creative add the parameter to the end of the original URL:
This will look for the ‘Products’ root tag, then the child tag ‘Product’, and since we specified that the URL tag is actually named ‘ProductURL’, then the tool will know to replace the URL inside that tag with the affiliates tracking link. The ‘url_tag’ parameter is the parameter to point to the tag with the product page URL.
If the tag structure has more than one different naming for the tags, you just have to use additional parameters to specify which tags match the normal naming convention. For example, lets look at an XML file that has a similar structure to the standard but differently named tags:
In this example, the URL is hosted in a tag called ‘ItemURL’, which is nested in ‘Item’ and ‘Store’ as the root tag. Since the tool will not recognize this structure since it does not follow the standard Products > Product > URL naming convention, we have to start at the top level and drill down to the tag containing the URL. Here is how this would look:
With the parameters added, we are telling the tool that the ‘Products’ parent tag is now named ‘Store’, and inside that is the ‘Product’ tag, only its named ‘Item’. Inside the Item tag is the URL tag named ‘ItemURL’ and that will have the product page URL.
Adding an Additional Root Tag
There are instances the root tag goes one level higher than an equivalent ‘Products’ tag, like in this example:
Here, the ‘Store’ tag is the root tag in the file, where the tool is looking for the ‘Products’ tag. However, the ‘Products’ tag is actually nested inside the ‘Store’ tag. In this case, just append the ‘parent’ parameter in the original URL:
This will tell the tool to start back one level up at the ‘Store’ tag and drill down from there.
Now if you have a higher level tag and custom naming for all tags in the file, you can append them as well:
Passing Parameters Into the Product URL
For offers that use postback tracking or want to pass through certain parameters into the product page URLs, you can do so by appending those values into the original URL. Here is an example of passing a sub ID and the transaction ID:
The macros that show where to pass these through need to be encoded, which can be done here. When these are added to the original URL, the ad server will pass these through to each URL in the XML feed. All optional macros that can be set in a default offer URL can be passed through to the product URL.
Example PHP Code for Affiliate
Once you have the affiliate data feed attached to an offer, affiliates can start consuming it. Here is a simple PHP example. It uses displays all the records where page is 1 and uses memcache to save the result temporarily for increased performance.