Append UTM tracking to URLs
I'm trying to set a custom rule within the catalog settings in Facebook's business manager, I want to append UTM tracking to my product URLs and cannot do this from a find and replace regex function. A unique identifier of my product URLs is that they always end with a number 0-9. I'm new to regex and can't figure out how to do this, example below for reference:
Existing product URL:
- https://www.example.com/product/12345
- https://www.example.com/product/54321
Appended UTM tracking:
https://www.example.com/product/12345?utm_source=askjeeves&utm_medium=cpm
https://www.example.com/product/54321?utm_source=askjeeves&utm_medium=cpm
Any help on how to write a find and replace regular expression to help me append tracking to help me achieve similar to my example above would be much appreciated!
Image below from where I am trying to input this rule:
screen grab in FB business manager catalog custom rule settings
regex
add a comment |
I'm trying to set a custom rule within the catalog settings in Facebook's business manager, I want to append UTM tracking to my product URLs and cannot do this from a find and replace regex function. A unique identifier of my product URLs is that they always end with a number 0-9. I'm new to regex and can't figure out how to do this, example below for reference:
Existing product URL:
- https://www.example.com/product/12345
- https://www.example.com/product/54321
Appended UTM tracking:
https://www.example.com/product/12345?utm_source=askjeeves&utm_medium=cpm
https://www.example.com/product/54321?utm_source=askjeeves&utm_medium=cpm
Any help on how to write a find and replace regular expression to help me append tracking to help me achieve similar to my example above would be much appreciated!
Image below from where I am trying to input this rule:
screen grab in FB business manager catalog custom rule settings
regex
What does this have to do with regex? You're just appending a string to an url.
– Poul Bak
Nov 19 '18 at 16:04
Unfortunately there isn't the option to select append from the custom rule settings in FB's business manager. There is the option to find and replace regex however, and thought there must be a way I can achieve this using this option. I've just never really used regex before.
– Jared
Nov 19 '18 at 16:22
Find(?m)$replace?utm_source=askjeeves&utm_medium=cpm
– sln
Nov 19 '18 at 18:57
add a comment |
I'm trying to set a custom rule within the catalog settings in Facebook's business manager, I want to append UTM tracking to my product URLs and cannot do this from a find and replace regex function. A unique identifier of my product URLs is that they always end with a number 0-9. I'm new to regex and can't figure out how to do this, example below for reference:
Existing product URL:
- https://www.example.com/product/12345
- https://www.example.com/product/54321
Appended UTM tracking:
https://www.example.com/product/12345?utm_source=askjeeves&utm_medium=cpm
https://www.example.com/product/54321?utm_source=askjeeves&utm_medium=cpm
Any help on how to write a find and replace regular expression to help me append tracking to help me achieve similar to my example above would be much appreciated!
Image below from where I am trying to input this rule:
screen grab in FB business manager catalog custom rule settings
regex
I'm trying to set a custom rule within the catalog settings in Facebook's business manager, I want to append UTM tracking to my product URLs and cannot do this from a find and replace regex function. A unique identifier of my product URLs is that they always end with a number 0-9. I'm new to regex and can't figure out how to do this, example below for reference:
Existing product URL:
- https://www.example.com/product/12345
- https://www.example.com/product/54321
Appended UTM tracking:
https://www.example.com/product/12345?utm_source=askjeeves&utm_medium=cpm
https://www.example.com/product/54321?utm_source=askjeeves&utm_medium=cpm
Any help on how to write a find and replace regular expression to help me append tracking to help me achieve similar to my example above would be much appreciated!
Image below from where I am trying to input this rule:
screen grab in FB business manager catalog custom rule settings
regex
regex
edited Nov 19 '18 at 16:28
Jared
asked Nov 19 '18 at 15:03
JaredJared
143
143
What does this have to do with regex? You're just appending a string to an url.
– Poul Bak
Nov 19 '18 at 16:04
Unfortunately there isn't the option to select append from the custom rule settings in FB's business manager. There is the option to find and replace regex however, and thought there must be a way I can achieve this using this option. I've just never really used regex before.
– Jared
Nov 19 '18 at 16:22
Find(?m)$replace?utm_source=askjeeves&utm_medium=cpm
– sln
Nov 19 '18 at 18:57
add a comment |
What does this have to do with regex? You're just appending a string to an url.
– Poul Bak
Nov 19 '18 at 16:04
Unfortunately there isn't the option to select append from the custom rule settings in FB's business manager. There is the option to find and replace regex however, and thought there must be a way I can achieve this using this option. I've just never really used regex before.
– Jared
Nov 19 '18 at 16:22
Find(?m)$replace?utm_source=askjeeves&utm_medium=cpm
– sln
Nov 19 '18 at 18:57
What does this have to do with regex? You're just appending a string to an url.
– Poul Bak
Nov 19 '18 at 16:04
What does this have to do with regex? You're just appending a string to an url.
– Poul Bak
Nov 19 '18 at 16:04
Unfortunately there isn't the option to select append from the custom rule settings in FB's business manager. There is the option to find and replace regex however, and thought there must be a way I can achieve this using this option. I've just never really used regex before.
– Jared
Nov 19 '18 at 16:22
Unfortunately there isn't the option to select append from the custom rule settings in FB's business manager. There is the option to find and replace regex however, and thought there must be a way I can achieve this using this option. I've just never really used regex before.
– Jared
Nov 19 '18 at 16:22
Find
(?m)$ replace ?utm_source=askjeeves&utm_medium=cpm– sln
Nov 19 '18 at 18:57
Find
(?m)$ replace ?utm_source=askjeeves&utm_medium=cpm– sln
Nov 19 '18 at 18:57
add a comment |
2 Answers
2
active
oldest
votes
You can do this on your .htaccess. Try the following code into your .htaccess file (Create one if you don't have already) and give me a feedback please.
RewriteEngine On
RewriteRule product/([0-9]+) product/$1?utm_source=askjeeves&utm_medium=cpm [L]
With this code you'll navigate to www.example.com/product/12345 but the system will see full URL which is www.example.com/product/12345?utm_source=askjeeves&utm_medium=cpm
Thank you for providing this Alexandros, unfortunately I do not have access to my company's website hosting files to try this.
– Jared
Nov 19 '18 at 16:25
Then, @Jared there is no way to do that without your system files. Otherwise this would be a big vulnerability issue
– Alexandros Bantzos
Nov 19 '18 at 16:40
add a comment |
I don't know facebook's find and replace function, but generally a regex should look like this:
(^http.*$)
Then replace with:
$1?utm_source=askjeeves&utm_medium=cpm
You can also try with:
1?utm_source=askjeeves&utm_medium=cpm
If facebook follows 'normal' regexes, this should Work.
Edit: try these things too, it might Work.
Thank you Poul - trying this and hitting preview all of the product URLs were replaced with http. However, you're on to something as this half worked. Are there any other 'normal' regexes I could try? I have 1000s of product URLs that will end in a digit, appending/replacing my tracking without disrupting the original part of URL is what I am trying to achieve
– Jared
Nov 19 '18 at 16:45
That worked - legend! Thanks Poul!
– Jared
Nov 19 '18 at 16:51
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377376%2fappend-utm-tracking-to-urls%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can do this on your .htaccess. Try the following code into your .htaccess file (Create one if you don't have already) and give me a feedback please.
RewriteEngine On
RewriteRule product/([0-9]+) product/$1?utm_source=askjeeves&utm_medium=cpm [L]
With this code you'll navigate to www.example.com/product/12345 but the system will see full URL which is www.example.com/product/12345?utm_source=askjeeves&utm_medium=cpm
Thank you for providing this Alexandros, unfortunately I do not have access to my company's website hosting files to try this.
– Jared
Nov 19 '18 at 16:25
Then, @Jared there is no way to do that without your system files. Otherwise this would be a big vulnerability issue
– Alexandros Bantzos
Nov 19 '18 at 16:40
add a comment |
You can do this on your .htaccess. Try the following code into your .htaccess file (Create one if you don't have already) and give me a feedback please.
RewriteEngine On
RewriteRule product/([0-9]+) product/$1?utm_source=askjeeves&utm_medium=cpm [L]
With this code you'll navigate to www.example.com/product/12345 but the system will see full URL which is www.example.com/product/12345?utm_source=askjeeves&utm_medium=cpm
Thank you for providing this Alexandros, unfortunately I do not have access to my company's website hosting files to try this.
– Jared
Nov 19 '18 at 16:25
Then, @Jared there is no way to do that without your system files. Otherwise this would be a big vulnerability issue
– Alexandros Bantzos
Nov 19 '18 at 16:40
add a comment |
You can do this on your .htaccess. Try the following code into your .htaccess file (Create one if you don't have already) and give me a feedback please.
RewriteEngine On
RewriteRule product/([0-9]+) product/$1?utm_source=askjeeves&utm_medium=cpm [L]
With this code you'll navigate to www.example.com/product/12345 but the system will see full URL which is www.example.com/product/12345?utm_source=askjeeves&utm_medium=cpm
You can do this on your .htaccess. Try the following code into your .htaccess file (Create one if you don't have already) and give me a feedback please.
RewriteEngine On
RewriteRule product/([0-9]+) product/$1?utm_source=askjeeves&utm_medium=cpm [L]
With this code you'll navigate to www.example.com/product/12345 but the system will see full URL which is www.example.com/product/12345?utm_source=askjeeves&utm_medium=cpm
answered Nov 19 '18 at 16:09
Alexandros BantzosAlexandros Bantzos
428
428
Thank you for providing this Alexandros, unfortunately I do not have access to my company's website hosting files to try this.
– Jared
Nov 19 '18 at 16:25
Then, @Jared there is no way to do that without your system files. Otherwise this would be a big vulnerability issue
– Alexandros Bantzos
Nov 19 '18 at 16:40
add a comment |
Thank you for providing this Alexandros, unfortunately I do not have access to my company's website hosting files to try this.
– Jared
Nov 19 '18 at 16:25
Then, @Jared there is no way to do that without your system files. Otherwise this would be a big vulnerability issue
– Alexandros Bantzos
Nov 19 '18 at 16:40
Thank you for providing this Alexandros, unfortunately I do not have access to my company's website hosting files to try this.
– Jared
Nov 19 '18 at 16:25
Thank you for providing this Alexandros, unfortunately I do not have access to my company's website hosting files to try this.
– Jared
Nov 19 '18 at 16:25
Then, @Jared there is no way to do that without your system files. Otherwise this would be a big vulnerability issue
– Alexandros Bantzos
Nov 19 '18 at 16:40
Then, @Jared there is no way to do that without your system files. Otherwise this would be a big vulnerability issue
– Alexandros Bantzos
Nov 19 '18 at 16:40
add a comment |
I don't know facebook's find and replace function, but generally a regex should look like this:
(^http.*$)
Then replace with:
$1?utm_source=askjeeves&utm_medium=cpm
You can also try with:
1?utm_source=askjeeves&utm_medium=cpm
If facebook follows 'normal' regexes, this should Work.
Edit: try these things too, it might Work.
Thank you Poul - trying this and hitting preview all of the product URLs were replaced with http. However, you're on to something as this half worked. Are there any other 'normal' regexes I could try? I have 1000s of product URLs that will end in a digit, appending/replacing my tracking without disrupting the original part of URL is what I am trying to achieve
– Jared
Nov 19 '18 at 16:45
That worked - legend! Thanks Poul!
– Jared
Nov 19 '18 at 16:51
add a comment |
I don't know facebook's find and replace function, but generally a regex should look like this:
(^http.*$)
Then replace with:
$1?utm_source=askjeeves&utm_medium=cpm
You can also try with:
1?utm_source=askjeeves&utm_medium=cpm
If facebook follows 'normal' regexes, this should Work.
Edit: try these things too, it might Work.
Thank you Poul - trying this and hitting preview all of the product URLs were replaced with http. However, you're on to something as this half worked. Are there any other 'normal' regexes I could try? I have 1000s of product URLs that will end in a digit, appending/replacing my tracking without disrupting the original part of URL is what I am trying to achieve
– Jared
Nov 19 '18 at 16:45
That worked - legend! Thanks Poul!
– Jared
Nov 19 '18 at 16:51
add a comment |
I don't know facebook's find and replace function, but generally a regex should look like this:
(^http.*$)
Then replace with:
$1?utm_source=askjeeves&utm_medium=cpm
You can also try with:
1?utm_source=askjeeves&utm_medium=cpm
If facebook follows 'normal' regexes, this should Work.
Edit: try these things too, it might Work.
I don't know facebook's find and replace function, but generally a regex should look like this:
(^http.*$)
Then replace with:
$1?utm_source=askjeeves&utm_medium=cpm
You can also try with:
1?utm_source=askjeeves&utm_medium=cpm
If facebook follows 'normal' regexes, this should Work.
Edit: try these things too, it might Work.
edited Nov 19 '18 at 16:48
answered Nov 19 '18 at 16:27
Poul BakPoul Bak
5,46831232
5,46831232
Thank you Poul - trying this and hitting preview all of the product URLs were replaced with http. However, you're on to something as this half worked. Are there any other 'normal' regexes I could try? I have 1000s of product URLs that will end in a digit, appending/replacing my tracking without disrupting the original part of URL is what I am trying to achieve
– Jared
Nov 19 '18 at 16:45
That worked - legend! Thanks Poul!
– Jared
Nov 19 '18 at 16:51
add a comment |
Thank you Poul - trying this and hitting preview all of the product URLs were replaced with http. However, you're on to something as this half worked. Are there any other 'normal' regexes I could try? I have 1000s of product URLs that will end in a digit, appending/replacing my tracking without disrupting the original part of URL is what I am trying to achieve
– Jared
Nov 19 '18 at 16:45
That worked - legend! Thanks Poul!
– Jared
Nov 19 '18 at 16:51
Thank you Poul - trying this and hitting preview all of the product URLs were replaced with http. However, you're on to something as this half worked. Are there any other 'normal' regexes I could try? I have 1000s of product URLs that will end in a digit, appending/replacing my tracking without disrupting the original part of URL is what I am trying to achieve
– Jared
Nov 19 '18 at 16:45
Thank you Poul - trying this and hitting preview all of the product URLs were replaced with http. However, you're on to something as this half worked. Are there any other 'normal' regexes I could try? I have 1000s of product URLs that will end in a digit, appending/replacing my tracking without disrupting the original part of URL is what I am trying to achieve
– Jared
Nov 19 '18 at 16:45
That worked - legend! Thanks Poul!
– Jared
Nov 19 '18 at 16:51
That worked - legend! Thanks Poul!
– Jared
Nov 19 '18 at 16:51
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377376%2fappend-utm-tracking-to-urls%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What does this have to do with regex? You're just appending a string to an url.
– Poul Bak
Nov 19 '18 at 16:04
Unfortunately there isn't the option to select append from the custom rule settings in FB's business manager. There is the option to find and replace regex however, and thought there must be a way I can achieve this using this option. I've just never really used regex before.
– Jared
Nov 19 '18 at 16:22
Find
(?m)$replace?utm_source=askjeeves&utm_medium=cpm– sln
Nov 19 '18 at 18:57