create-rad-app
v1.0.9
Published
This project template is a starting point for developing custom JavaScript for your ads. It includes a basic structure for the JavaScript code, as well as a simple server for testing the code locally.
Downloads
267
Readme
Responsive Ads Custom JS template
This project template is a starting point for developing custom JavaScript for your ads. It includes a basic structure for the JavaScript code, as well as a simple server for testing the code locally.
Installation & setup
Install dependencies
npm install
Update the
index.html
file with the ad tag provided by the summary page of your ad. Make sure to paste the ad tag below the<!-- ADD YOUR AD TAG BELOW THIS LINE -->
comment inside thebody
element.Update your add tag to sync with the server when Radical finishes loading.
- Add this line
s.onload = syncWithServer;
- Your code should look like this:
(function (d, r) { if (r.state > 0) { return } r.state = 1; var s = d.createElement('script'); s.src = 'https://publish.responsiveads.com/libs/radical.r7.staging.min.js'; s.id = 'rad-lib-script'; d.getElementsByTagName('head')[0].appendChild(s); s.onload = syncWithServer; // <-- Add this line }(document, Radical));
Start the server
npm start
Open the browser and navigate to
http://localhost:3000
to see the ad. You can update the port number in theserver.js
file.Update the
ad.js
file with your custom JavaScript code.Update the
ad.css
file with your custom CSS code.
Known issues
- Updating an event listener without refreshing the page will cause the event listener to be called multiple times (old and new version). This is because the old event listener is not removed when the server updates the custom JavaScript code. To avoid this issue, refresh the page after updating the event listener.