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

New customer data with lifetime value #265

Open
Ylmzef opened this issue Jan 12, 2025 · 3 comments
Open

New customer data with lifetime value #265

Ylmzef opened this issue Jan 12, 2025 · 3 comments

Comments

@Ylmzef
Copy link

Ylmzef commented Jan 12, 2025

Hi,

I would like to know if the module currently supports passing new customer data into the data layer for Google Ads conversions, as described in Google Ads Data Layer Configuration.

Scherm­afbeelding 2025-01-12 om 09 07 02

If this feature is not yet available, are there any plans to include this functionality in a future release?

Thank you for the great work on this module!

@jissereitsma
Copy link
Collaborator

Thanks for posting. As a developer of the Magento extension only and not being a Google SEO expert, I find it hard to translate what you are posting towards what kind of feature. So yes, this extension is extensible in various ways. And yes, it is meant for developers that want to build custom solutions.

Could you please make this concrete towards the data layer only (because whatever you do within your own Google environment is really NOT part of this Magento extension)? Could you post a piece of data layer without and with your specific request?

@Ylmzef
Copy link
Author

Ylmzef commented Jan 13, 2025

Hello,

Thank you for your response. I apologize for the confusion earlier. Allow me to clarify my request with specific details related to the data layer.

The data layer configuration I’m referring to is detailed in the following Google Ads documentation:
Google Ads Data Layer Configuration.

This setup sends data to Google Ads, including information about whether a customer is new (new_customer) and their lifetime value (customer_lifetime_value), to support campaign optimization and reporting.

To make my request more concrete, here’s an example of the data layer output:

Without the requested implementation:

window.dataLayer = window.dataLayer || [];  
window.dataLayer.push({  
    'event': 'purchase',  
    'transactionId': '12345',  
    'transactionValue': 100.00  
});

With the requested implementation:

window.dataLayer = window.dataLayer || [];  
window.dataLayer.push({  
    'event': 'purchase',  
    'transactionId': '12345',  
    'transactionValue': 100.00,  
    'new_customer': true, // Boolean indicating whether this is a new customer  
    'customer_lifetime_value': 500.00 // Cumulative value of all past transactions  
});

My question is whether this Magento extension supports extending the data layer to include fields such as new_customer and customer_lifetime_value. If it does, could you provide guidance or confirm whether this can be achieved through customizations?

Thank you for your support!

@jissereitsma
Copy link
Collaborator

The extension is open source, so it actually allows for any customization.

A couple comments of mine:

Your code suggests that this is dealing with the purchase event. It is missing the ecommerce data, but I assume you left this out on purpose. Please see the relevant code here: https://github.com/yireo/Yireo_GoogleTagManager2/blob/master/DataLayer/Event/Purchase.php#L53

As a developer, you can simply create a DI plugin for this method (afterGet) and add the details you want. If you think this is useful to others, please consider making a Pull Request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants