Using the viewer API, it is possible to define any given embedded publication page as a "custom channel" to be used in conjunction with our Preferred Viewers. Simply add the following line to your embedded viewer script:
viewer.addContext(com.zmags.api.Viewer.Context.CUSTOM_CHANNEL, "channel_name_here");
Rather than "channel_name_here", choose a channel name to be used in the Publicator later. When placed in the script, it should be somewhere after the viewer is created, but before the viewer is shown, like so:
<script src="http://api.viewer.zmags.com/viewer/viewer.js" type="text/javascript"></script> <script> var viewer = new com.zmags.api.Viewer(); viewer.setPublicationID("pub_id_here"); viewer.addContext(com.zmags.api.Viewer.Context.CUSTOM_CHANNEL, "channel_name_here"); viewer.setParentElementID("myViewerContent"); viewer.show(); </script> <div id="myViewerContent" style="width:800px; height:600px;"></div>
Once that's done, you will need to create a corresponding entry in the Preferred Viewer settings for your publication:
1) Log into the Zmags Publicator and click "All Publications" on the left.
2) Find your publication in the list and click on its name.
3) Click on the "Preferred Viewers" tab at the top.
4) Click "Add a Context".
5) Type a name, choose a device and 'Custom' for the channel.
6) For "Custom Channel" type the channel name you selected earlier.
7) Choose a viewer to be loaded in this context.
8) Click 'Save'.
Your selected viewer will then be loaded for visitors to any pages in which your custom channel is specified by the API code.
Comments
0 comments
Please sign in to leave a comment.