Article Widgets for publishers - JavaScript integration guide

Page created by Timothy Johnston
 
CONTINUE READING
Article Widgets for publishers - JavaScript integration guide
Article Widgets for publishers
                                                                 JavaScript integration guide

Article Widgets for publishers | JavaScript integration guide | plista GmbH, Torstraße 33 - 35, 10119 Berlin | www.plista.com
Article Widgets for publishers - JavaScript integration guide
The use of plista Article Widgets for publishers is based on the integrati-
         on of a small piece of JavaScript into the HTML code of your website.
         This document will guide you through the neccessary steps of the setup.

         Our script mainly consists of two different function calls:

         1. PLISTA.items.push({ ... })

         This function is used to send article data to plista. In the following, you will learn how to correctly fill in the data that is to be sent. Usually a
         dynamic scripting language, such as PHP, is used to achieve this. Content Management Systems often provide the neccessary variables, too.
         Please continue to the next page for more information.

         2. PLISTA.partner.init()

         The second function initializes and displays the Article Widget. Depending on whether the list of recommendations is to be placed below an
         article on a detail page or on an overview page (e.g. your startpage or category landing page), it is neccessay to include the corresponding
         DIV-containers in the code - thus ensuring that the right widget design will be returned.

Article Widgets for publishers | JavaScript integration guide | plista GmbH, Torstraße 33 - 35, 10119 Berlin | www.plista.com
Article Widgets for publishers - JavaScript integration guide
Integration tips                                                                                              "Recommendations, please!"
                                                                                                                  The PLISTA.parter.init()-call causes the recommendations to be displayed. Please
                                                                        note that the plista script needs to be placed after the "plista_widget_standard_1-
                                                                     respectively the plista_widget_belowArticle-DIV container in your HTML code
                                                                                                                  (see our example on the left).
                                                                                                           Depending on whether you are integrating the script on a start-, overview- or
     
                                                                                                                  detail page (e.g. article page), you only need to include one of the DIV containers
     /*  */
                                                                                                         as „$title“ or „$text“ (please refer to the exmple code on the left).In most cases, the
                                                                                                                  completed section of the code will look similar to this:

                                                                                                                     objec tid: "",
                                                                                                                     title: "",
                                                                                                                     tex t: "",
                                                                                                                     url: "",
                                                                                                                     img: "",
                                                                                                                     c ategor y: "",
                                                                                                                     created_at: ""

                                                                                                                  Please note the hints on the following page!

Article Widgets for publishers | JavaScript integration guide | plista GmbH, Torstraße 33 - 35, 10119 Berlin | www.plista.com
Article Widgets for publishers - JavaScript integration guide
Overview of the different data fields
          What data needs to be sent to plista, using the different JavaScript fields?

              objectid The object-ID should be an alphanumeric code (a-z|0-9), furthermore it has to be unique for every recommendation, since plista is using it for the
                             distinction of different recommendations. If your website is using a database, it is probably the easiest way to use the database ID of your articles.
                             Alternatively, you can use any other unique combination of characters. Maximum length: 128 characters

                    title Use this field to send plista the title of your article (please note: an article can also be a product, if your website is an online shop or any other kind of
                             catalogue)! If your text contains double-quotes, you have to escape them by preceding them with a backslash: \“ instead of “. Guaranteed 60 signs -
                             max. 255.

                    text Any special characters that your test might contain should be sent in clear format, instead of HTML entities. Again, if your text contains double-
                             quotes, you have to escape them by preceding them with a backslash: \“ instead of “. Please note that this piece of text is meant to be an introduction
                             only and might be cut and succeded by a trailing „...“, depending on the given widget that is displaying your recommendation. Maximum length: 255
                             characters (up to 100 characters are guaranteed to be displayed).

                      url Please send the URL of your article using this field. The URL must include your domain name and start with the protocol, e.g. http://. Maximum length:
                             255 characters.

                    img If your articles have an image and/or you would like to add an image to your plista recommendation as well, you can fill in the image URL here. The
                             thumbnails should be cubic and no larger than 150x150 pixels, unless you are using larger thumbnails on your site already. You can leave out this line
                             if you do not intend to add images to your recommendations.

             category The category of current article: If there is no category, leave it empty please.

          created_at Please make sure, that you transfer the creation date of the article as a unix timestamp, so that we can consider the creation date for our recommen-
                             dations.

                                  The above mentioned fields are the most important ones. As we create individual JavaScripts for each of our partners
                                   to integrate plista as tight into each website as possible, the list of fields in your exact copy of our script might vary.

