Barcode
Overview
MailUp gives you the ability to dynamically generate a barcode, linked to a recipient field. This feature comes in handy in many scenarios, such as when needing to insert a unique discount or promotion code in an email campaign.
The frontend page mentioned below (barcode.aspx) will render and print out a barcode image, starting from a numeric/alphanumeric sequence dynamically retrieved from a recipient field.
The system passes two unique values to the page ("IdOptin" and "Hash") in order to avoid fraudulent use of the feature.
Notes
- This section of the User Guide requires some basic knowledge of HTML.
- When viewed in the message editor in the admin console, the barcode will be displayed using a default value.
How it works
The feature works as follows:
- A special image URL is generated as shown below
- The image URL (i.e. the HTTP location of the image) is included in the src property of the image HTML tag.
How to create a barcode
- check that the symbology of your barcode is supported by the symbology used: see Table 2 or use this link to perform a rendering test https://www.limilabs.com/barcode/demo
- if not already done, import the alphanumeric value to be encoded by the barcode into the platform recipients fields
- generate the URL, as explained below
Base URL
http://<consoleurl>/frontend/Barcode.aspx
URL completed with parameters
<img src=http://<ConsoleHost>/frontend/Barcode.aspx?idoptin=[_idoptin]&hash=[_hash]&BarcodeHeight=60&SymbologyId=14&NarrowBarWidth=2&bearerbarsmode=0&BitmapTargetFormat=1&Ratio=0&TargetDynField=PromoID&FontHeight=0,2 />
Note:
- See the section at the bottom of this document for a list and description of the various parameters
- The recipient field used in the example above is PromoID: it must be a numeric value (for symbology 14 in the above snippet you can fill it using any number of even length)
- Don't' forget to replace <consolehost> with the actual domain of your admin console
- The above sample requests an i2of5 formatted barcode ( SymbologyId = 14 ), sets the height to 60 pixels with 0,2 points font. Each symbology has its own specific set of requirements ( starting from the length of the numeric sequence it will be built on )
Output sample
Below a sample of Interleaved 2 of 5 rendered from a 14 digits sequence
How to build your Barcode URL
The system does not yet include a feature to build the URL for you, so for now you need to build it yourself. Don't panic, though, it only takes a minute
Here are the steps to take:
- Open your text editor: we recommend Notepad++, but Windows Notepad will be fine too.
- Paste in the editable window the following snippet:
http://<ConsoleHost>/frontend/Barcode.aspx?idoptin=[_idoptin]&hash=[_hash]&BarcodeHeight=60&SymbologyId=14&NarrowBarWidth=2&bearerbarsmode=0&BitmapTargetFormat=1&Ratio=0&TargetDynField=PromoID&FontHeight=0,2
- Replace the parts of the query string marked in red with your account-specific information:
- Replace <consolehost> with your admin console URL
- Replace LatestShippedOrderId with the recipient field you've chosen to hold (and filled in with) the barcode numeric number.
- Select it (CTRL + A) and copy it to clipboard (CTRL +C)
- Now open your web browser and log into your admin console
- Click on Messages > Email > New > Create New Email or edit an existing message.
- In the message editor, switch to HTML mode
- Write a plain and empty HTML Img tag such as <img src="" /> in the writable area of the editor as below
- Enter the URL you copied above into the src tag. For example, assuming your admin console URL were http://c9x8d.s56.it/ and that the recipient field you are using to store the unique number to use in the barcode is called PromoID, the code would look as follows:
<img src="http://c9x8d.s56.it/frontend/Barcode.aspx?idoptin=[_idoptin]&hash=[_hash]&BarcodeHeight=60&SymbologyId=14&NarrowBarWidth=2&bearerbarsmode=0&BitmapTargetFormat=1&Ratio=0&TargetDynField=PromoID&FontHeight=0,2" />
- Click on Save. Now you should be seeing the barcode rendered in the preview window as shown below
Troubleshooting
- Barcode rendering fails: the application may receive a wrong sequence format against a certain symbology: the application won't display any error message but it will display instead an empty 1x1 pixel image so that the calling image won't appear as broken
Parameters
Request parameters (Table 1)
Here is a description of the parameters mentioned in the barcode
Name | Mandatory? | Description |
---|---|---|
IdOptIn | y | Recipient User Id |
Hash | y | Recipient hash unique value |
BarcodeHeight | y | Barcode image height in pixels |
SymbologyId | y | Id representing a certain barcode format ( 14 = ITF ) |
TargetDynField | y | The dynamic field containing the numeric barcode sequence |
NarrowBarWidth | n | Width in pixel of the narrow bar |
BearerBarsmode | n | It sets what bearers bars the barcode will display ( 0 = None, 1 = Horizontal, 2 = Full ) |
BearerBarsSize | n | Width in pixels of the bearers bars ( applies only if BearerBarsmode > 0 ) |
Ratio | n | The times the wide bar will be displayed for each narrow bar |
ChecksumAdd | n | This Boolean defines if the numeric sequence needs to be completed with a computed check digit ( default is false ) |
IsNumberVisible | n | If true, it displays the input numeric sequence underneath the barcode |
FontHeight | n | Font height in points, use a comma as decimal mark |
Symbology format Id reference (Table 2)
Symbology codes define what type of barcode is being created and therefore also the values โโthat can be encoded.
SymbologyId | Symbology name | Description | Example |
---|---|---|---|
1 | Codabar | Valid characters are: '0123456789-$:/.+ABCD'. The number should start and stop with one of the 'ABCD' characters. | A1234567890A |
2 | Code11 | Valid characters are: '0123456789-'. | 1234567890 |
3 | Code128 | Use GS1-128 (UCC/EAN-128) symbology if you plan to use, application identifiers such as '(10)1234(01)56789'. | Hello 123 |
4 | Code39 | Valid characters are capital letters and numbers. Start and stop characters ('*') are added automatically. | HELLO 123 |
5 | Code39Ext | Start and stop characters ('*') are added automatically. | Hello 123 |
6 | Code93 | Valid characters are capital letters and numbers. Start and stop characters ('*') are added automatically. | HELLO 123 |
7 | Code93Ext | Start and stop characters ('*') are added automatically. | Hello 123 |
8 | Deutsche Post Ident Code | 11 digits + checksum | 12345678901 |
9 | Deutsche Post Leit Code | 13 digits + checksum | 1234567890123 |
10 | Ean218 | Use the following format: (ai)data, for example: '(10)1234(01)56789'. | (10)1234(01)56789 |
11 | Ean13 | 12 digits + checksum, Use the following format to add supplement: '123456789012,34'. | 123456789012,34 |
12 | Ean14 | 13 digits + checksum | 1234567890123 |
13 | Ean8 | 7 digits + checksum | 1234567 |
14 | Interleaved 2 of 5 | Valid characters are: '0123456789', length (including checksum) must be even. | 123456789 |
15 | ITF14 | 13 digits long + checksum | 1234567890123 |
16 | Msi | Valid characters are: '0123456789' | 1234567890 |
17 | Numly | 19 digits | 1234567890123456789 |
18 | Opc | 9 digits + checksum | 123456789 |
19 | Planet | Valid characters are: '0123456789' | 1234567890 |
20 | Postnet | Valid characters are: '0123456789' | 1234567890 |
21 | Pzn | 6 digits + checksum | 123456 |
22 | Royal Mail 4 state | Valid characters are capital letters and numbers. | 1234567890 |
23 | Royal Tnt Post Kix | Valid characters are capital letters and numbers. | 1234567890 |
24 | Industrial 2 of 5 | Valid characters are: '0123456789' | 1234567890 |
25 | Singapore post 4 State | Valid characters are capital letters and numbers. | 1234567890 |
26 | SSCC18 | 17 digits long + checksum | 12345678901234567 |
27 | Swiss Post Parcel | 18 digits long | 123456789012345678 |
28 | UPCA | 11 digits + checksum | 12345678901 |
29 | UPCE | 8 digits | 12345678 |
30 | USP Sack label | 8 digits long | 12345678 |
31 | USP Tray label | 10 digits long | 1234567890 |