Hi,
We are trying to use AdPlugg in our web app that is a SPA (Single Page Application), i.e. web apps that load a single HTML page and dynamically update that page as the user interacts with the app by rewriting the current page (DOM elements) rather than loading entire new pages from the server.
We added the AdPlugg <script> snippet in the HEAD section of the layout template that controls the overall layout of the SPA and common across all pages. We then insert the AdPlugg <div> tag at the relevant page templates based on our Ad Zones. Since SPA updates the web page DOM elements dynamically when the user clicks on the page links, thus we find that AdPlugg is not able to functional normally. What it means is AdPlugg <div> tag is not found in the web page initially when the AdPlugg <script> snippet is executed, and when the user clicks on the link of page with AdPlugg <div> tag, the page DOM elements (including the AdPlugg <div> tag) are written dynamically to the current page, but AdPlugg <script> snippet won't detect this and display our ads accordingly.
Our questions:
1. Is there a AdPlugg Javascript API where we can trigger AdPlugg to scan the entire DOM elements of the current page for AdPlugg <div> tag and display our ads?
2. As our user click on the page links and navigates between the pages, the new pages are not loaded from the server although the location URL changes. Thus, the API used in #1 will also need to re-read the current location URL to display the relevant ads.
So far, we managed to make some progress:
(i) We discovered the javascript function AdPlugg.run() that enables us to achieve #1, but we are still struggling in achieving #2.
(ii) Due to this, our ads only shown correctly in the first page that we open via typing manually in the browser location bar.
(iii) When we click on the page links to navigate between pages, the ads that is targetted for the first page is shown regardless of the current location URL.
(iv) Our assumption is that AdPlugg <script> snippet "remembers" the location URL when the first page is loaded, i.e. when the AdPlugg <script> is first loaded and executed.
(v) As we click on the page links, AdPlugg is not aware that our page URL has changed and it needs to re-read the current location URL. (Since the AdPlugg <script> snippet does not get reloaded when the user navigates between pages in our SPA.)
We are stuck now. Appreciate some guidance to help us moving forward. Thanks in advanced.