Before we start, if you haven't finished reading The Basics article you may want to read that first.
Managing multiple banner links:
Then add the function code below. As you see, in the leaderArray, we are using multiple links. For simplicity purpose, I have added 3 links but you can add several ones. This function will return random value from the available links each time page is loaded.
New function for storing links
Now, update the original function as below. As you can see, instead of using the link directly we are using the function created above. Once done, click on 'Commit Changes' option below.
Updated original function
That's it. You are good to go. You don't have to do anything on your blog or website.
Managing multiple agencies (Amazon):
If you are like most folks you would probably have signed up for other affiliate programs. So far we have been handling just one agency and thats not going to work for most of the folks. You may want to display different ads from other agencies at different sections. For this example, I will explain the Amazon links but you can use the similar logic to others as well.
Let's start with the code from Amazon. It will look similar to following.
Amazon code for a banner
Function created for Amazon ad code
Finally, similar to what we have seen in 'The Basics', you would need to create a method that you can use within your blog or website. It will look similar to below.
Code for using in your blog or website
Managing multiple agencies (Google AdSense):
Here is how your usual Google AdSense code looks like. Keep in mind that the data-ad-client and data-ad-slot ids are different for your account
Code from AdSense
After converting to a function, it will look like the following.
Converted code into a function
Just like the examples above you need to create a code snippet using this function for placing the same in your blog or website.
Continue reading next article: Random Ads