Amazon Advertising

After many reports of the ad plugin’s Amazon support not being up-to-date, I’m researching what Amazon offers to figure out what is possible and how to integrate them with Discourse.


Iframes

This is what the plugin currently supports. It was recently fixed, so should still be working. This includes Product Links, and Banners.

However, the iframe ads are not a popular option anymore.

Link To Any Page

These are simple <a> elements for making text links. No plugin support needed.

Mobile Popover

This is two <script> tags added before the closing </body> tag. No plugin support needed.

Native Ads - Recommendation Ads

Async option

Only Recommendation Ads supports async.

After filling in a form, Amazon gives a code snippet with a <div> and a <script> tag.

<div id="amzn-assoc-ad-INSTANCE-ID"></div>
<script async src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US&adInstanceId=INSTANCE-ID"></script>

Can I embed both synchronous ad code and an asynchronous ad code together on the same page?
This is not recommended. While this may work in certain situations, it may lead to errors that are hard to detect and debug. We recommend that you convert all ads on a single page into asynchronous ad format at once.

Can I embed two asynchronous ad codes in two slots on the same web page?
Yes. You can do that. But you need to ensure you generate two different saved ad codes from the Associates Central portal. If you embed an exact same piece of ad code in two placements on the same web page, it will not work.

That last sentence is a problem for inserting ads in between posts. You need a unique ad id for each one. The ad plugin can’t generate unique ads. It must be done manually in the Amazon Affiliates UI.

Can these native ads be placed using theme components instead of using the ad plugin?
:white_check_mark: Yes

Synchronous option

Gives one <script> tag.

Does this work after initial page load?

:x: It never works, not even the first time it’s loaded.

Native Ads - Search Ads, Custom Ads

Is not async. Code is two <script> tags with many variables.

<script type="text/javascript">
amzn_assoc_placement = "adunit0";
amzn_assoc_search_bar = "true";
amzn_assoc_tracking_id = "...";
amzn_assoc_search_bar_position = "bottom";
amzn_assoc_ad_mode = "search";
amzn_assoc_ad_type = "smart";
amzn_assoc_marketplace = "amazon";
amzn_assoc_region = "US";
amzn_assoc_title = "Shop Related Products";
amzn_assoc_default_search_phrase = "Laptops";
amzn_assoc_default_category = "All";
amzn_assoc_linkid = "...";
</script>
<script src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US"></script>

Does this work after initial page load?

:x: It never works, not even the first time it’s loaded.

5 Likes

I guess if we had to, we could just create a whole bunch of IDs (100+ oughta do it, amirite?) and paste them into the admin UI.

2 Likes

Yes, Native Ads (Recommendation Ads) can be put into a theme component. No plugin is required.

Showing at the top of a topic page was one file in a directory named javascripts/<plugin-name>/connectors/topic-above-post-stream/<plugin-name>.hbs. Paste the code for the ad into this file.

I’m not sure that the ad-plugin is needed for supporting Amazon Ads.

2 Likes