Article Widgets for publishers | JavaScript integration guide | plista GmbH, Torstraße 33 - 35, 10119 Berlin | www.plista.com
FAQ
         What do I need to look at while editing the JavaScript?
            • Since the fields within our script are an enumeration, it is important to omit the comma at the end of the last line, i.e. before the closing brackets if the PLISTA.items.
              push() call.
            • case any of the texts you send to plista is containing double quotes, they need to be preceded by a blackslash, i.e. they need to be escaped: \“ instead of “
              In
            • Please avoid linebreaks in the texts you send to plista.
            • For a php-based CMS use json_encode to fill in the variables into the push-method:
                           echo json_encode(array(
                            'objectid' => $article_id,
                            'title' => $title,
                            'text' => $article_text,
                            'url' => $article_url,
                            'img' => $article_image_url,
                            'category' => $article_category,
                            'created_at' => $article_created_at
                           ));

            Thereby possible mistakes will be avoided.

         How can I remove an article from plista‘s database?
         Removing an article from the plista database can easily be achieved through a simple HTTP-request. Please contact us for further information on this. Refer to the end of this
         document for contact information.

         Where do I find usage statistics for my plista integration?
         Usage statistics can be found at http://plista.com. In case you have any further questions, please contact us.

         Where can I find additional information on HTML and JavaScript?
         SelfHTML is a free and exhaustive compendium for HTML, JavaScript and CSS: http://de.selfhtml.org/.

Article Widgets for publishers | JavaScript integration guide | plista GmbH, Torstraße 33 - 35, 10119 Berlin | www.plista.com
How Article Widgets look like?
                                                                                                            Example-Widget

                 This may also interest you

                 Erin O'Connor: From supermodel to role model
                 She's been the face of Versace, Dior, Armani and Gaultier - and after
                 16 years commanding catwalks around the globe, the porcelain-
                 skinned belle is still at the very top of her profession... more

                 Singapore's best gourmet restaurant
                 Known for creatively combining ingredients and cooking techniques,
                 ex-lawyer-turned-chef-restaurateur Michael Han always springs a few
                 surprises on his guests... more

                                                                                                                                Description of key elements
                 It only looks impulsive
                 Bells and whistles, standard. The Jetta comes surprisingly well equip-                                           Image (optional)
                 ped, even at its most accessible level. Its sophisticated new design is
                 sportier and more aggressive than... more
                                                                                        Ad                                        "Advertisement" incl. Icon

                                                                                                                                  Background (highlighted lightly)
                 Back to the drawing board
                 For Hirst, whose controversial art works sometimes involve preser-                                               Link (open in new window)
                 ving dead animals in formaldehyde, the fact that "it's been a lot more
                 difficult to make a sale" recently isn't necessarily... more

Article Widgets for publishers | JavaScript integration guide | plista GmbH, Torstraße 33 - 35, 10119 Berlin | www.plista.com
Please contact our support if you have any further questions:

                                                                                         David Guerra
                                                                                International Business Manager

                                                                                        Tel: +49 (0) 30 4737537-27
                                                                                        Fax: +49 (0) 30 4849844-11

                                                                                        david.guerra@plista.com

Article Widgets for publishers | JavaScript integration guide | plista GmbH, Torstraße 33 - 35, 10119 Berlin | www.plista.com
You can also read