Link Tracking Manager - href settings
Last updated
Last updated
When setting up custom link tracking profiles, there is a section named 'href settings'. This is where you control exactly how links will be formatted when you export your emails from Taxi. For example, you can define all the parameters you need adding to your links, have exclusions (if some links don't need tracking) or set up rules if various links need different tracking.
Taxi enables you to use liquid in the href settings to give you all the control you need.
This article explains the different ways you can use liquid when setting up your link tracking.
Whatever you input into this code field will define exactly what the links look like when you export an email out of Taxi. Typically you will start off with whatever link someone inputs to a link field in a version.
To do this you use:
#{{linkfields.original_href}}
If you have only this in the href settings, and in the version you input https://www.taxiforemail.com, in the exported HTML you will have href=“https://www.taxiforemail.com”
When tracking gets appended to a link a question mark is needed to separate the url from the tracking parameters. However, if the original url already contains a question mark an ampersand is needed to separate the url from the tracking.
To make sure the right character is used, include a custom filter in the original_href variable:
#{{linkfields.original_href | url_arg_prefix}}
This filter means, if the link contains ? then put a & at the end of the link, but if it doesn't contain ?, then add ? to the end of the link. It removes the need to manually add this in for every link in your emails.
In link tracking profiles you can create custom fields. These are used to set variables that can be used in your link tracking, such as a hardcoded value of 'email' or something that can change, such as a campaign name. Read more about these fields here.
To use this in your links, use:
#{{linkfields.name_of_custom_field}}
If the custom field is called utm_campaign you'd reference it like this:
#{{linkfields.utm_campaign}}
You can also hard code parts of the link if they are always needed in the tracking and don't need to ever change. For example, utm_campaign= is always included, but the value is set from a custom field.
#{{linkfields.original_href | url_arg_prefix}}utm_source=#{{linkfields.utm_source}}&utm_medium=#{{linkfields.utm_medium}}&utm_campaign=#{{linkfields.utm_campaign}}
Everything inside the liquid brackets #{{ }} is a variable and everything else will always be included in the link as it is.
The above example would mean that all links would have exactly the same structure of tracking without exception, but there is a lot more control we can add using various liquid functions.
All of your links may not need exactly the same tracking, or even tracking at all. You can target specific URLs or types of links to track or not track using if statements.
Here, if the link contains taxiforemail.com, then it will have tracking applied to it, but any other link won't get tracked at all. This can be useful when you have links going to external websites that aren't relevant to the traffic to your site.
#{{linkfields.original_href | url_arg_prefix}}utm_source=#{{linkfields.utm_source}}&utm_medium=#{{linkfields.utm_medium}}&utm_campaign=#{{linkfields.utm_campaign}} #{{linkfields.original_href}}
In this example, if the link in the email contains taxiforemail.com, one set of tracking parameters is used. If the link contains sparkpost.com, another set of parameters will be used. Any link that doesn't match either of these conditions will have no tracking.
#{{linkfields.original_href | url_arg_prefix}}utm_source=#{{linkfields.utm_source}}&utm_medium=#{{linkfields.utm_medium}}&utm_campaign=#{{linkfields.utm_campaign}} #{{linkfields.original_href | url_arg_prefix}}utm_source=#{{linkfields.utm_source}}&utm_medium=#{{linkfields.utm_medium}}&utm_campaign=#{{linkfields.utm_campaign}}&utm_term=#{{linkfields.utm_term}} #{{linkfields.original_href}}
Whereas the above examples enable you to target specific links to be tracked, you can also target links to not be tracked. This is often used for mailto links.
#{{linkfields.original_href}} #{{linkfields.original_href | url_arg_prefix}}utm_source=#{{linkfields.utm_source}}&utm_medium=#{{linkfields.utm_medium}}&utm_campaign=#{{linkfields.utm_campaign}}
This means if you include a mailto link in an email, this won't get tracked, but every other link will get the tracking applied.
If you use specific naming conventions for these different parts of your Taxi account, and these also need to be included in your tracking, you can reference them in link tracking profiles.
Project Group - #{{project_group.name}}
Project - #{{project.name}}
Mailing - #{{mailing.name}}
Version - #{{version.name}}
These can also be used in conditional statements if tracking changes depending on what project group the email is in for example.
Newsletter Triggers
You can also target ESP connectors in tracking profiles if you have different tracking needs for the different ESPs you use. This is often useful if you use separate ESPs for different emails, or are in the process of transitioning between two and emails could be exported to either.
There are two ways to target connectors in your account.
- Connector Type
This relates to any connector for one specific ESP. For example with this code:
You are targeting any Salesforce connector you have in your account. So anytime you export to Salesforce this tracking will be included, even if you have multiple connectors.
You can find the exact type of your connector in this article
- Connector Name
This means you can target a specific connector by using the name you give it when creating it in your account.
In this example, only the connector you have named My Salesforce connector will get this tracking. If you have another Salesforce connector with a different name, this tracking won't get applied when using that one.
This approach is also useful when the links you send to the ESP aren't valid until the email is actually sent. For example, if there are ESP personalisation tags that break the link unless it is converted to an actual value.
Using the above if statement would mean that when exporting to the ESP the link would include all the tracking needed. If this was included when sending a test from Taxi, the link could appear broken if it needs to go through the ESP first. The ESP code is only included when using the connector so when you use this liquid rule, you can test the links in Taxi too.
Salesforce is used as an example here. This approach can be used with any ESP we have a connector with.
If part of your link tracking changes depending on which part of the email the link is in, you can target the modules of your Email Design System and have different tracking per module. For example, if you have parameters that determine whether recipients click on buttons, images or text.
Use context.module.name to do this.
The name here comes from the name of the module in the Email Design System.
If you want to target a module that is outside of a modulezone, the syntax is slightly different.
Add 'modules' before the name of the module.
In your Email Design System, you can use editables to break up the editor into different sections so it is easier to navigate and use. For example, if you have a module with an image and some text, you could have an editable for the image and an editable for the text.
When you click inspect element in a version in Taxi for a specific piece of content, you will notice an attribute named 'taxi-scope'. This tells you the name of an editable that this specific piece of content is in.
For example, this tells us that the image is in an editable named ‘image’:
And this tells us that some text is inside an editable called 'headline':
In the link tracking profile we can target this taxi-scope. For example:
Most often, the first part of the liquid will be #{{linkfields.original_href}} as this is the url used in an email and it goes before any tracking.
Sometimes the url used in an email can form part of a longer url, for example when you have a different url for users opening on mobile taking them straight to an app page, not a browser.
https://taxi.onelink.me/Uy67?web_url=#{{linkfields.original_href}}&mobile_link=APP_LINK
In this example, we need https://taxi.onelink.me/Uy67?web_url= to go before the actual url of the webpage. You can include this before the #{{linkfields.original_href}} in the href settings section.
An assign tag allows you to create new liquid variables. For example, if you had a long bit of personalisation that needed to be included multiple times in your link tracking profile. Instead of typing it out every time you could create a variable using assign and then repeat the variable instead of the long personalisation string.
#{{ID}}
Anytime you use this variable, you will be using whatever value is set in the assign.
This is similar to assign but enables you to create a variable from more complex liquid, as opposed to just a static value.
For example, let's say you want to control some of the tracking based on a module that is used. You can include the logic for this inside a capture tag to create it as a variable, and then use this variable name in your link tracking.
#{{linkfields.original_href | url_arg_prefix}}utm_source=email&utm_medium=newsletter&utm_term=#{{module}}
The variable 'module' will be using the if statement in the capture. If this is needed multiple times in your link tracking it can be easier to use this approach than repeating the full if statement.
Anchor links are urls that enable you to be taken to a specific part of a web page. For example, https://www.mywebsite.com#contactus would take you to the contact us section of this page.
The hashtag and everything after it needs to go at the end of the link so the browser understands this is the part of the page you need to be taken to. If you add tracking to these links the anchor will no longer be at the end so it won't work as intended.
To ensure the tracking and the achor both work we can use the split filter. This means we can 'split' the link where there is a hashtag and put the tracking before it, so the anchor will still be at the end.
#{{split_href[0] | url_arg_prefix}}TRACKING
First, we are using an assign and the strip filter to separate the url when there is a #. Then split_href[0] is referencing everything before the #, so this goes before the tracking.
##{{ split_href[1] }} means that if there is a hashtag and something after it in the original link then this will be placed after the tracking.
If the original link was https://www.mywebsite.com#contactus it would become https://www.mywebsite.com?TRACKING#contactus
This filter can take something that has been typed or pasted into a link and replace it with another word or character. This can be a useful filter when it comes to avoiding some mistakes or errors in your links.
For example, if someone accidentally types a space into a link:
#{{linkfields.original_href | url_arg_prefix | replace: ' ', '' ”}}
This will replace any space with whatever is in the second pair of quotation marks, in this case nothing.
The strip filter could also be used in the above scenario.
If you have a complicated link tracking profile set up, it can be useful to have the liquid split onto new lines to make it easier to read. The trouble with this is that the new lines can be interpreted as a space in the links, so there could be spaces in the urls when you export from Taxi.
If you are using this approach you can use hyphens in liquid tags to stop these spaces from appearing.
…. ….