Turn new spreadsheet rows into tracked Bitly links and QR codes

By General Input

Add a destination link to your campaign sheet and get a tagged short link, a QR code, and the creation date written back into the same row.

Integrations

  • Bitly
  • Google Sheets

Type

Deterministic Code

Categories

  • Marketing
  • Operations

Build me a workflow that turns each new row in my campaign links spreadsheet into a tracked Bitly short link, plus a QR code when the row asks for one, and writes the results back into that same row.

Trigger on a new Google Sheets row in my campaign links spreadsheet using a poll trigger. When a row fires, use the Google Sheets "Get Values" operation to read that row so I have every column: the destination URL, the campaign source, the campaign medium, the campaign name, an optional custom back half, an optional comma separated list of tags, and an optional QR code tick box.

Assemble the tracking URL first. Append the campaign columns onto the destination URL as UTM parameters (utm_source, utm_medium, utm_campaign), URL encoding each value and preserving any query string the destination URL already carries, so an existing question mark becomes an ampersand. Skip any UTM parameter whose column is empty rather than writing an empty value.

Then call the Bitly "Create a Bitlink" operation with the assembled URL. Set the link title from the campaign name, falling back to the source and medium when the campaign name is blank, and pass the campaign name together with anything in the tags column as the bitlink's tags, so every link for a campaign is grouped in Bitly reporting.

If the row supplies a custom back half, follow up with the Bitly "Add Custom Bitlink" operation to assign that keyword to the new bitlink. Custom back halves require a paid Bitly plan and return a 403 on free accounts, so treat this step as optional: log the failure, keep the standard short link, and carry on with the rest of the row instead of aborting it.

If the QR column is ticked, call the Bitly "Create a QR Code" operation for the new bitlink. Use the full featured trackable QR code operation rather than the static variant, so scans are counted in Bitly analytics, and keep the image URL it returns.

Finish with the Google Sheets "Update Values" operation to write back into the same row: the short link, the QR code image URL when one was created, and a creation timestamp in ISO 8601. Write only those specific cells so nothing else in the row is overwritten, and keep the spreadsheet as the single source of truth for the campaign.

Handle the edges. Skip any row that already has a short link so a re-run never creates a duplicate bitlink. Skip rows with a blank or malformed destination URL. If "Create a Bitlink" itself fails, write the error message into the short link column so I can see at a glance which rows need attention.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentLocal listing health board for every location you manageLet support send one-off Loops emails without an engineerStop cold emails to anyone with a live deal in PipedriveiMessage campaign console with pre-flight checks and delivery boardLinkedIn Ads budget pacing dashboard for every client accountFront desk appointment confirmation board for the next 3 daysGive your team Looker numbers without buying more seatsBuild audience segments from product usage and push to LoopsTurn the people who engage with your posts into Pipedrive leads