Support » Plugin: GiveWP - Donation Plugin and Fundraising Platform » Donation ID Code Expression

  • Resolved nabeel13

    (@nabeel13)


    Hi,

    I hope you are well.

    I have set up Google Ads donation conversion tracking with Google Tag Manager.

    However, to avoid counting duplicate conversions I need to enter a dynamic order ID to Google Tag Manager.

    What is the Donation ID code expression that I can use (for example: <%= orderId %> )?

    Thank you.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi there,

    The best place to start looking for the Donation ID is in the $_POST variable on the Donation Confirmation page.

    Doing a var_dump($_POST); on the Donation Confirmation page will show you all the information available, and then you can populate your variables as needed.

    Thanks!

    Hi gsamsmith,

    Thank you for your assistance.

    However, I don’t know how to debug php or how to do a var_dump().

    Can this be accomplished with Google Chrome developer tools?

    Sure thing, happy to help.

    We’ve actually written an article that shows how to query donor information, and the final code snippet has a var_dump example of getting all that information displayed out on a page.

    Here’s the link to that:
    https://givewp.com/documentation/developers/how-to-query-donor-information/

    Have a great rest of your day!

    Hi gsamsmith,

    Thank you for for the support article and please forgive my non-technical use of coding terminology.

    However, I am not trying to query specific donor information,
    but rather, I am trying to get the code that is added to the page that generates the donation ID.

    For example, this would be the code added to the donation confirmation page:

    'donation_id': '<%= orderId %>',.

    When a user completes a donation, the code would be updated as below:

    'donation_id': '123456',.

    So what I am trying to get is not the donation ID “123456”, but rather, the code that generates the donation ID, such as, <%= orderId %> (As explained in this article Use an order ID to minimize duplicate conversions
    ).

    I cannot get the code on the WordPress website because GiveWP uses a shortcode to generate donor information on the donation confirmation page and the information displayed on a completed donation would only be the generated donation ID such as “123456”.

    Please can I have the placeholder code that you use to generate variable donation IDs such as <%= orderId %>?

    Thank you for your assistance.

    nabeel13

    (@nabeel13)

    Hi gsamsmith,

    Is this the code that used to generate the donation ID

    donation_id:t.getAttribute("data-donation-key")?

    Specifically "data-donation-key"?

    Thank you.

    Hi there,

    The variable that holds the donation ID is “$donation_number”.

    Here’s a link to the line of code that outputs this ID onto the donation confirmation page:

    https://github.com/impress-org/givewp/blob/6678bf4694069cb7582dd07cd47e2d131c9a2d29/templates/shortcode-receipt.php#L86

    Because Give uses sequential ordering, an ID is assigned to keep the donations ID’s in numerical order. Here’s an article on this as well:
    https://givewp.com/documentation/core/settings/general-settings/sequential-ordering/

    Thanks.

    nabeel13

    (@nabeel13)

    Hi gsasmith,

    Thank you for your invaluable assistance.

    I really appreciate it.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.