-
Notifications
You must be signed in to change notification settings - Fork 115
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
Tracking Sales with UTM Parameters using Buy Button #861
Comments
have the same question |
There was a guide someone wrote a few years ago. I tried it but could not get it to work: https://trackfunnels.com/how-to-pass-utm-parameters-into-product-shopify-buy-button-checkout/ |
Hi folks 👋 , I've updated the solution I previously posted with a new approach, as it appears that the |
We took a similar approach (overriding
const openCheckout = (that): void => {
// We're overriding `buttonDestination: "checkout"` to incorporate our referralTrackingQueryParams.
// @see: https://github.com/Shopify/buy-button-js/blob/master/src/components/product.js#L665-L686
that._userEvent("openCheckout");
that.props.tracker.track("Direct Checkout", {});
const selectedVariantShortId = that.selectedVariant.id.replace("gid://shopify/ProductVariant/", "");
const selectedQuantity = that.selectedQuantity;
const { domain } = ui.config;
const checkoutUrl = appendQueryString(
`https://${domain}/cart/${selectedVariantShortId}:${selectedQuantity}`,
referralTrackingQueryParams,
);
log("checkoutUrl", checkoutUrl);
const windowFeatures = ui.components.cart[0].checkout.params;
log("windowFeatures", windowFeatures);
window.open(checkoutUrl, "checkout", windowFeatures);
}; A small upside here is the url is generated synchrously, so the pop-up immediately loads its destination rather than rendering blank while waiting for the follow-up async call. Unclear if there are downsides to using this flow, however.
|
Some update here? |
@trackfunnels Unfortunately, your updated version doesn't work either. We see the utm tags in the URL but they aren't getting tracked. |
Hi @joker-777 can you elaborate what you mean by you see UTM tags in the URL but arent getting tracked? When UTMs are passed into the URL, GA4 will automatically pick them up. |
@trackfunnels We definitely can see the utm params in the URL when getting redirected to the checkout page. But then they aren't getting tracked in shopify |
Did this ever get resolved |
Not for us. We used a completely different solution in the end. |
Hello,
I am trying to pass UTM parameters in the Buy Button checkout URL to track sales from different sources. For example, I will have the same Buy Button Code on three other sites and want to track sales for each. I have tried manipulating the URL using the following event function, but the landing_site or UTM tracking parameters are not working or do not work with the Buy Button. For context, I use the same code for the Online Store and can see tracking in the reports. Also, the code below allows me to pass the URM parameters in the URL. However, Shopify is not recognizing them in the reports.
Does anyone know or have had experience or success tracking sales with Google Analytics or UTM parameters from Buy Button?
The text was updated successfully, but these errors were encountered: