I have embedded Amazon affiliate native search Ad on my website. When I test it my dev laptop, the "Search ad" displays without any issues. However when deployed to hosting Provider, encounter runtime error and amazon search Ad not displayed. Please help here.
Error:
Uncaught TypeError: Cannot read property 'getBoundingClientRect' of null
at Object.v.getAAXUrl (onejs?MarketPlace=US:1)
at Object.render (onejs?MarketPlace=US:1)
at onejs?MarketPlace=US:1
v.getAAXUrl @ onejs?MarketPlace=US:1
render @ onejs?MarketPlace=US:1
(anonymous) @ onejs?MarketPlace=US:1
//Amazon generated code
<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 = "watches";
amzn_assoc_default_category = "All";
amzn_assoc_linkid = "*********";
</script>
<script src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US"></script>
from amazon affiliate search ad script: Uncaught TypeError: Cannot read property 'getBoundingClientRect' of null
I was facing the same problem. After so much testing I realised that some of my JS Files are not loading before running the Ad script. That was due to Cloudflare.
ReplyDeleteYes, I just turned off the Rocket Loader from the Speed menu of Cloudflare & Ads started showing.