0

I'm currently working on a project that has a legacy system, unique product, and unique webstore which can't really be changed or updated at the moment.

I've programed a bash script to check the backend and pull the relevant info. The script should trigger an Ad conversion depending on various factors that I've programed into the script. The script currently checks and executes everything correctly except the ad conversion part.

  1. How can I get curl or wget to execute an ad conversion with Google Adword using the JS code that normally goes in the header

Do I have to make a dummy html page and add this code or can I add it directly to the script or wget/curl's command line?

Can wget/curl trigger the code standalone, can it trigger it in an html page?

  1. Whats the default behavior of wget/curl when fetching a page that has ads or some kind of tracking?

Is there a way for me to build a URL with google's or matomo's API that would trigger a conversion?

1
  • 1
    Curl or wget will just get your page from your website, and not execute its JS scripts. To do a conversion, you will have to click and execute the JS script. One thing to do is to load the page through a proxy like OWASP ZAP which record what’s happening. Then you might have some clue about the requests which trigger a conversion. Note, I guess Google may add some difficulties to avoid their system circumvented. Then I can’t assure you my answer to be efficient. Nov 14, 2021 at 16:15

1 Answer 1

1

How can I get curl or wget to execute an ad conversion with Google Adword using the JS code that normally goes in the header

  1. Find out what the script does, simulate API calls from the script with shell + curl. This will only work until Google changes the script to do something different.

  2. Extract the script, try to run it with node, stub or change things that only work in the browser. This will stop working when Google changes the script so you need to stub out different things.

  3. Use the remote control feature that some browsers (Chrome, Firefox) have to load the page inside a browser. You can also do that "headless", i.e. without displaying a browser window.

All three solutions do require some effort.

Do I have to make a dummy html page and add this code

That would be solution (3) above. Depending on what "this code" you are talking about, "this code" will probably load more code from Google.

Whats the default behavior of wget/curl when fetching a page that has ads or some kind of tracking?

Both wget and curl completely ignore any Javascript. You just download the HTML. So, no ads, no tracking, nothing.

can I add it directly to the script or wget/curl's command line?

No, see above for the reason.

Is there a way for me to build a URL with google's or matomo's API that would trigger a conversion?

You need to execute the Javascript code that Google provides. It doesn't matter how you build the URL.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .