CuteOn.Me Sample Application

CuteOn.Me is a simple app to solicit shopping advice from your friends. It was built using the APIs. No database required!

Try It Now! Download Source on GitHub

How It Works

CuteOn.Me is a web application designed for the simple task of capturing friends' advice about something you're thinking about buying. Using the APIs, you can accomplish this with a few tasks:

  • Create unique links to send to each friend
  • Update links with post-share information
  • Redirect friends to a voting page
  • Capture their votes
  • Display how your friends voted

Create links to share

Let's first look at how you create a single link and then how you can optimize your API calls using the batch create endpoint.

To capture each friend's opinion, we need a way to differentiate one friend from another. To do this, we can create a unique link for each friend.

Share with metadata

For this application, the destination URL will be the webpage we want our friends to vote on. We'll also include additional information which we can utilize later:

  • url = the URL of the webpage we want our friends to vote on
  • user_id = your Twitter user ID so we can identify links you created
  • tag = the Twitter user ID of the friend we are sharing to
  • notes = the message we want to include in the Twitter direct message
  • user_id_username = your Twitter username
  • user_id_icon_url = your Twitter user icon url
  • tool = the tool used to create the link
  • channel = the social media channel the link is shared to


    "awesm_url": "http://CuteOn.Me/2W",
    "awesm_id": "CuteOn.Me_2W",
    "domain": "CuteOn.Me",
    "path": "2W",
    "created_at": "2011-09-26T23:17:47Z",
    "original_url": "",
    "redirect_url": "",
    "channel": "twitter-message",
    "service": "twitter",
    "tool": "hackdisrupttool-twitterdm",
    "application": "hackdisrupttool",
    "parent": null,
    "sharer_id": null,
    "username": "bhiles",
    "service_userid": null,
    "service_postid": null,
    "service_postid_metadata": {
        "reach": null,
        "shared_at": null
    "campaign": null,
    "campaign_metadata": {
        "description": null,
        "name": null
    "user_id": "17301118",
    "user_id_metadata": {
        "profile_url": null,
        "icon_url": null
    "tag": "190498288",
    "notes": "cute on me right?"

Create API documentation

Create multiple links at once

Instead of making an API call to create an link for each friend, we can use the batch create endpoint to return multiple links with a single API call. If our friends had user IDs 190498288 and 371635480, the API call would be:


Batch create endpoint documentation

Domain names links by default use the domain, but can be customized to use your own domain. For this application we use the domain CuteOn.Me.

Custom domain documentation

Sharing with friends

For each of your friends to see the webpage you want their advice on, you need to send each friend the link that was created specifically for them. CuteOn.Me uses Twitter direct messages for sharing. So we need to extract the link from the Create APIs response and include it in a direct message to each friend.

Updating links with data from Twitter

Some information can only be obtained after you share a link, like the exact time of when you shared or the tweet ID. links have specific fields for this kind of information. We send direct messages using the Twitter API. After you send a direct message, the API response includes metadata about the post which can be added to the link using the update endpoint.

  • service_postid = the ID of the direct message
  • service_postid_shared_at = the time the link was shared
  • service_postid_reach = how many people will see your post

Update endpoint documentation

Redirection Patterns

Your friends will receive a direct message containing an link. The default configuration for links will have it redirect to the URL specified. But, we want to display the URL and capture a vote from the friend. We can use JavaScript to capture the friend's vote, but since the URL could be anything, we won't be able to have JavaScript running on every URL. Instead, we can redirect the friend back to a page we host. Then we can display the URL using an iframe and easily run JavaScript on the page to capture the vote. has a feature called redirection patterns where any of an link's fields can be used to build the URL that a user is redirected to. Our redirect pattern needs the following logic:

  • Redirect to so we can run JavaScript on the page
  • Include fields:
    • url to view the URL in an iframe
    • awesm_id to attribute a vote to an link which has the user ID of the friend

Redirection pattern documentation

We use additional fields in the redirection pattern, so when a friend is redirected they get information about who shared the link to them and the message from the direct message.

The actual redirection pattern is:

Track votes with conversions

Once a friend follows the link they can make their voting choice. links so far have data associated with them, but when a user interacts with a link events are collected. One type of event is a click. When a user clicks on a link, captures that a click occurred. Another type of event is conversions, which allow you to capture user-defined actions. The actions we want to collect is whether a friend votes yes or no for the URL displayed. supports ten different conversion types per project, so CuteOn.Me uses the first conversion type to be a yes vote, and the second type to be for a no vote. Conversions are collected by calling the Conversions API specifying the link, the conversion type, and the value. We have a JavaScript library that takes care of the heavy lifting, so your code just needs to include the library and use a JavaScript trigger to execute.

<script src=""></script>
    function voteYes() { AWESM.convert('goal_1',0); }
    function voteNo() { AWESM.convert('goal_2',0); }

Conversion documentation


To show you what your friends voted, we need to query for your data. The Stats API allows you to query data you created and collected inside We want to group by the URLs you shared, and group again by the friends you shared with so we can see how each friend voted. This translates to a Stats API call filtered by your user_id, grouped by original_url, and then pivoted by tag. We also want to see conversion data which needs to be enabled in the call. Finally, we sort by shared_at so we can see the URL shared most recently first.


Stats API documentation

The response only shows raw data, so conversions are only displayed as having numeric values. There is no logic in the API call that says what a friend voted, instead we need to create an algorithm to transform the voting conversion data into what a friend voted. The algorithm is:

if goal_1 (yes conversion type) count > 0, then vote is a yes
else if goal_2 (no conversion type) count > 0, then vote is no
else didn't vote

The Stats API call allows us to populate the majority of the dashboard. We can iterate over each URL that was shared, find each of the friends the URL was shared to, and calculate each friends' vote. To make the dashboard more helpful we include additional data. The title of the URL is displayed to allow for a human readable value for the URL. Also, the message that was sent along with the link is displayed. All of this collected using Stats API calls.

Bonus Features

In the CuteOn.Me GitHub repository, there are two branches. The live site uses the performance branch, which contains additional features like the Google Chrome extension, Embedly item previews, and asynchronous Twitter friend lists. As these features complicate the code, we recommend reviewing the master branch first.

Last updated 2012-05-14