Adding URL parameters to links

Updated

Adding URL parameters to your links enables you to better track and analyze customers’ interactions with the messages you send from Customer.io. You can set up templated URL parameters and automatically add them to links in your emails.

How it works

While Customer.io supports link tracking, you might want to add URL parameters to links to track clicks from specific campaigns, messages, or other factors.

You can manually add URL parameters to links in messages, but this can be tedious and error-prone. You probably have a repeatable set of parameters that you want to use for links in different messages.

That’s where our URL parameters feature comes in. It makes it easy to automatically append a templated set of URL parameters to links in your messages. When you enable URL parameters, you’ll append them to any link use the cio_link liquidA syntax that supports variables, letting you personalize messages for your audience. For example, if you want to reference a person’s first name, you might use the variable {{customer.first_name}}. tag.

{% cio_link url:"https://example.com" %}

Enable URL parameters

Go to Workspace Settings > URL Parameters to enable and set up URL parameters. When you enable URL parameters, they’re automatically appended to any link where you use the cio_link liquid tag.

URL Paramters show as Disabled besides the title. There is a button to enable on the right.
URL Paramters show as Disabled besides the title. There is a button to enable on the right.

Default parameters

Our default URL parameters are commonly used properties in analytics platforms like Google Analytics. The values help you tie clicks back to the messages and campaigns your audience interacts with.

ParameterDefault valueDescription
utm_sourcecustomer.ioThe source of the link.
utm_medium{{message.type}}The source “medium” for the link the user clicked, like email_action.
utm_campaign{{campaign.name}}The campaign the message (and link) belonged to.
utm_content{{message.name}}The name of the message that contained the link.

 Disable campaign.name if you use URL parameters outside of campaigns

Empty liquid variables aren’t valid, if you leave the utm_campaign set to campaign.name and try to use cio_link to include URL parameters on links in a broadcast, newsletter, or transactional message, your message will fail.

Default URL parameters in action

For example, imagine you have a campaign and message with the following details.

  • Campaign name: Retention Campaign 1 [Marketing] [Internal]
  • Email name: Hello World Email

With our default URL parameters, you’d add a link like this: {% cio_link url:"https://example.com" %}.

And we automatically append the URL parameters in your rendered email, like this:

https://example.com/?utm_content=Hello+World+Email&utm_medium=email_action&utm_name=Retention+Campaign+1+%5BMarketing%5D+%5BInternal%5D&utm_source=customer.io

Using URL parameters in SMS and WhatsApp messages

URL parameters and make links significantly longer. If you use URL parameters (or Customer.io’s link tracking feature) in these kinds of messages, make sure that you enable link shortening so that your links fit in your messages.

How do I check that my URL parameters work?

In an email, you can click Review Links to see your URL parameters in action.

image.png
image.png

To add URL parameters to a link, use the cio_link tag with the url parameter.

{% cio_link url:"https://example.com" %}

Add or remove URL parameters

In your URL parameter settings, click Edit Parameters to add, remove, or edit your URL parameters. Any changes you make apply to links using the cio_link tag immediately.

image.png
image.png

 You can shorten long campaign or newsletter names

You can use the Liquid truncate filter to shorten long values in links, like this: {{ campaign.name | truncate: 15, "" }}. This example truncates your campaign name to 15 characters.

You can simply omit the cio_link tag to remove URL parameters from a link if you don’t want us to append URL parameters to a link. Or, if you want to differentiate between links that include and don’t include URL parameters, you can add the url_params:false parameter to the cio_link tag.

{% cio_link url:"https://example.com" url_params:false %}

If you use our drag-and-drop editor, you can add the disable-url-params class to any item that acts as a link—links, buttons, images, etc.

Link tracking helps you understand which links your audience clicks and the percentage of your audience that clicks each link.

URL parameters can help you track performance and engagement outside of Customer.io—in platforms like Google Analytics, for example. They also give you more control over the data you track—down to the campaign and message level.

Liquid in URL parameters

Here’s a list of common liquid values you might use in your URL parameters.

TagOutput
{{layout.id}}The numerical ID associated with the email layout you've used. **Only available for emails made with the code or rich text editors.**
{{layout.name}}The name you've assigned to the email layout you've used. **Only available for emails made with the code or rich text editors.**
{{campaign.id}}Your campaign's numerical ID. This can be found in your campaign URL. For example, the campaign ID here is 2000: https://fly2.customer.io/env/12345/v2/campaigns/2000/overview
{{campaign.name}}This tag will output the name you've given your campaign or newsletter in the Customer.io interface. For example: "Q2 Anvil Onboarding Campaign \\\\\[Coyotes]"
{{campaign.type}}This returns whether or not your campaign is behavioral (segment triggered), transactional (event triggered), or a newsletter
{{delivery_id}}A URL-compatible base64 string that identifies a specific message created for an end-user. This is generated when the message is drafted or sent but will be set to "unsent" in test messages and composer previews.
{{message.id}}The numerical ID associated with a message action in the workflow— i.e. an SMS action might have a {{message.id}} of 200 while every SMS it generates will have a different {{delivery_id}}.
{{message.name}}The name you give your message in the workflow. E.g. "Welcome to ACME!"
{{message.type}}This refers to a particular message's type. Possible values are: email_action, twilio_action, slack_action, webhook_action, attribute_update_action
{{customer.id}}Whatever you're using to uniquely identify your customer—usually numeric*.

 Your analytics provider (like Google) may prohibit you from sending personal information or have specific guidelines for tracking; make sure you’re aware of any restrictions.

Copied to clipboard!
  Contents