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

Add dataLayer.push() for GTM on dailyidea.com when opening ideas #1051

Open
ikosovec opened this issue Aug 15, 2021 · 4 comments
Open

Add dataLayer.push() for GTM on dailyidea.com when opening ideas #1051

ikosovec opened this issue Aug 15, 2021 · 4 comments

Comments

@ikosovec
Copy link

Hey @vedmant , here's the issue we're having with GTM explained. What we would like to achieve here is to track each even when users view an idea (each time).

Issue: Only the first page is tracked.

Why is this happening? The website is basically a Single Page Application (SPA). These complications occur whether you’re using Angular, React, Backbone, or any other front-end framework or code that manipulates the History API or fragment alongside changes to on-page content.

Solution: Developer needs to push the data into the data layer so that a custom event can be set up as a trigger and deployed via GTM.

A single line of code.
Code:
dataLayer.push({event: 'pageview'});

Here the issue is explained in more detail: https://www.bounteous.com/insights/2018/03/30/single-page-applications-google-analytics/

@vedmant
Copy link
Collaborator

vedmant commented Aug 24, 2021

@ikosovec Ok, actually looks like we had a different issue, we use nuxt module @nuxtjs/gtm for this, and it was put in a wrong place in the config, I just moved it, so it should track all pages.

@vedmant
Copy link
Collaborator

vedmant commented Aug 24, 2021

@ikosovec The only place it may not work is when swiping between ideas, I'll add manual push for this.

vedmant added a commit that referenced this issue Aug 24, 2021
@ikosovec
Copy link
Author

Hey!
It looks like the virtual pageview event is not set up right.

Now it is being pushed to the data layer, but not for all the pages of Daily Idea website, but only for the https://www.dailyidea.com/ideas-cards (which can be accessed via "Explore" in the main navigation, and "Get started" button on the homepage).

The event is supposed to be pushed in to the data layer on all the URL-s of the website.

vedmant added a commit that referenced this issue Aug 30, 2021
@vedmant
Copy link
Collaborator

vedmant commented Aug 30, 2021

@ikosovec I made edits, it should be deployed in 20 mins

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