Jump to content

Google ad integration to report on an event triggered on a third party tool

Recommended Posts

Posted (edited)

Hi all,

 

Just want to make sure I'm doing this correctly. I use a third party tool called GoodShuffle. I also use Google Ads. I want to use an event listener to report to google ads when a "Wishlist" is submitted (the equivalent of a checkout on an online store)

 

I currently have my Google ads account tag already setup on my website. The Goodshuffle documentation isn't super clear to me, but it says the following needs to be added, I assume as a code snippet.

// add listener for wishlist submit event
document.addEventListener("gspro-wishlist.submit", function(data) {
    // get our data from the detail object
    var wishlistCount = data.detail.wishlist.length
    var clientFullName = data.detail.contact.firstName + " " + data.detail.contact.lastName
    // construct a message
    var message = clientFullName + " submitted a wishlist with " + wishlistCount + " items."
    // send to Google Analytics
    gtag('event', 'Submission', {
        'event_category': 'Wishlist',
        'event_label': 'Wishlist Submission',
        'value': message
    });
})

https://docs.goodshuffle.dev/docs/integrations/events/#submit-wishlist

 

 

The way I have it formatted is as follows in my footer:

 

<script>
document.addEventListener("DOMContentLoaded", function() {
    document.addEventListener("gspro-wishlist.submit", function(data) {
        // get our data from the detail object
        var wishlistCount = data.detail.wishlist.length
        var clientFullName = data.detail.contact.firstName + " " + data.detail.contact.lastName
        // construct a message
        var message = clientFullName + " submitted a wishlist with " + wishlistCount + " items."
        // send to Google Analytics
        gtag('event', 'Submission', {
            'event_category': 'Wishlist',
            'event_label': 'Wishlist Submission',
            'value': message
        });
    });
});
</script>

Just wondering if my way would work with squarespace. I'd just run a test myself but to do so would mean changing my ad campaign and putting my ads back in the learning phase which costs money, potential business, etc.


Thanks!

 

- Tyler

 

Edited by Slumpy
misplaced sentence
Link to comment
  • Replies 0
  • Views 389
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.