Jeff Rowley
Jeff Rowley

Reputation: 73

Can I add non_interaction parameter on manual pageview gtag(event)

I've been having bounce rates very close to 0% (0-0.9%) and want to implement a non_interaction parameter on all the events on my landing pages. I'm not super knowledgeable in JavaScript and am making updates the updates then sending them to the developers. We have multiple landing pages, so we send a manual page_view event using this code. documentation

gtag('event', 'page_view', {
  page_path: '<Page Path>',
})

The documentation for adding the non_interaction parameter looks like this

gtag('event', 'video_auto_play_start', {
  'event_label': 'My promotional video',
  'event_category': 'video_auto_play',
  'non_interaction': true
});

Can I just add the 'non_interaction' : true to the code snippet? It will look like this

gtag('event', 'page_view', {
  page_path: '<Page Path>',
  'non_interaction': true
});

I am wondering if I should remove or keep the single quotes around the 'non_interaction' parameter. The documentations list the parameters differently. If I take off the single quotes will that affect my event tag? Or do I leave the single quotes on the 'non_interaction' parameter and have one parameter with single quotes and one without?

Upvotes: 1

Views: 253

Answers (1)

Jeff Rowley
Jeff Rowley

Reputation: 73

Bounce rates were high because of the event snippet was firing as well as the config() snippet of code. Instead of adding

gtag('event', 'page_view', {
  page_path: '<Page Path>',
})

Just add the page_path: parameter to the config() snippet. Then it will fix any issues you have with recognizing the landing pages and the bounce rates will track correctly.

gtag('config', 'GA_MEASUREMENT_ID', {
  'send_page_view': false,
   page_path: '<Page Path>',
  'groups': 'agency'
});

Upvotes: 1

Related Questions