Appendix: Encoding

Partners wishing to pre-fill guest information will need the following information:

 

Guest data:       

  • Location ID of property visited
  • Email address (required)             
  • First name (optional)
  • Last name (optional)
  • Home city (optional)

+

Encryption key

This will be communicated over the phone by your Account Manager, or posted as a .txt file in your RCP feed, if you have one. Please note: the encryption key and the partner key are two different things.

 

The guest information is combined into a string, encrypted and passed into the widget via a data parameter in the URL.

 

This data parameter is made up of two parts.

Part 1 = MD5 hash of encryption key + string of guest data parameters (32 characters)

Part 2 = Hex encoded string of just guest data parameters (variable length depending on string size)

These two are put together back to back, into a format which is recognised by the TripAdvisor widget to pre-fill the relevant fields.

 

Parameters are case sensitive and as follows:

locationId=

email=

firstName=

lastName=

city=

 

 

Step 1 is to create the MD5 hash:

 

Before encrypting would look like this:

MySecureEncryptionKey123456789locationId=89575&email=somebody@email.com&firstName=Some&lastName=Body&city=London

Converted to MD5 hash:

2221e907db5e7a2c16a4295be666168d

 

Step 2 is to create the hex encoded string:

 

Before:

locationId=89575&email=somebody@email.com&firstName=Some&lastName=Body&city=London   

After:

6C6F636174696F6E49643D383935373526656D61696C3D736F6D65626F647940656D61696C2E636F6D2666697273744E616D653D536F6D65266C6173744E616D653D426F647926636974793D4C6F6E646F6E

Put the two parts together and append them to the widget URL, like this:

 

https://www.tripadvisor.com/WidgetEmbed-collectreview?locationId=89575&partnerId=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&display=true&allowMobile&data=2221e907db5e7a2c16a4295be666168d6C6F636174696F6E49643D383935373526656D61696C3D736F6D65626F647940656D61696C2E636F6D2666697273744E616D653D536F6D65266C6173744E616D653D426F647926636974793D4C6F6E646F6E

 

 

These are some useful tools for testing:

http://www.miraclesalad.com/webtools/md5.php

http://string-functions.com/string-hex.aspx

 

 

Note on encoding special characters

If your guest data contains any special characters, (e.g. accented letters), then these should first be URL encoded.

For example: lastName=López should be changed to lastName=L%C3%B3pez before following steps 1 and 2 above.

More info here:
http://www.w3schools.com/tags/ref_urlencode.asp

 

 

Troubleshooting

 

If you find the data does not pre-fill, please take note of the following:

 

  • Check character case of unencrypted data parameters. In particular note that locationId has lowercase “L” and capital “i”.
  • Check you have the correct encryption key – it is easy to make a mistake writing down something given over the phone. £ and # sign can sometimes cause problems!
  • Location ID needs to be the same in the visible part of the URL and in the encrypted data string
  • Make sure there are no spaces in your data string – in particular at the end of the line of text

 

If in doubt, please check with your Account Manager. When emailing to ask for help, it is vital to include the URL of the landing page and widget. Please also include any screenshots if you have them available.