The Flexitive Page API feature is turned off by default and available to users under a Flexitive Enterprise plan. Reach out to your account manager or support@flexitive.com if you'd like to enable the Page API on your Flexitive site. When working with the Page API, we recommend working with a developer.


The Page API uses a placeholder custom element that you adapt into, that you will need to export your design as a ZIP file.


The Page API allows you to add in custom Javascript code to your projects, giving you a way to further customize pages built in Flexitive. The Page API enables:

  • Control of page load
  • Creation of custom elements, such as
    • Custom feeds
    • Video
  • Reacting to Page events
  • Connecting dynamic elements to external data sources

To use the Page API, you will need to develop custom Javascript code. Before you start building your Javascript code, check out our Instructions for How to Construct Code for the Page API.


To use the Page API, use the Custom Element option in the Widgets Panel under the Other section. This element serves as a "placeholder" for where you will place your custom element after you publish the design.


blob1478011669829.png


The custom element will be automatically named CUSTOM0 when it is placed on the canvas, but you can change this identifier if you'd like by scrolling to the bottom of the Customize panel with the custom element selected and adjusting the Name field. This will label your Custom element so that you can find it in the HTML after you export. Knowing the name of each custom element in your design is very important for implementing the Page API later on, so make sure that this is well documented. 


If you change the name, click in the Customize panel to save the change.


blob1477950049200.png


Once you have exported the project, follow these steps to place the custom Javascript into your project:


  1. Extract the files for your project.

  2. Open the index.html file in a text editor. Scroll to the bottom of the file to the Page API section. It will be labelled as Flexitive Page API v1.

    blob1478010177644.png

  3. Select the existing code from Page API section (shown highlighted below). In this area, copy and paste your custom Javascript.

    blob1478010722035.png


  4. The custom Javascript that you added will give the Custom Element a new name, such as clock, and we will need to make this change in the rest of the code as well. To do this, find the Custom Element in the file. This is easiest to do by using the Find option and searching for the name that you gave the custom element in Flexitive.

    blob1478011288346.png



  5. Change the name of the element to the name that it was assigned in your Javascript code.

  6. Save your file and close the text editor. Re-zip your design with the index file and all image assets. Your file is now ready to be uploaded to your ad server.


The Page API feature is always evolving to meet your needs, so if you have any questions or feedback, please reach out to a member of the Flexitive Support team, either via the support widget or by emailing us at support@flexitive.com.