# Amazon Advertising

**URL:** https://meta.discourse.org/t/amazon-advertising/204328
**Category:** Plugin
**Tags:** advertising
**Created:** [September 23, 2021, 8:21pm UTC](https://meta.discourse.org/t/amazon-advertising/204328 "2021-09-23T20:21:12Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [September 23, 2021, 8:21pm UTC](https://meta.discourse.org/t/amazon-advertising/204328/1 "2021-09-23T20:21:12Z")

</div>

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.

```plaintext
<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?_  
✅ **Yes**

#### Synchronous option

Gives one `<script>` tag.

_Does this work after initial page load?_

❌ **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.

```plaintext
<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?_

❌ **It never works** , not even the first time it’s loaded.

---

<div class="post-metadata">

### Author: ![dfabulich](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dfabulich/32/108716_2.png) [@dfabulich](https://meta.discourse.org/u/dfabulich)
#### Post date: [September 24, 2021, 2:26am UTC](https://meta.discourse.org/t/amazon-advertising/204328/2 "2021-09-24T02:26:53Z")

</div>

> [@neil](#):
>
> 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.

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.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [September 30, 2021, 9:12pm UTC](https://meta.discourse.org/t/amazon-advertising/204328/5 "2021-09-30T21:12:34Z")

</div>

> [@neil](#):
>
> _Can these native ads be placed using theme components instead of using the ad plugin?_  
> I think so… Needs to be tested.

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

 ![2021-09-30_17-08](https://global.discourse-cdn.com/meta/original/3X/b/5/b50b0d847abe12e5a4275a42b44f3c577166d971.jpeg)

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.

 ![2021-09-30_17-10](https://global.discourse-cdn.com/meta/original/3X/1/5/1544aac41217c835e2a2727d8842e9b0e1665367.png)

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