0

I am working on a WordPress Site. I just want to add a button on a page and track its behavior.

My main question is when I create a campaign URL, I just want to change button behavior according to the URL parameter.

For example:

Imagine, I have a URL such as http://mylocalsite.com/campaign-page/?campaign=linkedin . I just want to show a button that goes to the LinkedIn url.

On the other hand, imagine, I have a http://mylocalsite.com/campaign-page/?campaign=facebook and then I want to show the same or different button that goes to Facebook URL.

Is there any way to do that? I can create campaign URLs with some marketing plugins, but I could not find a plugin that makes button smart according to URL.

Thanks in advance for suggestions

2
  • 1
    This has nothing to do with WordPress, simple if else statement in PHP will do it.. if ($_GET['campaign'] == 'linkedin') { echo '<a href="#">LinkedIn</a>'; } elseif ($_GET['campaign'] == 'facebook') { echo '<a href="#">Facebook</a>'; }
    – Abhik
    Oct 20, 2022 at 17:18
  • It works with code snippet tools. But there is a problem with giving URL as snippet to button. I can handle it different way, I think. Thanks a lot
    – YMG
    Oct 21, 2022 at 16:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.