Alexenn Posted December 12, 2019 Share Posted December 12, 2019 (edited) Hello, first of all i'm using Prestashop 1.7. I'm using paid SEO from google adword and I would like to have more informations about where the customer is coming from when he uses the contact form. I found an interesting setting to do that in google adwords called "URL options", basically it's gonna add parameters to the link the paid ad is pointing to. For example when ad is pointing to the url: example.com/some_category/259-some_product.html when clicking the ad google is going to add parameters like this: example.com/some_category/259-some_product.html?Google_ad=1&adgroupid=21 So i'm wondering how I could make it so these parameters are copied in the URL of every pages the customer is going, so when he fills in the contact form I can just extract those parameters and add them to the mail body. Do I have to override and modify almost every functions in the Link.php class? is there another way? Thanks! Edited January 6, 2020 by Alexenn Solved (see edit history) Link to comment Share on other sites More sharing options...
Alexenn Posted December 20, 2019 Author Share Posted December 20, 2019 Anyone? Link to comment Share on other sites More sharing options...
tomerg3 Posted December 27, 2019 Share Posted December 27, 2019 I think the cleanest solution would be to save those variables in a cookie, and add it to the contact form message. You can check the $REQUEST in FrontController.php, as it gets executed in every page, and if they are set, save them to a cookie. Then, modify the contact form controller to read the cookie data, and if it is set, add it to your message 1 Link to comment Share on other sites More sharing options...
Alexenn Posted January 6, 2020 Author Share Posted January 6, 2020 Thanks for your answer ! Great idea, I never thought about using cookies for some reasons, that's a way better solution. Not sure what to do with the $REQUEST though, I'm going to just use $_GET to check if a page has a "get" parameter in its url. Would it be cleaner to manipulate $REQUEST? Link to comment Share on other sites More sharing options...
tomerg3 Posted January 13, 2020 Share Posted January 13, 2020 $REQUEST has parameters, whether they were sent using GET or POST, if you know it's a GET request, then no need to use it. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now