Archived topic
Amazon Script Won't Show in Hook Element
24 replies · Started by Anthony on October 6, 2019
I'm trying to insert an Amazon affiliate native ad inside a hook to display it just before the comments container. I can't get it to show up.
There's 4 types of ads. two of them are just links, one is an iframe, but this native one is a script.
Can you not show script unless it's in the header or footer script hook?
Hi there,
i can see some affiliate ads before the comments container - maybe browser cache needs clearing?
Hey David,
I ended up putting one of the other four types of ads in there until I'm able to show the <script> inside the hook.
The four ad types are "Text, Image, Text & Image and Native Ads".
Native ads is a script while the other three are text and iFrames.
So the script works if you move it to another hook?
No, sorry.
It's not working in any hook.
It's an Amazon Associates - Native Shopping Ad.
It's an <iFrame>.
I was hoping to display the Native Shopping Ad using a hook to insert it onto my pages.
Anthony
Can you share the code you're adding here?
Before submiting - if you can highlight the code and click the Code Button to preserve its formatting.
Aside of that - silly question have you selected the correct display rules....
Hey Dave,
This is the script here:
<script type="text/javascript">
amzn_assoc_tracking_id = "mini08-20";
amzn_assoc_ad_mode = "manual";
amzn_assoc_ad_type = "smart";
amzn_assoc_marketplace = "amazon";
amzn_assoc_region = "US";
amzn_assoc_design = "enhanced_links";
amzn_assoc_asins = "1623156610";
amzn_assoc_placement = "adunit";
amzn_assoc_linkid = "cf585f0c564164615825dc4c9b944d54";
</script>
<script src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US"></script>
I have it set to display on all "recipes" which is a custom post.
Anthony
The hook is working as i can see the script in the markup.
But there is an error in the console related to the onejs script that is being called.
You would need to speak with the provider to find out what the possible causes are.
Before doing so worth clearing and disabling any cache plugins just in case there causing a conflict.
Hmm.
Am I contacting cloudfare, my host, or the recipe plugin developer?
Seems to be a few console errors I was unaware of.
Thanks
the error is related to the amazon script - so i would seek amazons ad service support.
But its worth eliminating any possibility it is server / cloudflare related first.
I had a look around and this is the amazon guide to adding them:
https://affiliate-program.amazon.com/help/topic/t405
They recommend using the AdInserter plugin - not sure why that would make a difference but worth giving that a shot to see if it works.
Also what happens if you add the script within the post content itself?
Hey David,
Sorry for the delay.
It's not working right in the content either, weird.
It's annoying. About a month or two ago I could paste these and I swear they worked.
After digging around I found this answer here:
https://stackoverflow.com/questions/49851104/how-to-load-script-in-react-component/50843982#50843982
Which lead to this:
https://www.npmjs.com/package/postscribe
Which I'm having a hard time understanding.
Can you point me to what lead you to the first stackoverflow link ?
Async JS will remove render blocking but not sure it explains why its not loading at all.
I pasted the JS error into Google.