[−][src]Struct gtag_rs::DataLayer
A wrapper around Google's gtag.js framework.
Methods
impl DataLayer
[src]
pub fn new(id: impl Into<String>) -> Self
[src]
Create a DataLayer
object that can be used to push data with the given ID.
pub fn push_simple(&self, cmd: &str)
[src]
Push data with no parameters.
pub fn push(&self, cmd: &str, params: &impl Serialize) -> Result<()>
[src]
Push data with the given parameters.
This function can fail if there is an error serializing the data to a JsValue
.
As a parameter value, this accepts any type that can be serialized to Json using Serde.
This can be done by deriving Serialize
from serde
or using the json!
macro from
serde_json
.
#[derive(Serialize)] struct Pageview { page_title: Option<String>, page_location: Option<String>, page_path: Option<String>, }
json!({ "page_title": "index.html", "page_path": "/", })
Auto Trait Implementations
impl RefUnwindSafe for DataLayer
impl Send for DataLayer
impl Sync for DataLayer
impl Unpin for DataLayer
impl UnwindSafe for DataLayer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,