diff --git a/measurement_protocol.module b/measurement_protocol.module index 80c7beb..fdc21cd 100644 --- a/measurement_protocol.module +++ b/measurement_protocol.module @@ -139,6 +139,26 @@ function mpte($category, $action, $label = NULL, $value = NULL, $data = array()) } /** + * Tracks a social interaction with Google Analytics. + * + * @param string $network + * The social network. + * @param string $action + * The social action, for example, "like". + * @param string $target + * The target of the social interaction. + * @param array $data + * (optional) Extra data to send with the interaction. + */ +function mptsi($network, $action, $target, $data = array()) { + $data['t'] = 'social'; + $data['sn'] = $network; + $data['sa'] = $action; + $data['st'] = $target; + mpt($data); +} + +/** * Grabs the cookie from the existing session if it is available. * * If it is not available, then we generate one or pass the anonymous CID.