json – Bannernow Tutorials https://bannernow.com/tutorials Bannernow Tutorials Wed, 19 Feb 2025 23:35:01 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.2 https://bannernow.com/tutorials/wp-content/uploads/favicon-bn-32x32.png json – Bannernow Tutorials https://bannernow.com/tutorials 32 32 Create and use Dynamic Feeds https://bannernow.com/tutorials/feeds/ Tue, 06 Mar 2018 19:02:46 +0000 http://help.bannernow.com.www629.your-server.de/?p=285 Feeds and click on the Add a New Feed button. From Select Data Source dialog select JSON. Fill […]]]> How to add a feed (dynamic data) to the banners.

Before you can create a feeded banner, you need to create a new feed, which will be used in your bannersets.

Learn how to do this:

Go to the Data > Feeds and click on the Add a New Feed button.

From Select Data Source dialog select JSON.

Fill in all the required input fields:

  1. In the “FEED NAME” input the feed’s title.
  2. In the “FEED URL” input the feed’s URL (XML or JSON). You”l also be able to use a Google Spreadsheet as a feed source.
  3. In the “MAX ROWS” input the limit number of max results/rows.
  4. Select the “UPDATE INTERVAL” – an interval that represents how often new data is fetched.
  5. Click the Proceed to fields selection, to go to the next step.

 After your feed was parsed, select the data that can be accessed from inside the banner:

  • Check the required fields in the left tree panel.
  • The fields that you have selected will appear in the central panel (Selected Fields).
  • You can use the jsonPath formula (read the documentation) if you need to select some specific data or to convert it into a different format (you can also contact us, we will gladly assist you with this). In this tutorial, we have used the UCASE({$[*].name}) formula to convert the name fields to uppercase strings. For the price_usd field we are using the NUMBER({$[*].price_usd}, ‘$0,0.00’) formula to display the price in the right format.
  • You can also create a custom field manually by clicking the +Add Custom Field button.
  • For the “img” custom field we will create a formula to help us to create a URL path to the image from the feed: ‘https://bannernow.com/demo/’+{$[*].id}+’.svg‘.
  • Within the right panel, you’ll view the results accessible in your banners.

Use Filters:

Click the “Add New Filter” button.

You can manipulate the feed results using the following filter types: Include, Exclude, Replace, Sort, Prioritize, Remove Duplicates, URL Fallback

Here is an example:

  1. Input filter title.
  2. Select the Sort filter.
  3. Select the filtering to sort by price.
  4. Field type (string, number, date).
  5. Operator (descending price).

Click the “Update/Create Feed” to save it.

Create a new bannerset.

When creating a bannerset, input the title and select the feed source from the dropdown menu. After that, click the create button.

Create a new banner.

You can use a different feed for the translated banners within the same bannerset:

  • Click the Settings button in the translation modal
  • Select a different feed from the dropdown
  • Click the Update button

After adding the feed to your bannerset you can create a new banner (or edit an existing one). To add a feeded source to the item inside the banner, do the following:

  • Select the each item
  • Click on the green Feed button

Select the field that you want to display. The fixed row slider can be used in case you need to display the data from a specific row only. Click Save  to apply the feed to the item.

It’s also possible to connect the URL from the feed to the banner hyperlinks. To do this, go to canvas settings and set the feeded hyperlink to the whole banner or select an item and enable Hyperlink for it.

Select the field that contains the URL data format and click Save to apply the changes.

Save your banner and click Preview. You will notice that on each loop, the banner is taking the new data from the next row within the feed.

Now, you’re able to publish the banner to the ad network. When the feed data is updated, your banner will always display fresh data.

Showcase Example https://bannernow.com/html5-banner-examples

]]>
Feed Functions / JsonPath https://bannernow.com/tutorials/feed-functions/ https://bannernow.com/tutorials/feed-functions/#respond Sat, 10 Feb 2018 19:25:00 +0000 http://help.bannernow.com.www629.your-server.de/?p=14 Bannernow supports both XML and JSON dynamic feeds

XML feeds are automatically converted to JSON format within Bannernow. You can use the default JSON path to extract data from your feed easily.

JSONPath is a special language for extracting data from XML or JSON feeds.

JSONPath uses special notation to represent nodes and their connections to adjacent nodes in a JsonPath path. There are two styles of notation, namely dot and bracket.

Both of the following paths refer to the same node from the above JSON document, which is the third element within the books field of store node under the root node.

With dot notation

$.store.books[2]

With bracket notation:

$[‘store‘][‘books‘][2]

Operators:

We have several helpful operators in JsonPath:

Root node ($): This symbol denotes the root member of a JSON structure no matter it is an object or array. Its usage examples were included in the previous sub-section.

Current node (@): Represents the node that is being processed, mostly used as part of input expressions for predicates. Suppose we are dealing with book array in the above JSON document, the expression book[?(@.price == 49.99)] refers to the first book in that array.

Wildcard (*): Expresses all elements within the specified scope. For instance, book[*] indicates all nodes inside a book array.

Let’s practice JSONPath expressions by some more examples. We start with a simple JSON structure:

{ "store": {
    "date": "Feb 9 2017",
    "book": [
      { "category": "reference",
        "author": "Nigel Rees",
        "title": "Sayings of the Century",
        "price": 8
      },
      { "category": "fiction",
        "author": "Evelyn Waugh",
        "title": "Sword of Honor",
        "price": 12
      },
      { "category": "fiction",
        "author": "Herman Melville",
        "title": "Moby Dick",
        "isbn": "0-553-21311-3",
        "price": 8
      },
      { "category": "fiction",
        "author": "J. R. R. Tolkien",
        "title": "The Lord of the Rings",
        "isbn": "0-395-19395-8",
        "price": 12
      }
    ],
    "bicycle": {
      "title": " Cool Bicycle ",
      "color": "Red",
      "price": "19.95",
      "oprice": 19.5,
      "rating": -10
    }
  }
}

 

JSONPathResult
$.store.book[*].authorthe authors of all books in the store
$..authorall authors
$.store.*all things in store, which are some books and a red bicycle.
$.store..pricethe price of everything in the store.
$..book[2]the third book
$..book[(@.length-1)]
$..book[-1:]
the last book in order.
$..book[0,1]
$..book[:2]
the first two books
$..book[?(@.isbn)]filter all books with isbn number
$..book[?(@.price<10)]filter all books cheapier than 10
$..*All members of JSON structure.

Functions:

Here’s a list of functions that can be applied to the feed in order to modify the output value. All functions can be combined (for example function 1 result + function 2 result).

Numeric Functions:

*Always use “{ }” for retrieving the value from feed

Function Before After
ABS({$.store.bicycle.rating}) -1010
FLOOR({$.store.bicycle.price}) 19.519
CEIL({$.store.bicycle.oprice}) 19.520
ROUND({$.store.bicycle.price}) 19.9520
ADD({$.store.bicycle.price}, 1, 3, 6) 19.9529.95
SUB({$.store.bicycle.price}, 1, 3, 6) 19.959.95
MUL({$.store.bicycle.price}, 2) 19.9539.9
DIV({$.store.bicycle.price}, 5) 19.953.99
MOD({$.store.bicycle.price}, 3) 19.951.95
NUMBER({$.store.bicycle.price}) "19.95"19.95
NUMBER(974) 974974
NUMBER(0.12345) 0.123450.12345
NUMBER('10,000.12') '10,000.12'10000.12
NUMBER('23rd') '23rd'23
NUMBER('$10,000.00') '$10,000.00'10000
NUMBER('100B') '100B'100
NUMBER('3.467TB') '3.467TB'3467000000000
NUMBER('-76%') '-76%'-0.76
NUMBER('2:23:57') '2:23:57'NaN

String Functions:

Function Before After
LCASE({$.store.bicycle.color}) Redred
UCASE({$.store.bicycle.color}) RedRED
FCASE({$.store.bicycle.title}) Cool BicycleCool bicycle
SCASE('cool bicycle. cool bicycle.') cool bicycle. cool bicycle.Cool bicycle. Cool bicycle.
WCASE({$.store.bicycle.title}) Cool BicycleCool Bicycle
CCASE({$.store.bicycle.title}) Cool Bicyclecool Bicycle
REPLACE({$.store.bicycle.title}, 'Cool', 'Best') Cool BicycleBest Bicycle
TRIM({$.store.bicycle.title}) " Cool Bicycle ""Cool Bicycle"
SPLIT({$.store.bicycle.title}, ' ') " Cool Bicycle "[ "", "Cool", "Bicycle", "" ]

Array Functions:

Use “{{ }}” instead of “{ }” to retrieve the whole Array/List

*For XML feeds only: use ARRAY() function to convert XML lists with one item to array (by default one item will be converted to a property)

Function Before After
WHERE({{$.store.book[*]}}, '_price', '=', '12')[0]._title 8,12,8,12Sword of Honor
AVG({{$.store.book[*]}}, '_price') 8,12,8,1210
MIN({{$.store.book[*]}}, '_price')[0] 8,12,8,128
MAX({{$.store.book[*]}}, '_price')[0] 8,12,8,1212
SUM({{$.store.book[*]}}, '_price') 8,12,8,1240
COUNT({{$.store.book[*]}}, '_price') 8,12,8,124
JOIN({{$.store.book[*]}}, '_price', '--') 8,12,8,128--12--8--12--10
DISTINCT({{$.store.book[*]}}, '_price') 8,12,8,128,12

Currency Conversion Functions:

Currency rates are pulled in realtime from http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml

Function Before After
CURRENCY({$.store.bicycle.price},'USD','EUR') 19.9518.57

Number Formatting Functions:

FunctionBeforeAfter
NUMBER(10000, '0,0.0000')1000010,000.0000
NUMBER(10000.23, '0,0')10000.2310,000
NUMBER(10000.23, '+0,0')10000.23+10,000
NUMBER(-10000, '0,0.0')-10000-10,000.0
NUMBER(10000.1234, '0.000')10000.123410000.123
NUMBER(100.1234, '00000')100.123400100
NUMBER(1000.1234, '000000,0')1000.1234001,000
NUMBER(10, '000.00')10010.00
NUMBER(10000.1234, '0[.]00000')10000.123410000.12340
NUMBER(-10000, '(0,0.0000)')-10000(10,000.0000)
NUMBER(-0.23, '.00')-0.23-.23
NUMBER(-0.23, '(.00)')-0.23(.23)
NUMBER(0.23, '0.00000')0.230.23000
NUMBER(0.23, '0.0[0000]')0.230.23
NUMBER(1230974, '0.0a')12309741.2m
NUMBER(1460, '0 a')14601 k
NUMBER(-104000, '0a')-104000-104k
NUMBER(1, '0o')11st
NUMBER(100, '0o')100100th
FRACTION(0.25)0.251/4

Currency Formatting Functions:

FunctionBeforeAfter
NUMBER(1000.234, '$0,0.00')1000.234$1,000.23
NUMBER(1000.2, '0,0[.]00 $')1000.21,000.20 $
NUMBER(1001, '$ 0,0[.]00')1001$ 1,001
NUMBER(-1000.234, '($0,0)')-1000.234($1,000)
NUMBER(-1000.234, '$0.00')-1000.234-$1000.23
NUMBER(1230974, '($ 0.00 a)')1230974$ 1.23 m

Percentage Formatting Functions:

FunctionBeforeAfter
NUMBER(1, '0%')1100%
NUMBER(0.974878234, '0.000%')0.97487823497.488%
NUMBER(-0.43, '0 %')-0.43-43 %
NUMBER(0.43, '(0.000 %)')0.4343.000 %

Time Formatting Functions:

FunctionBeforeAfter
NUMBER(25, '00:00:00')250:00:25
NUMBER(238, '00:00:00')2380:03:58
NUMBER(63846, '00:00:00')6384617:44:06

Date Formatting Functions:

FunctionBeforeAfter
DATE({$.store.date}, 'UTC:h:MM:ss TT Z')Feb 9 201711:00:00 PM UTC
DATE({$.store.date}, 'fullDate')Feb 9 2017Thursday, February 9, 2017
DATE({$.store.date}, 'fullDate', 'ru')Feb 9 2017четверг, февраля 9, 2017

Named Date Formats

*Need to be passed as a second argument to DATE(…, format name):

NameMaskExample
defaultddd mmm dd yyyy HH:MM:ssSat Jun 09 2007 17:46:21
shortDatem/d/yy6/9/07
mediumDatemmm d, yyyyJun 9, 2007
longDatemmmm d, yyyyJune 9, 2007
fullDatedddd, mmmm d, yyyySaturday, June 9, 2007
shortTimeh:MM TT5:46 PM
mediumTimeh:MM:ss TT5:46:21 PM
longTimeh:MM:ss TT Z5:46:21 PM EST
isoDateyyyy-mm-dd2007-06-09
isoTimeHH:MM:ss17:46:21
isoDateTimeyyyy-mm-dd'T'HH:MM:ss2007-06-09T17:46:21
isoUtcDateTimeUTC:yyyy-mm-dd'T'HH:MM:ss'Z'2007-06-09T22:46:21Z

Date Format Mask

*Can be combined to any format (for example HH:MM:ss)

MaskDescription
dDay of the month as digits; no leading zero for single-digit days.
ddDay of the month as digits; leading zero for single-digit days.
dddDay of the week as a three-letter abbreviation.
ddddDay of the week as its full name.
mMonth as digits; no leading zero for single-digit months.
mmMonth as digits; leading zero for single-digit months.
mmmMonth as a three-letter abbreviation.
mmmmMonth as its full name.
yyYear as last two digits; leading zero for years less than 10.
yyyyYear represented by four digits.
hHours; no leading zero for single-digit hours (12-hour clock).
hhHours; leading zero for single-digit hours (12-hour clock).
HHours; no leading zero for single-digit hours (24-hour clock).
HHHours; leading zero for single-digit hours (24-hour clock).
MMinutes; no leading zero for single-digit minutes.
MMMinutes; leading zero for single-digit minutes.
NISO 8601 numeric representation of the day of the week.
oGMT/UTC timezone offset, e.g. -0500 or +0230.
sSeconds; no leading zero for single-digit seconds.
ssSeconds; leading zero for single-digit seconds.
SThe date's ordinal suffix (st, nd, rd, or th). Works well with d.
lMilliseconds; gives 3 digits.
LMilliseconds; gives 2 digits.
tLowercase, single-character time marker string: a or p.
ttLowercase, two-character time marker string: am or pm.
TUppercase, single-character time marker string: A or P.
TTUppercase, two-character time marker string: AM or PM.
WISO 8601 week number of the year, e.g. 42
ZUS timezone abbreviation, e.g. EST or MDT. With non-US timezones or in the
'...', "..."Literal character sequence. Surrounding quotes are removed.
UTC:Must be the first four characters of the mask.
Converts the date from local time to UTC/GMT/Zulu
time before applying the mask. The "UTC:"
prefix is removed.

Image Fallback

replace broken URLs with a fallback URL

FUNCTIONBEFOREAFTER
URL_FALLBACK({$.store.image_url}, 'https://example.com/fallback_image.png')https://example.com /broken_image.pnghttps://example.com /fallback_image.png

]]>
https://bannernow.com/tutorials/feed-functions/feed/ 0