Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put all custom fields in the data query parameter automatically #1

Open
tgowing opened this issue May 10, 2023 · 3 comments
Open

Put all custom fields in the data query parameter automatically #1

tgowing opened this issue May 10, 2023 · 3 comments
Labels

Comments

@tgowing
Copy link

tgowing commented May 10, 2023

We would like to send custom fields set in the Zaraz remarketing tool interface to Google Ads and are wondering wether payload.data is the variable holding the custom fields content:

const params = new URLSearchParams({ ...query, ...data }).toString()

Is this correct? Is this line the part where the custom fields get merged in the parameters?

We are expecting to see custom field data set as parameters in Google ads in the segment creation section in Audiences as follows:

Screenshot 2023-05-10 at 6 41 11 pm

For some reason we do not receive the custom field value as a custom parameter to use in creating custom segment in Google Ads. What could be the reason? Could you give an example of how the URL looks like with custom fields?

Thank you very much indeed.

@bjesus
Copy link
Member

bjesus commented May 16, 2023

Hey @tgowing ! Indeed this is the line that all the additional parameters are being added.

I can't really comment on the Google Ads side of things as I do not know how that works. You should be able to see the request URL if you use the Zaraz Debugger. The path to solving this issue probably starts with trying out the original Google Ads implementation and seeing how their URL looks like when adding parameters. This was we can compare and see if and what is missing on our side.

@tgowing
Copy link
Author

tgowing commented May 17, 2023

@bjesus Thanks very much. I discovered that the current code allows us to send the custom parameters correctly. Google ads expects the custom parameters to be sent in the data paramater of the request.

So when setting a Custom field in the CF interface it will just be appended to the request. So it will look like this:

https://googleads.g.doubleclick.net/pagead/viewthroughconversion/google-ads-id/
?guid=ON&
random=0000000&
fst=000000&
cv=9&
sendb=1&
num=1&
u_cd=24&
u_java=false&
url=https://example.com&
tiba=Page-title&
u_tz=600&
u_his=10&
ig=1&
ref=ref-url&
TEST_PARAMETER=true

Instead it should look like this:

...
ref=ref-url&
data=TEST_PARAMETER%3D42%3BSECOND_TEST_PARAM%3D42

I was able to make this change via CF interface custom fields settings and now it works as it should.

In the Cloudflare UI we don't have to encode the data field value, so it will be like this:

TEST_PARAMETER=42;SECOND_TEST_PARAM=42

@kuba-orlik
Copy link
Contributor

Glad you've found a manual way to do this! We are considering native support for custom fields in this component in the future. PRs are welcome 😉

@kuba-orlik kuba-orlik changed the title Question about the custom fields Put all custom fields in the data query parameter automatically Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants