Skip to content

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

Open

Description

@tgowing

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.

Activity

  1. bjesus commented on May 16, 2023

    @bjesus
    Member

    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.

  2. tgowing commented on May 17, 2023

    @tgowing
    Author

    @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
    
  3. kuba-orlik commented on Sep 1, 2023

    @kuba-orlik
    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 😉

  4. changed the title [-]Question about the custom fields[/-] [+]Put all custom fields in the `data` query parameter automatically[/+] on Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    PRs welcomegood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions